| |||
Re: convertir forma a button desde as 3.0 lo que se debe hacer es meter tus dibujos a un sprite y darle los listeners a al sprite por ejemplo:
Código:
package { import flash.display.Sprite; public class MouseEventExample extends Sprite { private var size:uint = 100; private var bgColor:uint = 0xFFCC00; public function MouseEventExample() { var child:ChildSprite = new ChildSprite(); addChild(child); } } } //------------------------------------------------------------ //------------------------------------------------------------ import flash.display.Sprite; import flash.events.MouseEvent; class ChildSprite extends Sprite { private var size:uint = 50; private var overSize:uint = 60; private var backgroundColor:uint = 0xFFCC00; private var overColor:uint = 0xCCFF00; private var downColor:uint = 0x00CCFF; public function ChildSprite() { draw(size, size, backgroundColor); addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } private function draw(w:uint, h:uint, bgColor:uint):void { graphics.clear(); graphics.beginFill(bgColor); graphics.drawRect(100, 200, w, h); graphics.endFill(); } private function mouseDownHandler(event:MouseEvent):void { trace("mouseDownHandler"); } } |