A little confused. I'd like to be able to "draw something" and then have it be interactive: dragable, clickable, whatever. Here's the code I have, but I cannot drag the movie clip:
var a:MovieClip = new MovieClip();
var child:Shape = new Shape();
child.graphics.beginFill(0xFF0000);
child.graphics.drawRect(0, 0, 100, 100);
child.graphics.endFill();
a.addChild(child);
this.addChild(a);
a.x=100;
a.y=100;
a.addEventListener(MouseEvent.MOUSE_DOWN,keyPressHandler);
a.addEventListener(MouseEvent.MOUSE_DOWN,keyReleaseHandler);
function keyPressHandler(event:MouseEvent):void
{
a.startDrag();
}
function keyReleaseHandler(event:MouseEvent):void
{
a.stopDrag();
}
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment