Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:37
using a flash .swf for the subimage
Poster: sims11tz
Dated: Tuesday July 26 2005 - 21:33:46 BST
Is it possible to use a .swf for a subimage inside of a menu. It would help me a lot. I tried putting the <object><embed></embed></object> inside of the subimage property but it looks like it puts an <img> tag around it.
Thanks in advanced
http://www.davegeurts.com
Poster: Ruth
Dated: Tuesday July 26 2005 - 23:15:38 BST
Hi Sims,
After experimenting, surprise, surprise..... you can actually put flash in the menu and therefore use some flash object as a subimage. Having said that, I only tested this in IE, Netscape, Opera, Firefox, I have no way to test with Mac systems. And, unfortunately, you can't do what you want, which is hardcode the flash after the subimage= parameter. Sorry.
But, if you don't mind doing a bit of work, or if you don't have a whole lot of submenus you can hardcode the flash object into the item. The following code is what I used, using some flash thing I found in a Corel tutorial and setting the size real small to emulate a subimage.
Code:
aI("text=<OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 height=15 width=10 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000><PARAM NAME='movie' VALUE='lilmagfog.swf'><PARAM NAME='quality' VALUE='high'><PARAM NAME='wmode' VALUE='opaque'><embed src='lilmagfog.swf' quality='high' wmode=transparent pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='10' height='15'></embed></OBJECT> Hello just trying flash;url=something;type=html;");
OK, to explain some things.
1. You have to use type=html in the aI string as shown in the code above.
2. If you try to set the object after the text, it will be positioned immediately after it, no space.
3.Trying to insert non-breaking line spaces [& n b s p] after the text and before the flash to shift the flash object stops anything from showing after the first non-breaking line space.
4. Putting the flash object 1st and then following it with the non-breaking line spaces and the text works, shows both the flash and the text.
5. setting align='right' into the flash object code doesn't work, it won't shift the flash object over to the right side of the item space.
6. for whatever reason, you have to set both the flash object and the flash player to the same size as of the subimage. In IE it takes its size from the 'image/object' but in Netscape if you don't set the flash player to the same size as teh image, it will make the image the size of the player.
7. if you use a flash object, when you mouseover nothing happens to the flash object, it will not show the onbgcolor through it.
There may be other issues, those were all I figured out in my short test.
Hope this helps.
Ruth
Poster: sims11tz
Dated: Tuesday July 26 2005 - 23:23:39 BST
Wow Ruth great response... I have to take off from work but I am going to try this out tomorrow. I will let you know how it goes and list any problems I run into just incase somebody reads this in the future.
Poster: Ruth
Dated: Wednesday July 27 2005 - 0:20:12 BST
Hi Sims,
Could you make the flash object available someplace where I can get it? That way if you run into a problem, I can work on what you have, not a different object.
Ruth
Poster: sims11tz
Dated: Wednesday July 27 2005 - 17:03:37 BST
Hey I am playing with it right now.... so from what I can tell the only way to place any type of html object in a menu item is in the text= attribute?
-Dave
Poster: sims11tz
Dated: Wednesday July 27 2005 - 21:05:31 BST
Its not completely done but I got a flash piece to be transparent and a subImage aligned Right. It took some Jerry Rigging but it works pretty good. This will save a lot of file size and graphic creation because I am using tranparencys in flash and we have different color sub menu's. Im also working on a javascript function that tells flash to animate/change colors for mouse overs and things.
I will post all of my code when i am done if anybody is interested.
Poster: Ruth
Dated: Wednesday July 27 2005 - 21:47:48 BST
Hi,
Just remember to test whatever you're doing in the menu in the different browsers. What works in one may not work in another
I'll look forward to your post. If it works in different browsers I'm sure other users will be interested.
Ruth
Poster: sims11tz
Dated: Thursday July 28 2005 - 21:15:44 BST
I got it working!!!!
Working Example: http://www.engagethoughtware.com/v3/pages/products/index.php
current code working and tested on:
FireFox v1.0.6 winXP
IE v6.0.2900 winXP
Netscape v7.2 winXP
NEEDS TESTING ON A MAC
does not currently work on:
Opera v8 "probably will never look into this"
Okay it took a few work arounds that are not as efficient as they could be if Milonic added some flash support in the menu system. But It works great just not as quickly editable and easy to set up as JPG's or antyhing else in milonics present system.
Ok lets take this one step at a time... if you go look at the example posted above check out the 4 dots on the very left side of the menu. You will notice that it is a small flash piece and they animate when you mouse over the menu item. They always use a transparent background so you can see the mouse over bgcolor through them. Also if you decide to change colors in your menu you will not need to recreate JPG'S with different bgcolors!!! This is huge to me because flash is so much smoother than a transparent .gif and this means better development time when the boss wants different colors every week. I can no also have smooth flash animations on mouseOver!
so enough with the rant here is some example code on how I made this happen:
http://www.engagethoughtware.com/v3/pages/subMenu/example.html
Check out the link above and then do a view source. I tried to put in enough comments that would explain how this works. If anybody cant figure it out or need further explanation dont hesitate to email me and ask questions.
Here is the flash source code for the animation. It basically constantly checks for a variable to be set via javascript that is triggered by the milonic onfunction and offfunction.
http://www.engagethoughtware.com/v3/pages/subMenu/example.fla
If you check the working example at the top you will also notice that I have flash arrows that are the basically the same as the subimage in the milonic system. I would provide some examples and content on this but it is really in depth. My milonic menu system actually is populated with .xml and read by php. I then use php to determine if the menu item has any sub items than I place the arrow. If it sounds confusing sorry. If you would be interested in this let me know and I can send you the source code. The biggest problem I ran in to with this.... is I had to put a table inside of the ai() and it broke the style of the menu item... so I had to put in my own css class.
AGAIN SORRY IF THIS IS CONFUSING OR DOESNT HELP MUCH I have never written any type of tutorial or anything so Im not used to explaing how things work.. if you have any questions or need help to hesitate to email or message me.
-Dave Geurts
Poster: Ruth
Dated: Friday July 29 2005 - 4:56:59 BST
Hi Dave,
Just fyi, it works in IE5.5, Netscape7.1. It doesn't work in Firefox 1.02, Netscape6, or any Opera I have.
It looks fantastic. I tried to use it in the code I posted but it only gives me inanimate dots I wonder if an animated flash, not one that animates on mouseover, but one that has animation in it would work?
Ruth
Poster: sims11tz
Dated: Friday July 29 2005 - 18:26:05 BST
That is weird it doesnt work in your firefox 1.02 I need to download some older browser versions and see if I can see what the problem is.... do you get errors or no animations or?
With the flash piece unfortunately it isnt as easy as just making a flash button that has a rollover state. You have to setup a movieclip that checks a variable that the javascript sets on mouse over... if you download the fla I posted you can copy and use the code that I made.
Poster: Ruth
Dated: Friday July 29 2005 - 19:06:13 BST
Hi,
I did download the .fla I have no clue what that is. How would I open it or where would I put it.
Yes, I got errors. The Firefox ones are:
Code:
Error: getBrowser(who).SetVariable is not a function Line: 240
if(level == "root" || level == "rootNS"){getBrowser(who+"_dots").SetVariable("aniOn", "true");}
Error: getBrowser(who + "_dots").SetVariable is not a function Line: 241
} else{
Error: getBrowser(who).SetVariable is not a function Line: 243
if(level == "root" || level == "rootNS"){getBrowser(who+"_dots").SetVariable("aniOff", "true");}
Error: getBrowser(who + "_dots").SetVariable is not a function Line: 244
}
if(level == "root" || level == "rootNS"){getBrowser(who+"_dots").SetVariable("aniOn", "true");}
Error: getBrowser(who + "_dots").SetVariable is not a function Line: 241
} else{
Error: getBrowser(who).SetVariable is not a function Line: 243
if(level == "root" || level == "rootNS"){getBrowser(who+"_dots").SetVariable("aniOff", "true");}
Error: getBrowser(who + "_dots").SetVariable is not a function Line: 244
}
If you want the Opera ones let me know, but I think that is going to be something with it wanting to put flash objects as the top layer no matter what.
Ruth
Poster: Andy
Dated: Saturday July 30 2005 - 13:17:15 BST
Hi,
Just looked at the code and it's not something I've seen before.
Did you write this code yourself or get it as a snippet from somewhere?
The reason I ask is that there appears to be some IE only code and I've no idea how it works
Looks like IE has created the SetVariable function as an object of the getBrowser - I've never seen ANY JavaScript like this before and would have to say it's never going to be cross browserable as it's too unique.
How are you doing the animation of the Flash object? Are you swapping the flash file or changing the parameters of the flash file you already have?
Sorry about being thick about Flash but I've never really played with it that much. I'd like to get this to work because it opens a whole range of possibilites for us
Cheers,
Andy
Poster: Andy
Dated: Tuesday August 2 2005 - 12:27:12 BST
Right, I've managed to figure it out.
Bascially, Firefox does not support the SetVariable function so you wont be able to get it to work using that.
I'm currently looking at other ways and will let you know once I know something.
Cheers,
Andy
Poster: sims11tz
Dated: Tuesday August 2 2005 - 17:33:04 BST
Andy,
Hey sorry it's been a few days I got a little busy. But ya with the Javascript it calls a function called getBrowser that returns the a object depending on what browser they are using. ie uses window[movieName] and firefox/netscape uses document[movieName] for flash objects. That is weird that setVariable is not working on your firefox. It works fine on my 1.0.6 what version of firefox are you trying this on? I am going to try and install and older firefox and see what is going on.
Basically the way the flash works: setVariables() sets a variable inside of the flash piece that equals true. Than in the flash piece I am checking the variable constantly. When flash detects that a certain variable is set to true it plays an animation. There might be a more efficient way to do this. Like if you can get javascript to call a function in flash but Im not sure if this is possible. But the setVariable seems to be working well. And then if you check out my example http://www.engagethoughtware.com/v3/pages/products/index.php Check out the arrows that are used for the subimage. I am doing the same thing I use setVariable() and I set a variable in flash to true... flash sees this and changes the arrow to be a brighter color. Than on mouse off I use setVariable() to set a different variable to true and it turns the arrow back to the original color. Unfortunatley with the subimage I had to do work arounds to get it to align right. So the subimage isnt an easy implementation but getting a flash piece on the left of a menu item or use it as a menu item is pretty easy and works great. The best part of all of this is with those dots I am using a transparent background and in our website we change the bgcolor on the menu for different sections. so I dont have to create more than one graphic. I hope this helps if you have any other questions let me know. Let me know what firefox it isnt working in for you ... so I can try and figure that out.
Poster: sims11tz
Dated: Tuesday August 2 2005 - 21:09:01 BST
Good news... with the flash player 8 that is currently in public beta, you will be able to call flash functions from javascript on any browser in any environment. So this will be huge for what you are talking about.
http://weblogs.macromedia.com/flashjavascript/