A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Dragging objects in Flash

  1. #1
    Junior Member
    Join Date
    Jul 2001
    Posts
    12
    Hello,

    I am new to Flash and new to this forum (hence I'm in the newbie section basically I'm learning the basics of flash, and I'm doing decent enough to figure things out, but could someone help me on how to drag objects around in a scene? For example, I'm working on this one scene where there is a poster in a room, and the "player" of this Flash game can click the poster, and drag it to reveal something hidden behind it. My question is, how do I set an action for something to be moved or dragged in a scene? If anyone has any insite on this, or if I'm explaining this poorly, Please let me know. Any help would be greatly appreciated. Thank you in advance.


  2. #2
    Senior Member
    Join Date
    Jul 2001
    Posts
    180
    Hello, PsychoMonkey
    Your problem is pretty easy to solve - just use startdrag(parameters) action to start dragging and stopdrag() to stop. Isn't it easy?
    But before that You should convert your "poster" firstly into button and then into mc (button inside mc) as button is used to handle on(click) events and only movie clips can be dragged. Don't forget to give a name to an instance of mc and use target button to point it in startdrag action...
    If you need more help, you're always welcomed, I'll try to answer all I can.
    petich

  3. #3
    Junior Member
    Join Date
    Jul 2001
    Posts
    12
    thank you very much, I will go and give this a shot. I really appreciate the help

  4. #4
    Senior Member
    Join Date
    Jul 2001
    Posts
    180
    You're always welcomed, pH

  5. #5
    Junior Member
    Join Date
    Jul 2001
    Posts
    12

    still a problem

    ok, I got it to drag ok, however, when I drag the object, EVERYTHING that is on the screen at that time moves too, and I have no actions set for them. How do I get the object alone to move?

  6. #6
    Senior Member
    Join Date
    Jul 2001
    Posts
    180

    Re: still a problem

    You wanted your objects to move together - they do haha.
    I asked you to paste in one button (do you remember?) ONLY
    that objects you wanted to move and in the MC ONLY the button you did like this?
    If yes goto your actionscript code - you had to type path in the StartDrag action try to use "this" (without quotes) instead of this target-path.
    If nothing helps send me the file I'll help.
    Always and foreva ready to help you, pH

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