dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: startDrag problem in sprite

  1. #1
    Member
    Join Date
    Apr 2004
    Posts
    85

    startDrag problem in sprite

    Hi buddies,
    I made a bitmap object in a sprite but the startdrage method didn't run.
    Do you have any suggestion?
    These are my codes:
    ------
    package {
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.geom.Matrix;
    import flash.display.Shape;
    import flash.display.GradientType;
    import flash.geom.Rectangle;
    public class test1 extends Sprite
    {
    private var bitmap:Bitmap;
    private var bitmapData:BitmapData;
    private var sprite:Sprite;
    private var sprite2:Sprite;
    public function test1()
    {
    sprite=new Sprite();
    sprite.graphics.beginGradientFill(GradientType.RAD IAL,["0xff0000","0x00ff00","0x0000ff"],[100,100,100],[0,63,127])
    sprite.graphics.drawCircle(0,0,60)
    sprite.graphics.endFill()
    sprite.y=200;
    sprite.x=100;
    bitmapData=new BitmapData(200,200,true,0xffffff);
    bitmap=new Bitmap(bitmapData);
    bitmapData.draw(sprite,new Matrix(),null,null,null,true);
    sprite.addChild(bitmap);
    addChild(sprite);
    sprite.addEventListener(MouseEvent.MOUSE_UP,onClic k);
    sprite.addEventListener(MouseEvent.MOUSE_UP,onRele ase);

    }
    private function onClick(event:MouseEvent):void{
    trace("Mouse Down")
    event.currentTarget.startDrag()

    }
    private function onRelease(event:MouseEvent):void{
    trace("Mouse Up")
    event.currentTarget.stopDrag();
    }

    }
    }

  2. #2
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,361
    You're only using MOUSE_UP

  3. #3
    Member
    Join Date
    Apr 2004
    Posts
    85
    Oh thx

    What hell mistake i did
    Last edited by bigmantana; 11-12-2006 at 11:38 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center