PDA

View Full Version : Flash, Javascript and Iframes (question)


lordcatalien
02-07-2006, 01:27 AM
This may sound silly, but I have an index page that holds two iframes.

<iframe name="nav" id="nav" src="nav.php" width="900" height="325" frameborder="0" scrolling="No" marginheight="0" marginwidth="0"></iframe>
<iframe name="body" id="body" src="body.php" width="900" height="560" frameborder="0" scrolling="No" marginheight="0" marginwidth="0"></iframe>


In the nav frame is a flash that runs the navigation, which I put in an iframe because I don't want it to reload each time something is clicked.

The issue I'm having, is that I'd like a link from the body frame ("body") to affect the navigation. Initially, I only wanted links from the flash nav, but clients are indecisive like that. :(

Anyway, I've used this script in the past with great success:

http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_15683#jtfc

But I haven't had the ability to have the child iframe link affect flash in another child iframe (at the same level like the above).

This works in IE, but nothing else:
<a href="javascript:parent.top.frames.nav.myFlash.SetVariab le('myvar','press');">Press</a>

I'm worried that if i find a solution in Mozilla/Safari, it won't work in IE.

Anyone figured out how to do this? Your assistance will be cherished for years to come and, pending the gender of my future children, may have impact on their namesakes.

Thanks,

Liam

mcmcom
02-07-2006, 05:49 PM
im not exactly sure how to solve this but i can "hopefully" lead you in a direction that may help. The reason your link works in IE but not Mozilla/Safari is because they have a different DOM TREE than IE (Document Object Model) You can google DOM for Safari/Mozilla and IE and see the differences, i think the parent keyword only works in IE, so if you can replace it with something like document.top.frames.nav instead of parent it may work. Search for the DOM for Mozilla and IE and see if they have a keyword that is similar that you could use, otherwise you will need a script to detect the browser type and modify url strings appropriately.

HTH
MCM

lordcatalien
02-07-2006, 11:48 PM
This seems pretty helpful, but I haven't gotten it to work in IE yet.
http://www.mustardlab.com/developer/flash/jscommunication/

lordcatalien
02-08-2006, 10:29 PM
Placing this script in the head works perfectly in IE and Mozilla on a PC...but safari keeps saying it's undefined:

<SCRIPT LANGUAGE=JavaScript>
<!--
function doPassVar(args){
var sendText = args;
window.document.myFlash.SetVariable("myVar", sendText);
if (top != undefined) {
if (top.nav != undefined) {
if (top.nav.document != undefined) {
if (top.nav.document.myFlash != undefined) {
alert('Found page and variable is: '+sendText);
top.nav.document.myFlash.SetVariable("myVar", sendText);
top.nav.document.myform.myfield.value = sendText;
}
}
}
}
}
-->
</SCRIPT>


Anyone have any solution to the 'setVariable' method for Safari (other than the MustardLab solution)?

mcmcom
02-09-2006, 07:58 PM
does your OBJECT Tag contain BOTH parameters for IE AND Safari?

a proper Object Tag has a PARAM with the SRC keyword and a tag like this:

<embed name="myFlash" src="./flash/myFlash.swf?POPUP_ENABLED=true">

the EMBED Works for MAC/Opera/Safari/Mozilla and the PARAM name ="SRC" is for Internet Exploerer, maybe you only got the IE One in your object tag?

HTH,
MCM

lordcatalien
02-21-2006, 10:39 PM
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
width=900 height=325 id="sendmovie">
<param name="movie" value="assets/nav.swf">
<param name=quality value=high>
<embed src="assets/nav.swf" quality=high width=900 height=325 type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" name="sendmovie" swLiveConnect="true">
</embed>
</object>

Am I missing something?