A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Click and drag?

  1. #1
    Member
    Join Date
    Aug 2005
    Location
    Canada, Ontario.
    Posts
    42

    Click and drag?

    Im wondering is it possible to create a object that you can click and drag?
    All i can find is tutorials with flash mx. If you can find me a tutorial
    thanks.
    There are 10 types of people in this world.
    People who understand binary, and those
    who dont.

    ---------------------------------------------
    Give a noob a fish, feed him for a day.
    Teach a noob to fish, he starves to death.

  2. #2
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    Just look up the startDrag specifiction. It's not very difficult.
    Assuming you have a movieclip on stage named mc1, add the following code to the frame
    Code:
    mc1.onPress = function(){ 
     this.startDrag(false,0,0,Stage.width,Stage.height);
    }
    
    mc1.onRelease = mc1.onReleaseOutside = function(){
     this.stopDrag();
    }
    or if you add the code to the movieclip itself, use
    Code:
    onClipEvent(press){ 
     this.startDrag(false,0,0,Stage.width,Stage.height);
    }
    
    onClipEvent(releaseOutside){
     this.stopDrag();
    }
    
    onClipEvent(release){
     this.stopDrag();
    }

  3. #3
    Member
    Join Date
    Aug 2005
    Location
    Canada, Ontario.
    Posts
    42

    Thanks

    Thanks brants it worked. New to this stuff.
    There are 10 types of people in this world.
    People who understand binary, and those
    who dont.

    ---------------------------------------------
    Give a noob a fish, feed him for a day.
    Teach a noob to fish, he starves to death.

  4. #4
    Always needs help marinebro0306's Avatar
    Join Date
    Jul 2005
    Location
    Philadelphia
    Posts
    166
    Also, you don't really need the 0,0 stuff. All you need is
    code:
    on(Press){
    startDrag()};
    on(Release){
    stopDrag()};


    Copy and paste that inside the MC.

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