First off I am really new to the whole actionscript 3 arena and am having a lot of trouble getting things to work. And I have a deadline of today to have this finished…gulp!!!
here is the scenario…I have a picture on the stage that has multiple items that have hotspots/links over them that should open a child swf on top of the background and show details about the items. I found this code in someone’s post and I am trying to modify it so that works for multiple buttons …it currently works for a button loading a single swf. The name of the instance name of the buttons is the same as the name of the swf file that they load so I thought I could do something that when the button is clicked it would pass the name of the button into the URLRequest but I can’t figure it out. Here is the code I am using.
////////////////////////////////// code from the actions layer
var bioloader:Loader;
var biocontainer:MovieClip;
one.addEventListener(MouseEvent.CLICK, biowindow);
two.addEventListener(MouseEvent.CLICK, biowindow);
three.addEventListener(MouseEvent.CLICK, biowindow);
four.addEventListener(MouseEvent.CLICK, biowindow);
function biowindow(e:MouseEvent): void {
// I am guessing I should be adding something here like eventname.biowindow + ".swf"
var biorequest:URLRequest = new URLRequest("one.swf");
bioloader = new Loader();
bioloader.load(biorequest);
biocontainer = new MovieClip();
//RS: add to the timeline, not the stage
this.addChild(biocontainer);
biocontainer.addChild(bioloader);
// positions bioloader on stage
biocontainer.x = 0;
biocontainer.y = 0;
trace(biocontainer.stage);
trace(biocontainer.root);
}
var receiver:LocalConnection = new LocalConnection();
receiver.connect(“lcClient”);
receiver.client = this;
function closeBio(): void {
trace("lc called successfully");
biocontainer.removeChild(bioloader);
}