SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast urbanformula's Avatar
    Join Date
    Apr 2004
    Location
    Burlington, VT .. USA
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    URGENT!!Deadline soon

    trying to get this but with a time issue, thought i'd use good old trusty sitepoint.

    so here it is... I'm try to get the x y coord. of a dragable MC on drop state.. now i have this i'ts working good, and heres the kicker it's getting the x y based on the width and height of the hole movie which is 1100x 900, but im dropping the MC on another MC that is 400x400.... so i want to record the x y coord based on that smaller MC, is this possible???

    and thank you.

  2. #2
    SitePoint Evangelist ferrari_chris's Avatar
    Join Date
    Mar 2008
    Location
    NP, New Zealand
    Posts
    576
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm having trouble understanding.

    So, if you drop the MC onto the target clip at an offset of 10*10, you want the x and y to come back as 10, 10 rather than 153, 210 (or whatever they are relative to the stage)? Is that right?

  3. #3
    SitePoint Enthusiast urbanformula's Avatar
    Join Date
    Apr 2004
    Location
    Burlington, VT .. USA
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that is correct

  4. #4
    SitePoint Evangelist ferrari_chris's Avatar
    Join Date
    Mar 2008
    Location
    NP, New Zealand
    Posts
    576
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Get the x and y of the draggable clip and then subtract the x and y of the clip you dropped it on.

    [PSEUDO CODE]

    target._x = 100;
    target._y = 100;
    draggedClip._x = 125;
    draggedClip._y = 125;

    draggedClip._x - target._x = 25;
    draggedClip._y - target._y = 25;

    [/PSEUDO CODE]

    x and y of 25, 25.

    Is that what you're after?

  5. #5
    SitePoint Enthusiast urbanformula's Avatar
    Join Date
    Apr 2004
    Location
    Burlington, VT .. USA
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i need the dragged movieclips xy be defined on drop , when it's dropped on the target movie clip

    but do i need to define a target area first, other wise how does it know not to use the full movie x y...
    does that make sense at all??

  6. #6
    SitePoint Evangelist ferrari_chris's Avatar
    Join Date
    Mar 2008
    Location
    NP, New Zealand
    Posts
    576
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is how you check if the MC was dropped onto your target:


    Code Actionscript:
    if (eval(draggedMC._droptarget) == _root.targetMC) { 
       trace("x: " + (draggedMC._x - targetMC._x));
       trace("y: " + (draggedMC._y - targetMC._y));
    }

    So, when you run your stopDrag(), insert the code above to check if the MC was dropped on your target (replacing the instance names as appropriate obviously).


Bookmarks

Posting Permissions

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