17 Replies Latest reply on Sep 21, 2007 2:53 PM by kglad

    Dragging Issues

    greggyd
      Please, someone help!

      I have a project I'm working on that involves maps. I'm using Flash Pro 8.

      Ok, I have several maps of the Hawaiian Islands, one of all the islands and others of each individual island. What I've done is taken the map of all the islands, Overview, and made it a MC on Scene 1. Next I took the map of the big island, Hawaii, made it a MC on Scene 2 and continued on with the other island maps on their own scene. I've applied simple startDrag and stopDrag to each so all can be moved around. The Overview has invisible buttons on each island that will take you to the corresponding scene for that island when clicked.

      The Problem:
      When I or the client drags the Overview to the left to click on an island, the island map has followed the drag and is shifted to the left. No matter which direction I drag the Overview, the maps in the other Scenes drag with it. Is there a way to keep them from doing this? Is there a better way to lay this whole thing out?

      Thanks for your time.
        • 1. Re: Dragging Issues
          kglad Adobe Community Professional & MVP
          why are the maps in the other scenes moving, at all?
          • 2. Re: Dragging Issues
            greggyd Level 1
            The maps are huge, so I have to allow the user to click and drag them around. I want the user to move the maps around, but I don't want the other maps to move according to what the user does. Hope this makes sense.
            • 3. Re: Dragging Issues
              kglad Adobe Community Professional & MVP
              what you stated makes sense, but why are the individual island maps, in your scenes beyond the first, moving?
              • 4. Re: Dragging Issues
                greggyd Level 1
                Thats what I'm trying to figure out. I don't want them to move. It's almost like they are linked to the 'Overview' map.
                • 5. Re: Dragging Issues
                  kglad Adobe Community Professional & MVP
                  you must have some coding to cause that problem or the individual maps are child movieclips of the large map. it wouldn't happen by default.
                  • 6. Re: Dragging Issues
                    greggyd Level 1
                    Hmmm. I imported each map individually into the library and then made it a movie clip.

                    Update:
                    I changed the code to read

                    overviewMC.onPress = function() {
                    this.startDrag(false);
                    }
                    overviewMC.onRelease = function() {
                    this.stopDrag();
                    }

                    and that seemed to work. Now the other maps aren't moving. But now the invisible buttons that i made for each island aren't moving with the map. Is there a way to link the button to map so they will stay in place?

                    Thanks for you help, by the way.
                    • 7. Re: Dragging Issues
                      kglad Adobe Community Professional & MVP
                      you can either start a loop (like onMouseMove) when you start dragging overviewMC and update your button's _x and _y properties or you can change those buttons into movieclips, put them on overviewMC's timeline, give them instance names and
                      then use a mouseDown method to check for a hitTest between the mouse and one of your buttons.
                      • 8. Re: Dragging Issues
                        greggyd Level 1
                        When you say put the buttonMC on the same timeline as the OverviewMC, did you mean on the same layer as the map or double click the map then put it on a layer inside the map?

                        When it comes to action script I am a novice. If you can show some examples or know where I can find some example code to look it over that would be helpful.

                        Thanks again your help.
                        • 9. Re: Dragging Issues
                          kglad Adobe Community Professional & MVP
                          double click the map and put the button on the large map's timeline.

                          which method do you want to use?
                          • 10. Re: Dragging Issues
                            greggyd Level 1
                            I'd like to use your second option, making the buttons movieclips and placing them in the overview timeline. (Would doing it the other way be more simple?)

                            I've tried double clicking the overviewMC and placing the mc of the button on the map and ran it. The button doesn't show up and there is nothing to click. Originally I made invisible buttons that showed up when you rolled over it with the mouse. I guess that won't work now that it is 'inside' the overviewMC.
                            • 11. Re: Dragging Issues
                              kglad Adobe Community Professional & MVP
                              i don't think either way would be more simple.

                              if you use movieclip buttons on overview's timeline, give each movieclip button an instance name. let's say they're oahu, hawaii, lanai etc. you can then use, on your main timeline:

                              • 12. Re: Dragging Issues
                                greggyd Level 1
                                Ok, I double clicked the Overview map, placed a mc of the invisible button, backed out to the main timeline, added the code you provided and made my changes.

                                But when I test it, the button does not highlight when rolled over, and when you click on the island nothing happens. Any ideas?
                                • 13. Re: Dragging Issues
                                  kglad Adobe Community Professional & MVP
                                  you need to create rollover frames (and down frames, if wanted) and use mouse handlers to direct your movieclip to those frames.

                                  and your coding is faulty. and don't use scene information for navigation and don't use the goto functions. use frame labels and the goto methods:

                                  • 14. Re: Dragging Issues
                                    greggyd Level 1
                                    When I originally created the button, i created it with a rollover state and a hit state. Does that not translate over when you convert a button into a movie clip?

                                    • 15. Re: Dragging Issues
                                      kglad Adobe Community Professional & MVP
                                      correct. movieclip buttons do not have a default rollover, rollout, down behavior. those graphics must be created on the movieclip's timeline and the behaviors must be coded using mouse handlers.
                                      • 16. Re: Dragging Issues
                                        greggyd Level 1
                                        I have the different states created on the buttonMC timeline. How do you code the mouse handlers? Does the code go on the buttonMC or the overviewMC?
                                        • 17. Re: Dragging Issues
                                          kglad Adobe Community Professional & MVP
                                          the code can be placed anywhere as long as the path to the movieclip is correct: