PDA

View Full Version : Passing a Variable via URL to swf to HTML


bmaniero
07-08-2005, 05:24 AM
This is the scenario.
Let's say that I have an icon that links to my site. That icon will be
placed on site1, site2, and site3. Depending on which site you clicked
on the icon to come to my site, I want to display a diffrent header on
my site. So, if you clicked on my icon while browsing site2, I want my
site to display graphic2.jpg, for example. Does it make sense so
far?
so my link would look something like this: http://www.barbaramaniero.com?siteName=site1

The problem is that between my index page I am running the Flash Detection code downloaded from Macromedia

So, now the path of the variable is from the originating site through the URL (http://www.barbaramaniero.com?siteName=site1 ) to the flash detection page to, finally, either the Flash index.html or the non-flash index.html.
In both the Flash detection HTML and SWF I am supposed to include the redirect URLs.
So, how do I append the value of the siteName variable to those URLs without hardcoding it - otherwise it wouldn't make any sense? Basically how do I get Flash to register the siteName variable and pass it on to the two index pages?

So this is what the HTML of the Flash Detection looks like:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,0,0" width="80" height="80">
<param name="movie" value="flash_detection.swf?flashContentURL=flash/index.htm&altContentURL=noflash/index.htm&contentVersion=7&contentMajorRevision=0&contentMinorRevision=19&allowFlashAutoInstall=false">
<param name="quality" value="low">
<embed src="flash_detection.swf?flashContentURL=flash/index.htm&altContentURL=noflash/index.htm&contentVersion=7&contentMajorRevision=0&contentMinorRevision=19&allowFlashAutoInstall=false" quality="low" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="80" height="80">
</embed>
</object>

The 'noflash/index.htm' and 'flash/index.htm' are the two redirects depending on whether you have Flash or not. I need to append 'siteName=site1' to each of those URLs within the above code and to the same URLs that are included in the Flash Detection swf.
Below is an example of what the AS in the swf looks like:
//the url that the visitor should be sent to if they do not have the required version of Flash.
altContentURL = "testPages/index.htm";
//-------------------
//the url that the visitor should be sent to if they have the required version of Flash.
flashContentURL = "testPages/index.htm";

So I will need to append the variable and its value to the URL in the swf as well.

FYI, I am using Javascript to pass the variable within the HTML pages and that part is all good.

I hope this is not too confusing and I really hope somebody can help because I just don't know what to do anymore.
Thank you.

bmaniero
07-08-2005, 05:27 AM
This is the scenario.
Let's say that I have an icon that links to my site. That icon will be
placed on site1, site2, and site3. Depending on which site you clicked
on the icon to come to my site, I want to display a diffrent header on
my site. So, if you clicked on my icon while browsing site2, I want my
site to display graphic2.jpg, for example. Does it make sense so
far?
so my link would look something like this: http://www.barbaramaniero.com?siteName=site1

The problem is that between my index page I am running the Flash Detection code downloaded from Macromedia

So, now the path of the variable is from the originating site through the URL (http://www.barbaramaniero.com?siteName=site1 ) to the flash detection page to, finally, either the Flash index.html or the non-flash index.html.
In both the Flash detection HTML and SWF I am supposed to include the redirect URLs.
So, how do I append the value of the siteName variable to those URLs without hardcoding it - otherwise it wouldn't make any sense? Basically how do I get Flash to register the siteName variable and pass it on to the two index pages?

So this is what the HTML of the Flash Detection looks like:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,0,0" width="80" height="80">
<param name="movie" value="flash_detection.swf?flashContentURL=flash/index.htm&altContentURL=noflash/index.htm&contentVersion=7&contentMajorRevision=0&contentMinorRevision=19&allowFlashAutoInstall=false">
<param name="quality" value="low">
<embed src="flash_detection.swf?flashContentURL=flash/index.htm&altContentURL=noflash/index.htm&contentVersion=7&contentMajorRevision=0&contentMinorRevision=19&allowFlashAutoInstall=false" quality="low" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="80" height="80">
</embed>
</object>

The 'noflash/index.htm' and 'flash/index.htm' are the two redirects depending on whether you have Flash or not. I need to append 'siteName=site1' to each of those URLs within the above code and to the same URLs that are included in the Flash Detection swf.
Below is an example of what the AS in the swf looks like:
//the url that the visitor should be sent to if they do not have the required version of Flash.
altContentURL = "testPages/index.htm";
//-------------------
//the url that the visitor should be sent to if they have the required version of Flash.
flashContentURL = "testPages/index.htm";

So I will need to append the variable and its value to the URL in the swf as well.

FYI, I am using Javascript to pass the variable within the HTML pages and that part is all good.

I hope this is not too confusing and I really hope somebody can help because I just don't know what to do anymore.
Thank you.

acolyte
07-19-2005, 07:24 PM
Hello bmaniero ,

i found something might fix your prob

http://www.noscope.com/journal/2004/04/named_anchors

thnx mat