I try to make an app which connect amfphp with as3 animation. i recieve from amfphp an array which i sort by some variable in 'if' statement. after that i've got 2 arrays with arrays inside each other:
var Array1:Array = [["http://url.to.swf", "http://url.to.link"], ["",""]...];
var Array2:Array = [["http://url.to.swf", "http://url.to.link"], ... ];
after that i run a function that read that arrays and load every swf to the stage:
ladujBajkiGorne(Array1);
function ladujBajkiGorne(polkaGorna:Array):void {
for(var i=0; i<polkaGorna.length; i++) {
Aktual = polkaGorna[i];
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest(String(Aktual[0]));
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, myfunction = function(e:Event):void { onLoadGorna( e, String(Aktual[1]) ); } );
mLoader.load(mRequest);
}
}
then
function onLoadGorna(e, arg1):void {
userSwf = e.currentTarget.content;
userSwf.buttonMode = true;
userSwf.addEventListener(MouseEvent.CLICK, function(e:MouseEvent) { afterClick(e, arg1 ); });
booksMC.addChild(userSwf);
var childName:String = booksMC.getChildAt(childs).name;
booksMC.getChildByName(childName).x = posX;
booksMC.getChildByName(childName).y = 0;
posX += 218;
childs++;
}
and at the end
function afterClick(e, arg3) {
var url:URLRequest = new URLRequest(arg3);
navigateToURL(url, "_self");
}
the problem is that all swf that has been loaded has the same url in the link. it doesn't change in the ladujBajkiGorne function in addEventListener statement. I try many options to change that and nothing works. Any chance to help me with that? Many thanks in advance