2009. február 17., kedd

Actionscript 3.0 - Fruit class

Fruit.as
--------

package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;

public class Fruit extends MovieClip
{
public var _hitTarget:MovieClip;
public var _startX:Number;
public var _startY:Number;

public function Fruit()
{
_startX = this.x;
_startY = this.y;
this.buttonMode = true;
this.addEventListener(MouseEvent.MOUSE_DOWN, dragIt);
this.addEventListener(MouseEvent.MOUSE_UP, dropIt);
}

private function dragIt(event:MouseEvent):void
{
this.startDrag();
}

private function dropIt(event:MouseEvent):void
{
this.stopDrag();
}
}
}

Nincsenek megjegyzések: