Vudrok
06-10-2008, 02:49 PM
Hi, okay I got an issue with my imported SWF files, i got a project were i'm using multiple swf files being managed by a main swf file that import into itself the other swf files, my problem is that I cannot control the imported swf files, i can't figure out how to target them and control them, the thing is that i got an intro animation for each swf, and while loading these animation will start playing and when my loading method finished loading it will addChild the swf and it will not display the starting animation cause this animation played already while loading, i'll add the code of my method and comment out what would i like to do on it, i hope someone can help me.
var someLoaded:Boolean = false;
function swfLoader(whichSWF:String, addTo:MovieClip):void {
if(someLoaded) {
//trace("the current MovieClip is: "+swfLoadit.name)
//trace("the loader has been unloaded");
addTo.removeChildAt(1);
//trace("the current MovieClip is: "+swfLoadit.name);
//trace("the child has been remove");
someLoaded = false;
}
var swfSource:URLRequest = new URLRequest(whichSWF);
var swfLoadit:Loader = new Loader();
swfLoadit.load(swfSource);
swfLoadit.contentLoaderInfo.addEventListener(Progr essEvent.PROGRESS, onProgress);
swfLoadit.contentLoaderInfo.addEventListener(Event .COMPLETE, onComplete);
function onProgress(e:ProgressEvent):void {
var prebytesTotal:Number = e.bytesTotal;
var prebytesLoaded:Number = e.bytesLoaded;
var percent:Number = Math.round((prebytesLoaded/prebytesTotal)*100);
loader_mc.visible = true;
loader_mc.percent.text = percent + "%";
//imported SWF.stop(); this is what i want to do... but how??
}
function onComplete(event:Event):void {
loader_mc.visible = false;
swfLoadit.contentLoaderInfo.removeEventListener(Pr ogressEvent.PROGRESS, onProgress);
swfLoadit.contentLoaderInfo.removeEventListener(Ev ent.COMPLETE, onComplete);
addTo.addChild(swfLoadit);
//imported SWF.play(); this is what i want to do... but how??
someLoaded = true;
}
}
Please all help will be highly appreciate it!! xD
var someLoaded:Boolean = false;
function swfLoader(whichSWF:String, addTo:MovieClip):void {
if(someLoaded) {
//trace("the current MovieClip is: "+swfLoadit.name)
//trace("the loader has been unloaded");
addTo.removeChildAt(1);
//trace("the current MovieClip is: "+swfLoadit.name);
//trace("the child has been remove");
someLoaded = false;
}
var swfSource:URLRequest = new URLRequest(whichSWF);
var swfLoadit:Loader = new Loader();
swfLoadit.load(swfSource);
swfLoadit.contentLoaderInfo.addEventListener(Progr essEvent.PROGRESS, onProgress);
swfLoadit.contentLoaderInfo.addEventListener(Event .COMPLETE, onComplete);
function onProgress(e:ProgressEvent):void {
var prebytesTotal:Number = e.bytesTotal;
var prebytesLoaded:Number = e.bytesLoaded;
var percent:Number = Math.round((prebytesLoaded/prebytesTotal)*100);
loader_mc.visible = true;
loader_mc.percent.text = percent + "%";
//imported SWF.stop(); this is what i want to do... but how??
}
function onComplete(event:Event):void {
loader_mc.visible = false;
swfLoadit.contentLoaderInfo.removeEventListener(Pr ogressEvent.PROGRESS, onProgress);
swfLoadit.contentLoaderInfo.removeEventListener(Ev ent.COMPLETE, onComplete);
addTo.addChild(swfLoadit);
//imported SWF.play(); this is what i want to do... but how??
someLoaded = true;
}
}
Please all help will be highly appreciate it!! xD