A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [MX] Drag And Drop!!!

  1. #1
    Flash Intermediate XenElement's Avatar
    Join Date
    Sep 2008
    Location
    At my computer
    Posts
    196

    Question [MX] Drag And Drop!!!

    Just a very basic question, shouldn't be too hard to answer, but I couldn't find it anywhere else. (Couldn't think of any keywords)

    I have a basic game board, with nine gray circles in it. there are also nine chocolates, and They can be dragged anywhere on the screen. But I need a script so that when a user drops the piece, it slides to the center of the intended spot.

    Ex:

    on(release) {
    stopdrag(this)
    this. hit test of circle?
    if yes, this._x and this._y = circle1._x and circle1._y

    I don't know, something like that. do I need an array? as the smiley says,

    CONFUSED
    In the process of designing a quirky little game engine called gulp. Check out it's progress below: @ my blog.

    ---

    Check out my blog at XenElement.com

  2. #2
    Member
    Join Date
    Nov 2005
    Posts
    32
    Try this:

    PHP Code:
    on(release) {
    stopDrag(this);
    if (
    _root.circle.hitTest(this._xthis._ytrue))
    {
    this._x _root.circle._x;
    this._y _root.circle._y;
    }

    Last edited by Eastwinn; 11-24-2008 at 11:31 PM. Reason: Mistake

  3. #3
    Flash Intermediate XenElement's Avatar
    Join Date
    Sep 2008
    Location
    At my computer
    Posts
    196
    The code seems like it would work, but for some reason, it doesn't see the circle. I exported for as with linkage, but it still dosent work.
    RRRGGGH!!
    In the process of designing a quirky little game engine called gulp. Check out it's progress below: @ my blog.

    ---

    Check out my blog at XenElement.com

  4. #4
    Member
    Join Date
    Nov 2005
    Posts
    32
    Did you set its instance name to "circle"? You only need to export a movie clip to AS if you plan to create it dynamically in the code.

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