Skip to main content
Participant
November 15, 2006
Question

Dynamic data from URL

  • November 15, 2006
  • 1 reply
  • 156 views
I have a Flash page that allows a user to dynamically select a graphic's mat colors frame type, and frame color. The graphic is to be loaded from our ZenCart shopping cart. I can call the Flash page from ZenCart and would like to just encode the graphic's ID at the end of the URL that calls the Flash page, like this: http://www.mypage.com?ZC=180. In this example I would parse my XML DB looking for graphic number 180, display it, and I'm done.

I'm confused (after looking at a gazillion Flash and ActionScript books and Googling every term I can think of). Should I be using loadVars, FlashVars, URLLoader or something else? Does anyone have any code snippets I can look at? I'm spending too much time researching this problem and not enough time solving it...the client's getting antsy.

Thanks!
This topic has been closed for replies.

1 reply

November 15, 2006
Gart, I am going through the same problem. I have a script which sends the FlashVars dynamically to the object and embed tag however once I get the FlashVars inside of Flash I am not able to access them.

<script src="js/swfobject.js" type="text/javascript"></script>
<div id="comm" style="margin:0px; padding:0px; text-align:left; width:500px; height:350px; background-color:#636363;">
<strong>You need to upgrade your Flash Player</strong>
<code>noscript</code>
</div>
<script type="text/javascript">
// <![CDATA[

var so = new SWFObject("pflipper.swf", "pflipper", "500", "600", "8.0.23", "#636363", true);
so.addVariable("myURL", getQueryParamValue("<cfoutput>#URL.myURL#</cfoutput>"));
so.write("comm");

// ]]>
</script>

Here is my AS.

if (_level0.myURL == undefined) {

}
else {
pflipper.gotoPage(3);
gotoAndStop(1);
}

This absolutely works. However, I am not sure how to test for certain variables in AS such as
If myURL == 4 do this
pflipper.gotoPage(3);
gotoAndStop(1);

I know that this should be in an if statement but everything I have tried like this does not work?