Hey all,
i have been searching for 2 days for a solution for this problem I am having. I would appreciate it if someone would tell me if its even doable so i wouldb e be wasting my time
I am trying to upload external swf files into an empty movie in flash via xml( the name of the swf files will be pulled and read from the xml file so we could easily update it). I want it to start loading any random swf file form the list and then within that be able to go through the other swf file( by clicking on a next button) .
the problem is that i need to remember what swf files it already displayed so it would repeat showing the same files.
i think i need to add an array but i am not sure how to work with that.
This is what i have so far in my action script:jailbreak
var pHeight:Number = 200;
var pWidth:Number = 200;
var listLoader:URLLoader = new URLLoader( new URLRequest(“filelist.xml”) );
var picLoader:Loader = new Loader();
listLoader.addEventListener(Event.COMPLETE, gotList);
var xmlData:XML;
var numImages:Number;
function gotList(evt:Event):void {
xmlData = XML(listLoader.data);
numImages = xmlData.pix.length();
var stImage:String = xmlData.pix[Math.floor(numImages*Math.random())].toString();
picLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, gotPic);
picLoader.load( new URLRequest(stImage) );
listLoader.removeEventListener(Event.COMPLETE, gotList);
}
var thisBmp:Bitmap;
function gotPic(evt:Event):void {
thisBmp = Bitmap(picLoader.content);
thisBmp.x = 0;
thisBmp.y = 0;
var thisWidth:Number = thisBmp.width;
var thisHeight:Number = thisBmp.height;
thisBmp.scaleX = pWidth/thisWidth;
thisBmp.scaleY = pHeight/thisHeight;
addChildAt(thisBmp,0);
picLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, gotPic);
btnAnother.visible = true;
}
btnAnother.addEventListener(MouseEvent.CLICK, anotherPic);
function anotherPic(mevt:MouseEvent):void {
btnAnother.visible = false;
removeChild(thisBmp);
picLoader = new Loader();
var stImage:String = xmlData.pix[Math.floor(numImages*Math.random())].toString();
picLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, gotPic);
picLoader.load( new URLRequest(stImage) );
}
Waiting to hear from someone