samedi 30 mai 2015

Go to specific frame after external swf has been loaded AS3

I have been looking for solutions around here but I can't seem to get it right. Basically I am trying to load an external swf after clicking on a 'Next' button and it will automatically go to a specific frame eg. frame 8 instead of frame 1.

At first I've got an error of using of using MovieClip function in a Loader and such. Here's my code

nextBtn.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_1);

var fl_Loader1:Loader;
var fl_ToLoad1:Boolean = true;

function fl_ClickToLoadUnloadSWF_1(event:MouseEvent):void
{
if(fl_ToLoad1)
{
    fl_Loader1 = new Loader();
    fl_Loader1.load(new URLRequest("projectnowd.swf"));
    addChild(fl_Loader1);
    var fl_Loader1:MovieClip = event.target.content as MovieClip;
    fl_Loader1.gotoAndStop(8);

}
else
{
    fl_Loader1.unload();
    removeChild(fl_Loader1);
    fl_Loader1 = null;
    }
    fl_ToLoad1 = !fl_ToLoad1;
}

Aucun commentaire:

Enregistrer un commentaire