PDA

View Full Version : variable from html page or javascript?



natronp
October 22nd, 2004, 11:54 AM
Okay, I have a sliding, drop down menu sidebar thingy. The user clicks a button and my slick little eye candy flash movie has a secondary navigation list slide down while any buttons underneath slide down as well. Then when you click on another button it slides back up and the new button's secondary nav slides down. nuff said.

what I would like to have happen is that when a user clicks on a secondary nav button and a new html page loads, I would like it to appear that the secondary nav slider has stayed down on the newly loaded html page.

this means passing some kind of variable to my flash movie so that it can tell which page the user is on and react (go to a particular frame)

what's the easiest/best way to accomplish this? thanks in advance

DieterStruik
October 22nd, 2004, 12:12 PM
If you nav flash thingy has to reload with a clicked link and you got some serversided scripting access, you can pass variables to the so called 'FlashVars' parameter.

That means you have to process the page and write an extra parameter in the embed html part of your flash nav thingy. Like this:

<param name="Flashvars" value="&var1=value1&var2=value2&">

you also need an extra attribute in the <embed> tag like this:

<embed FlashVars="&var1=value1&var2=value2&" ...>

This is for the compatibility with mozilla since it's popularity is growing.
To the point, when you've done it like this the vars passed in the html should be available in your _root like _root.var1.

So good luck with it!!!!!!

gr. Dieter

natronp
October 22nd, 2004, 12:20 PM
okay, heard of it, never tried it... so if I'm using .asp I should be able to modify the embed tag there huh? (i'm not the one doing the .asp)

thanks for the info!

DieterStruik
October 26th, 2004, 08:55 AM
Success on the job!

Dieter Struik

croopi
January 5th, 2006, 03:29 PM
The following snippet is from an ASPX page (asp.net)
The red code takes a parameter passed in the URL and then sends the value ( in this case its numeric):

{link on first page}
.....
<a href="projects.aspx?intnum=1" target="_self">
.......

(the following is with flash UTF encoding since it is being brought from a text file into a SWF)
<a href%3D"projects.aspx?intnum%3D1" target%3D"_self">

I capture that value in a String (I do other things with it on the page...but this is just for the flash)

{second page - projects.aspx}
.......

Dim intnum As String = Context.Request.QueryString("intnum")

......

Then the server replaces <%= intnum %> with the value and sends it to the SWF.


<param name="FlashVars" value="&gchoice=<%= intnum %>" />
<param name="menu" value="false" />
<param name="quality" value="best" />
<param name="scale" value="noborder" />
<param name="wmode" value="opaque" />
<param name="bgcolor" value="#ffffff" />
<embed src="projviewer.swf" FlashVars="&gchoice=<%= intnum %>" menu="false" quality="best" scale="noborder" wmode="opaque" bgcolor="#ffffff" width="805" height="436" name="projviewer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

Hope this helps...
Please feel free to ask...Im not the greatest programmer...but get things working eventually.