Sprite

extern class flash.display.Spriteextends DisplayObjectContainerAvailable in flashSprite is a MovieClip without a timeline var buttonMode : BoolIf set to true, the Sprite behaves like a button (hand cursor/click events)
Example
var rect:Sprite = new Sprite();
rect.graphics.beginFill(0xFF3333);
rect.graphics.drawRect(50, 100);
rect.buttonMode = true;
rect.addEventListener(MouseEvent.CLICK, onClickHandler);

function onClickHandler(event:MouseEvent):void {
    trace ("Yeah baby!!! that sweet :P ");
}

flash.Lib.current.addChild(rect);
var dropTarget(default,null) : DisplayObject var graphics(default,null) : GraphicsThe graphics of a Sprite where you can create vector shapes in.
Example
var rect:Sprite = new Sprite();
rect.graphics.beginFill(0xFF3333);
rect.graphics.drawRect(50, 100);
flash.Lib.current.addChild(rect);
var hitArea : Sprite var soundTransform : SoundTransform var useHandCursor : BoolUse this if you want to use the hand cursor when you roll over a Sprite.
Example
target.useHandCursor = true;
function new() : VoidCreates a new Sprite.
var target:Sprite = new Sprite();
flash.Lib.current.addChild(target);
function startDrag( ?lockCenter : Bool, ?bounds : Rectangle ) : VoidSet this if you want to drag a Sprite around. Use in combination with stopDrag otherwise the Sprite will stay sticked to your mouse.
You can drag the Sprite on it's center-point or lock to the point where it was clicked first. You can use a Rectangle to restrict the movement of the draggable Sprite
Example
var circle:Sprite = new Sprite();
circle.graphics.beginFill(0xFF3333);
circle.graphics.drawCircle(0, 0, 40);

flash.Lib.current.addChild(circle);

circle.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler) 
circle.addEventListener(MouseEvent.MOUSE_UP, mouseReleasedHandler);

function mouseDownHandler(event:MouseEvent):void {
    circle.startDrag();
}
function mouseReleasedHandler(event:MouseEvent):void {
    circle.stopDrag();
} 
function startTouchDrag( touchPointID : Int, ?lockCenter : Bool, ?bounds : Rectangle ) : Void function stopDrag() : VoidStops the dragging of a Sprite.
Example
var circle:Sprite = new Sprite();
circle.graphics.beginFill(0xFF3333);
circle.graphics.drawCircle(0, 0, 40);

flash.Lib.current.addChild(circle);

circle.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler) 
circle.addEventListener(MouseEvent.MOUSE_UP, mouseReleasedHandler);

function mouseDownHandler(event:MouseEvent):void {
    circle.startDrag();
}
function mouseReleasedHandler(event:MouseEvent):void {
    circle.stopDrag();
} 
function stopTouchDrag( touchPointID : Int ) : Void
version #12815, modified 2012-04-12 22:24:22 by api
0 comment