PDA

View Full Version : the best Method for navigating html from flash & vice versa?


camoconnell.com
08-18-2007, 01:06 AM
hey all

ok, so basically i need to find out the best Method for navigating html from flash & vice versa.

HERES MY CURRENT STRATEGY...
flash;
the flash banner will be just the one swf, it will navigate through the html content with the getURL function

html
each html page has the flash swf embedded using swfobject, a unique 'loadstate' variable will be passed from the html to flash,
eg. for the homepage it'll be;
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("/swfs/header.swf", "sotester", "924", "350", "8", "#69be28");
so.addVariable("loadstate", "home");
so.write("flashcontent");
// ]]>
</script>

flash;
flash will receive this loadstate variable, then using switch/case it will gotoAndStop on the appropriate frame.
e.g

// check variable passed from html, then play approiate frame
switch (loadstate) {
case "Home" :
castMC.gotoAndPlay(1);
break;
case "Renewal" :
castMC.gotoAndPlay(2);
break;
case "Growth" :
castMC.gotoAndPlay(3);
break;
case "Harvest" :
castMC.gotoAndPlay(4);
break;
case "Use" :
castMC.gotoAndPlay(5);
break;
}



is there a better way of achieving the same result using swfobject to pass the variables to the .swf?

thanks

mooska
08-18-2007, 06:57 AM
Why do you want to refresh html every time ? You can do the same with some of the direct linking libraries like swfadress (http://www.asual.com/swfaddress/)

camoconnell.com
08-18-2007, 08:21 AM
Hi mooska, thanks for the reply

i did check that out, but thought it was a solution suited for deep linking inside of sites developed entirely with flash, can it be applied to flash/html hybrid sites too?

Cam

mooska
08-18-2007, 06:39 PM
Sorry, I havent noticed that you talk about html content also.
I dont think theres better solution.

CyanBlue
08-18-2007, 07:39 PM
I don't recall hearing any myself...

I guess thatyou'd have to come up with good solution to get it done...

camoconnell.com
08-19-2007, 05:54 AM
i'll post here
again if i hit the nail on the head with this one.

Cheers
Cam