PDA

View Full Version : Tooltip with .SWF inside?



Xeophex
02-22-2008, 04:22 AM
1) Script Title: Image w/ description tooltip

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/imagetooltip.htm

3) Describe problem:

I am wondering if it is possible to have a small .swf (Flash animation) inside a tooltip? Ideally it would start playing when a hotspot is rolled over and the tooltip appears, but it would also be fine if it actually started 'playing' when page loaded then it only became visible when the tooltip is active. Just a small, probably looping .swf.

Anyone know if this is possible, and if so, how I'd go about it? Thank you in advance, I am very grateful for any help. :)

jscheuer1
02-22-2008, 04:56 AM
You can probably do that. I just tried this:


messages[0] = new Array('images/dot-com-btn.gif','<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/bnsF5lIqw1s"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/bnsF5lIqw1s" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>',"#FFFFFF");


And it showed the swf onmouseover of the link for that message item (after it loaded, and I couldn't play it because it disappeared when I moved my mouse over the tip). This is a byte heavy video swf from YouTube, if you have a small lightweight one that requires no user interaction, it could work out. Sound (if included in your swf) would be the biggest problem, because some, if not all browsers would continue to play the sound even when the swf disappears.

Xeophex
02-22-2008, 05:30 AM
Ah, yeah I didn't consider sound would be an issue. Ideally I do want the small .SWF to have a little bit of audio loop.

I had another idea: I was thinking maybe using a tooltip that drew content from an external file, then have the .SWF on its own in another page. would that still be an issue with the sound do you think?

I tried a tooltip that does this, but my hosting doesn't support PHP and although it seemed to be just Ajax/javascript/DHTML, it wouldn't work until uploaded(which to me suggest something server-side?), and when uploaded "the requested method POST is not allowed for the URL".. I guess thats something to do with php. :(

Please excuse me, my knowledge of all this is very weak. Any thoughts about this idea though? Thank you John.

jscheuer1
02-22-2008, 05:58 AM
That would depend upon the browser and the code. Many AJAX routines will not work locally in IE 7. This has to do with browser security and how the code is written. If POST is not allowed, for something that requires no user input, GET may be used. Which AJAX routine are you using?

But iframe is really the best way to deal with multimedia objects like Flash when sound is involved, as the iframe can be unloaded, just like a page, which will always stop the sound.

Xeophex
02-22-2008, 06:27 PM
'GET' worked, but still, I know next to nothing of AJAX.

I think I'll try the ifame idea for the DHTML I question; "Image w/ description tooltip". I'd just put it for a new Array right? I'll try. Just curious though as to what this "'images/dot-com-btn.gif'" is?...

Thanks again.

EDIT: I tried it with the iframe, works fine only the audio still carrys on, just as it did when it was the .SWF on it's own. Should this be the case if it's in an iframe?

jscheuer1
02-22-2008, 06:40 PM
'GET' worked, but still, I know next to nothing of AJAX.

I think I'll try the ifame idea for the DHTML I question; "Image w/ description tooltip". I'd just put it for a new Array right? I'll try. Just curious though as to what this "'images/dot-com-btn.gif'" is?...

Thanks again.

I'm having just a little trouble keeping up with you. From what I think you are asking, the iframe could go in the messages array yes, but if you want to unload it when the tip disappears, you will have to add some code to do that, to change its src attribute to - say, "about:blank".

The images/dot-com-btn.gif is just an image I had in that line as the image to show with that tip (remember, this script is deigned to show an image with the tip). You should probably use a small transparent .gif instead, as otherwise some browsers may show their broken image icon when that tip comes up.