dcsimg
A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: question about draggable objects

  1. #1
    Junior Member
    Join Date
    Jan 2001
    Posts
    23

    question about draggable objects

    Greetings!

    I'm building a map application that shows two views of the same map: a "tile" section of the entire map (normal scale) and, off to the side, a thumbnail version of the entire map with a "mini-tile" representing the rectangular section the user is currently viewing.

    The normal scale map is draggable inside the borders of the tile view, and when user drags it the little square automatically moves on the thumbnail to indicate tile placement. That part's working.

    What I'd like to do is enable the other direction of drag -- i.e., I'd like to allow user *also* to be able to manipulate (drag) the mini-tile in the thumbnail and see the normal scale map move accordingly. Problem is, I can't seem to figure out how to make two objects (the normal-scale map and the mini-tile) mutually draggable.

    Can anyone please help?

    Many thanks!

  2. #2
    Senior Member
    Join Date
    May 2001
    Posts
    247
    It sounds to me (if I understand you correctly) that you actually wouldn't get the results you want by mutual dragging. The reason I say that is, if you drag the mini tile on the thumb-map, let's say 20 pixels, and you have two objects set to drag together, the large map will only move 20 pixels as well. You need them to work together proportionately.

    I would recommend that you 1)figure the proportions of the small map to the large (for instance 3:1) 2) track the ._x and ._y of the mouse from mousedown to release on the small map 3) Move the large map in accordance with your ratio (on 3:1, if you move the small map 12 pixels, move the large map 36 pixels.

    Hope that made sense and wasn't completely missing your point.

    Dain
    "Barney Rubble swings both ways."

  3. #3
    Junior Member
    Join Date
    Jan 2001
    Posts
    23
    Dain, you're correct about the relative size factoring. I've actually already managed to work that out in the first direction (dragging big map in tile window proportionately moves mini-tile on thumbnail).

    My question is really about how to make it so that the user can either drag the big map (and mini-tile will auto update) or the mini-tile (and big map will auto update), on his or her whim.

    I've tried to do this, but it will only allow one way or the other. I think I'm missing something obvious, but I'm out of ideas.

    Thanks for your attention to my little challenge....

    -M

  4. #4
    Lord of the Singhs
    Join Date
    Mar 2002
    Location
    India
    Posts
    342
    can u post ur fla?
    CooL "N" CalM

    my body is sore
    my eyes are red
    i still itch for more
    before i hit the bed

  5. #5
    Junior Member
    Join Date
    Jan 2001
    Posts
    23
    Sure -- thanks for any help you can offer here. The file's too big to post here, so please point your browser to:

    http://www.recumbo.com/etc/map_drag_question.fla.

    P.S. I've added a few notes in layer 1 for clarification.

    I do appreciate this!

    Cheers,
    Maggie

  6. #6
    Lord of the Singhs
    Join Date
    Mar 2002
    Location
    India
    Posts
    342
    404
    CooL "N" CalM

    my body is sore
    my eyes are red
    i still itch for more
    before i hit the bed

  7. #7
    Junior Member
    Join Date
    Jan 2001
    Posts
    23
    Ahh, formatting. The browser picked up the period at the end of the URL. Try again with this one:

    http://www.recumbo.com/etc/map_drag_question.fla

  8. #8
    Lord of the Singhs
    Join Date
    Mar 2002
    Location
    India
    Posts
    342
    ok here u go... it's not exactly the same thing .... but it works... u drag one mc the other one moves and vice versa... still working on making the mc move when i drag the zoom area
    CooL "N" CalM

    my body is sore
    my eyes are red
    i still itch for more
    before i hit the bed

  9. #9
    Lord of the Singhs
    Join Date
    Mar 2002
    Location
    India
    Posts
    342
    forgot to attach the fla
    Attached Files Attached Files
    CooL "N" CalM

    my body is sore
    my eyes are red
    i still itch for more
    before i hit the bed

  10. #10
    Lord of the Singhs
    Join Date
    Mar 2002
    Location
    India
    Posts
    342
    ok... this one works perfectly


    regs
    Attached Files Attached Files
    CooL "N" CalM

    my body is sore
    my eyes are red
    i still itch for more
    before i hit the bed

  11. #11
    Junior Member
    Join Date
    Jan 2001
    Posts
    23
    Perfect indeed -- that's *exactly* the ticket!!! Thanks so much to you, my friend!

  12. #12
    Lord of the Singhs
    Join Date
    Mar 2002
    Location
    India
    Posts
    342
    u r welcome
    CooL "N" CalM

    my body is sore
    my eyes are red
    i still itch for more
    before i hit the bed

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