Listing 1
function getNextFrameLabel ( newState ) {
// new state is where you want to go
switch ( newState ) {
case "shutdown":
// current state is where you (the animation)
// are at currently
switch ( currentState ) {
case "opened":
return "close to shutdown";
case "closed":
return "shutdown";
case "shutdown":
return null;
}
case "opened":
// current state is where you (the animation)
// are at currently
switch ( currentState ) {
case "opened":
return null;
case "closed":
return "closed to open";
case "shutdown":
return "startup";
}
}
}
function getState(){
return this.state;
}
Listing 2
function setState(newState){
// get your next frame label to go to
var fl = getNextFrameLabel(newState);
// show the animation
this.gotoAndPlay(newState);
// create a small engine to see if your at your end state
yet
// so you can populate the components that will appear
// presumably when the transition animation is done
var process_mc = this.createEmptyMovieClip("process_mc",
999);
// your constant names match the framelabels’ name
process_mc.targetFrame = this[fl];
process_mc.fl = fl;
process_mc.onEnterFrame = function(){
if(this._parent._currentframe == this.targetFrame){
// all callback letting you know you can set the data now
this._parent.onReachedTarget(fl);
// thanks, preciate your help movie clip, now die!!!
this.removeMovieClip();
}
};
}
function onReachedTarget (frameLabelThatIsDone){
trace("Done playing: " + frameLabelThatI// function
that populates your componnets
this.setData();
}