Skip to main content
Participant
February 14, 2012
Question

How to get a link from an HTML page to specific SWF in Flash movie?

  • February 14, 2012
  • 1 reply
  • 935 views

Hello,

Sorry to post this simple question but this challenge landed in my lap and I know next to nothing about Flash or esp. AS3.

I need to know how to write the code that would allow a link from the html page to load a specific swf in the Flash movie. 

The flash movie currently has buttons that load the specific SWF into a loader.  The user needs to be able to essentially click through that button from the html/url link (not having to hit the flash movie THEN find and click the button.

The code in AS3 for the buttons is as follows:

//

Alpha_btn.addEventListener(MouseEvent.CLICK,Alpha1911);

function Alpha1911(e:MouseEvent): void {

    galleryLoader.source = "flash/1911Alpha.swf";

}

BarnesEff_btn.addEventListener(MouseEvent.CLICK,BarnesEff713);

function BarnesEff713(e:MouseEvent): void {

    galleryLoader.source = "flash/713BarnesEff.swf";

}

etc...

//

I hope this makes sense.

Thanks!

Bull

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
February 14, 2012

are all your buttons on frame 1 of your swf?

would it be as easy to pass the file name of the swf to load rather than the button name?

bull 44Author
Participant
February 14, 2012

Thanks for the reply kglad

Yes, all the buttons are on frame 1.

I have no idea if it would be as easy to pass the file name of the swf to load rather than the button name... sorry...

kglad
Community Expert
Community Expert
February 14, 2012

how does your html (with the links) determine which button to click/swf to load?

in either case, you can append a query string to the link's url that identifies the button name or swf to load, use a javascript function to return the url and/or parse the query string and the externalinterface class to access your javascript function and dispatch a click event from that button or load that swf.