I am trying to create an event listener to check that a function has completed before the next action is run. In simple terms I have a module that is opened and closed via two functions… module_open() and module_close().
Each function has tween elements that must complete before the next element is processed… i.e the next function, etc.
This is the code I have ( have attempted to create an event listener but I seem doing something wrong. I am not even sure that it is possible to create an event listener that checks for a function finishing before calling the next function.
function onAbout(event:Event):void {
module_close()
module_close.addEventListener(Event.COMPLETE, onClose_Complete);
function onClose_Complete():void{
logo_block.gotoAndPlay("about");
title_text.gotoAndStop("about");
if (empty_mc_main.numChildren >0) {
empty_mc_main.removeChildAt(0);
}
var myMovieClip:MovieClip = new about_page_mc();
empty_mc_main.addChild(myMovieClip);
living_btn.visible = false;
lifestyle_btn.visible = false;
elements_btn.visible = false;
colour_btn.visible = false;
}
}
I expect there is a standard way of doing this.
Any help much appreciated.
Thx