mardi 26 mai 2015

How to Load & Unload File SWF at same time

I'm an as3 newbie, i have one button as name tombol fuctioning to Loading External swf & going to Specific Frame by clicking buttons, this works fine.


tombol.addEventListener(MouseEvent.CLICK, tekan2);

function tekan2 (e:MouseEvent):void {

function loadSWF(swfURL){
    var myLoader:Loader = new Loader();
    var mySWF:URLRequest = new URLRequest(swfURL);
    myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
    myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);


function onCompleteHandler(loadEvent:Event){    

function onProgressHandler(myProgress:ProgressEvent){
    var percent:Number = Math.round(myProgress.bytesLoaded/myProgress.bytesTotal*100);
    trace(percent+"% loaded");

var swfFrame:Number=2;


This file save as 1.swf and loading file 2.swf go to frame 2, but file 1.swf still loading, so this script loading 2 file swfs(file 2.swf frame 2 loading with file 1.swf appears). How to file 1.swf can unloading same time when I click the button, so just file 2.swf frame appears on stage.

Aucun commentaire:

Enregistrer un commentaire