A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Draggable movieclip

  1. #1
    Member
    Join Date
    Mar 2009
    Posts
    40

    Draggable movieclip

    Hi...

    im trying to use this code..

    window1.dragBar.addEventListener(MouseEvent.MOUSE_ DOWN, DragWindow1);

    function DragWindow1 (event:MouseEvent):void {
    window1.startDrag(false, boundsRect);

    }

    window1.dragBar.addEventListener(MouseEvent.MOUSE_ UP, DropWindow1);
    window1.dragBar.addEventListener(MouseEvent.MOUSE_ OUT, DropWindow1);

    function DropWindow1 (event:MouseEvent):void {
    window1.stopDrag();
    }
    I have a movie clip called window1 and inside another movie clip called dragBar... Supposedly when the user clicks and drags the dragbar the whole movie clip follows... it doesnt work

    ANy idea?>

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Are you getting any error messages, and if so, what?

    Can you tell if DragWindow1 is getting called? Put in a trace to verify.

    What is boundsRect?

  3. #3
    Member
    Join Date
    Mar 2009
    Posts
    40
    Hi...thanks for your answer

    i am attaching the file so that you can see...

    That code is modified so the boundsRect was a mistake... originally it had boundaries on x and y...

    Here is the code .... i dont seem to get any errors from flash

    window1.dragBar.addEventListener(MouseEvent.MOUSE_ DOWN, DragWindow1);

    function DragWindow1 (event:MouseEvent):void {
    window1.startDrag;

    }

    window1.dragBar.addEventListener(MouseEvent.MOUSE_ UP, DropWindow1);
    window1.dragBar.addEventListener(MouseEvent.MOUSE_ OUT, DropWindow1);




    function DropWindow1 (event:MouseEvent):void {
    window1.stopDrag();
    }
    Attached Files Attached Files

  4. #4
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Can't open flas, so I don't know if that is your actual verbatim code. If it is, the problem is that you need to call the startDrag method, not just refer to it.

    Code:
    function DragWindow1 (event:MouseEvent):void {
      window1.startDrag();
    }
    window1.startDrag; is a statement that evaluates to a Function. And then does absolutely nothing with it. You need to actually call the function.

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