I'd like to load and onload mc's on the stage when certain buttons are pressed.
The catch is that whilst one of the mc's is playing I dont want any of the buttons to work -- in other words the user has to wait for the s开发者_开发问答hort anim to stop playing before they press another button to see another anim (or even the same anim again).
I'm OK with basics of AS2, but I want to do this in AS3.
Is attachMovie and removeMovieClip still the approp method to load/unload mc's from library in AS3. I'm also unsure how to check if mc is playing in AS3 (is there a property? or maybe set a global variable?).Any ideas??
you want something like:
myBtn.addEventListener(MouseEvent.CLICK,onMyBtnClick)
function onMyBtnClick(e:MouseEvent)
{
//TODO disable buttons
//export for actionscript setting in library
var myMovie:SomeMovieClipFromLibrary = new SomeMovieClipFromLibrary();
addChild(myMovie);
myMovie.addEventListener(Event.ENTER_FRAME,onMovieEnterFrame);
myMovie.play();
}
function onMovieEnterFrame(e:Event)
{
if(e.currentTarget.currentFrame ==e.currentTarget.totalFrames)
{
//TODO enable buttons
e.currentTarget.removeEventListener(Event.ENTER_FRAME,onMovieEnterFrame);
removeChild(e.currentTarget as DisplayObject);
}
}
精彩评论