3 Replies Latest reply on Jul 13, 2009 8:58 AM by Ned Murphy

    Interactive, rotating globe - button problems

    Pigeon7081

      I made an interactive rotating globe that shows all the continents (using CS3 and AS3). The globe rotates automatically. When the user mouses over the globe is stops rotating and they can use left/right arrows to rotate it manually to get to a continent. When the mouse rolls over a continent (Australia for instance) it changes color and should be clickable and go to a website but it's not working. It doesn't return any errors.

       

      The basic structure of it is this:

       

      One big continent map (basically a flat world map) with a motion tween applied to it so it looks like it's moving across the planet in the background. That's in "globe_mc" on the main timeline. Then I did the same thing in a different movie clip with the buttons (moving across the planet in sync with their respective continent), that's in "buttons_mc" on the main timeline.

       

      The button worked until I applied the mouse controls to "buttons_mc" in the main timeline AS (to make them stop moving with the continents with the mouse is over the planet). After I did that it stopped working (I'm just working with "test_btn" right now until it works).

       

      The code for the button, inside "buttons_mc" is the following:

       

      //test btn

      function testBtn(event:MouseEvent):void

           {

                navigateToURL(new URLRequest("http://www.pmirope.com"));

           }

      test_btn.addEventListener(MouseEvent.CLICK, testBtn;

      //end test btn

       

       

      This is the code I have on the main timeline to control the rotation based on the mouse position:

       

      addEventListener(Event.ENTER_FRAME, scroll_function);
      function scroll_function(event:Event):void

      //Both Nav Arrow's Y Position
      {
            if(root.mouseY>470 && root.mouseY<530)

      //Right Arrow's X Position
      {
            if (root.mouseX>50 && root.mouseX<75)
                  {
                       globe_mc.land_mc.gotoAndStop(globe_mc.land_mc.currentFrame-1);
                       buttons_mc.gotoAndStop(buttons_mc.currentFrame-1);
                  }
            else
                  {
                       globe_mc.land_mc.play();
                       buttons_mc.play();
                  }
       
      //Left Arrow's X Position
            if (root.mouseX>925 && root.mouseX<950)
                  {
                       globe_mc.land_mc.gotoAndStop(globe_mc.land_mc.currentFrame+1);
                       buttons_mc.gotoAndStop(buttons_mc.currentFrame+1);
                  }
            else
                  {
                       globe_mc.land_mc.play();
                       buttons_mc.play();
                  }
      }

      //Globe's Position
      {
            if(root.mouseY<950 && root.mouseY>50)
      {
            if(root.mouseX<950 && root.mouseX>50)
                  {
                       globe_mc.land_mc.stop();
                       buttons_mc.stop();
                  }
            else
                  {
                       globe_mc.land_mc.play();
                       buttons_mc.play();
                  }
      }
      }
      }

       

      I'm guessing that the button's code is being canceled out by the "position" code but I don't know how to fix it.

      Please help!!!

        • 1. Re: Interactive, rotating globe - button problems
          Ned Murphy Adobe Community Professional & MVP

          For the code you are showing I don't readily see how the text_btn code would be impacted by the position code because the position code doesn't impose mouse event listeners that might block test_btn from the mouse.  You said the map areas change color and should be clickable... did you mean they should change color or they do?  If they do change color, what code causes that to occur?  Are the color changing parts different than the button parts?

          1 person found this helpful
          • 2. Re: Interactive, rotating globe - button problems
            Pigeon7081 Level 1

            First, to answer your question, they do change color and it's done with the up, over and down states inside the button. So when you rollover the button it changes color and the mouse changes to the hand to show it's clickable but when it's clicked nothing happens.

             

            I did figure out a way to do it, but I'm not sure why it works. As I said before, I had the buttons_mc and the globe_mc on the main timeline. I put the buttons_mc inside two other MovieClips and then put the actual buttons on the stage - like this:

             

            Main Timeline

                 globe_mc

                 buttonsMain_mc

                      buttonsInside_mc

                           buttons_mc

                                US_btn

                                Canada_btn

                                Australia_btn

                               and so on....

             

            I tried putting buttons_mc inside only 1 MovieClip (buttonsMain_mc) but it still didn't work. I had to add buttonsInside_mc for it to work. Why is that?

             

            Thanks for the help!

            • 3. Re: Interactive, rotating globe - button problems
              Ned Murphy Adobe Community Professional & MVP

              You're welcome.  I still don't quite get the picture, so I can't explain why it works... when it comes to mixing mouse-able things, you gotta be cautious that one doesn't cancel/block another...  Be happy that you solved it because there's every chance that what you did is what needed to be done--think thru the differences and the reasoning may come.