flash on 2014-2-5
♥0 |
Line 35 |
Modified 2014-02-05 00:37:28 |
MIT License
archived:2017-03-20 06:16:14
ActionScript3 source code
/**
* Copyright xzardaz ( http://wonderfl.net/user/xzardaz )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/uRIF
*/
package {
import flash.display.MovieClip;
import caurina.transitions.Tweener;
import flash.display.Stage;
import flash.events.Event;
public class BaseMenu extends MovieClip
{
public var stageRef:Stage; //the stage
public var loadNext:BaseMenu; //instance of next Menu to load
public function BaseMenu()
{
alpha = 0;
y = 400;
}
public function unload(loadMe:BaseMenu = null) : void
{
if (loadMe != null)
loadNext = loadMe;
Tweener.addTween(this, { alpha: 0, y:-400, time: 0.7, onComplete:remove } );
}
public function remove() : void
{
dispatchEvent(new Event("menuRemoved"));
if (stageRef.contains(this))
stageRef.removeChild(this);
if (loadNext != null)
loadNext.load();
}
public function load() : void
{
stageRef.addChild(this);
Tweener.addTween(this, { alpha: 1, y:0, time: 0.7} );
}
}
}