Groups | Blog | Home
all groups > flash actionscript > july 2007 >

flash actionscript : Pass URL Parameters from HTML to Flash Button


Patrick B
7/19/2007 4:50:38 PM
Hi Scot,

At first glance your embedding code looks correct. This may simply be a
scoping issue with the passURL variable. Try doing it like this instead:

var passURL:String = "home.htm";
press_btn.onRelease = function() {
var urlString:String = _root.passURL; getURL(urlString,"");
}

-OR-

var passURL:String = "home.htm";
press_btn.onRelease = function() {
var urlString:String = _level0.passURL; getURL(urlString,"");
}

If that doesn't work, you may want to prepend your flashvars with a
proper URL-encoded delimiter. Either:

<param name= "flashvars"

value="&passURL=http://www.scotsnyder.com/ivy/pdf/as_conference_call.pdf"/>

-OR-

<param name= "flashvars"

value="?passURL=http://www.scotsnyder.com/ivy/pdf/as_conference_call.pdf"/>


If all else fails, examine what's actually making it into the SWF. Use this:

for (var item in _level0) {
trace (item+' = '+_level0[item]);
}

This will require follow-up since it may be something else that's wrong
at this point.

Regards,
Patrick

[quoted text, click to view]
Scot Snyder
7/19/2007 8:45:05 PM
Pretty new to action script and I tried to do as suggested by Paul Whitham:
http://www.adobe.com/devnet/dreamweaver/articles/flash_buttons.html#

However, I can not get the swf file to load a variable to open the PDF file -
here is the code I'm using.

HTML: page name "home.htm"

"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0
,28,0" width="210" height="164">
<param name="movie" value="flash/asset_strategy.swf">
<param name="quality" value="high">
<param name= "flashvars"
value="passURL=http://www.scotsnyder.com/ivy/pdf/as_conference_call.pdf"/>
<embed src="flash/asset_strategy.swf" quality="high"
pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Versio
n=ShockwaveFlash" type="application/x-shockwave-flash" width="210" height="164"
flashvars="passURL=http://www.scotsnyder.com/ivy/pdf/as_conference_call.pdf"></e
mbed>

Action Script:
var passURL:String = "home.htm";
press_btn.onRelease = function() {
var urlString:String = passURL; getURL(urlString,"");
}
AddThis Social Bookmark Button