0

I have very little Flash knowledge. I been looking around with no success in how to create a dynamic link on a SWF file.

I need to pass specifics parameters/values to a link on an image inside the SWF file. I already have this code that calls for the supposed file but I can't modify that code, I only control the SWF file.

<object>
  <param name="movie" value="http://mysite.com/?param1=value1&param2=value2"></param>
  <embed src="http://mysite.com/?param1=value1&param2=value2" type="application/x-shockwave-flash"></embed>
</object>

Im stuck in how to pass specifics params/variables to the static link inside the SWF file like http://differenturl.com/?param1=value1&param2=value2 passed like the sample of the object.

This is my current code in AS3 to create the static link

//1.Button event listener
button3.addEventListener(MouseEvent.CLICK, openurl);

//2.The openurl function which opens a URL.
function openurl(event:MouseEvent):void {
var url:URLRequest = new URLRequest("http://www.differenturl.com");
navigateToURL(url, "_blank");
}
4

1 に答える 1

3

これをやりたいということですか?

// Pull param1 and param2 from the HTML embed code.
var info:Object = root.loaderInfo.parameters;
var param1:String = info.param1;
var param2:String = info.param2;

// Your navigateToURL() will look like this:
var url:URLRequest = new URLRequest("http://www.differenturl.com/?param1=" + param1 + "&param2=" + param2);
navigateToURL(url, "_blank");
于 2012-07-18T07:11:59.037 に答える