flash on 2010-10-5
/**
* Copyright m0ose ( http://wonderfl.net/user/m0ose )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/eIHx
*/
package
{
import com.bit101.components.*;
import flash.display.Sprite;
import flash.events.*;
[SWF(backgroundColor=0xeeeeee, width=600, height=400)]
public class FlashTest extends Sprite
{
private var _new:PushButton;
private var button1:PushButton;
private var button2:PushButton;
private var panel_:Panel;
public var menuVisible:Boolean = true;
public function FlashTest()
{
var sh:Sprite = new Sprite()
sh.graphics.beginFill(0xff00ff, 0.4);
sh.graphics.drawRect(0,0, stage.stageWidth, stage.stageHeight);
sh.graphics.endFill();
//stage.addChild( sh);
_new = new PushButton(this, 0, 10, "new polygon");
button1 = new PushButton(this, 0, 30, "PushButton");
button2 = new PushButton(this, 0, 0, "hide/unHide",hider);
panel_ = new Panel(this, 0,20)
panel_.alpha = 1.0;
panel_.shadow = false;
panel_.addChild( button1);
//panel_.addChild( button2);
panel_.addChild(_new);
panel_.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
panel_.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
stage.addEventListener(Event.MOUSE_LEAVE, mouseLeaveHandler);
}
private function mouseDownHandler(e:MouseEvent):void {
panel_.startDrag();
}
private function mouseUpHandler(e:MouseEvent):void {
panel_.stopDrag();
}
private function mouseLeaveHandler(e:Event):void {
mouseUpHandler(null);
}
public function hider(e:MouseEvent ):void
{
if( panel_.visible)
panel_.visible = false;
else
panel_.visible = true;
}
}
}