5 Replies Latest reply on Sep 22, 2009 9:46 AM by tkennedy4817

    Creating Virtual Tour With Buttons

    tkennedy4817

      I am fairly new to Flash and I am wanting to create a virtual tour through a house.  I DON'T want the panoramic views; I want to be able to have the buttons walk the user forward through the house and look side to side.  I have successfully made the left, right, and forward buttons look side to side and move forward for one sequence, but once I add multiple "If" scripts for the forward button it messes everything up.  Furthermore, when I want the forward button to go back to its screen when on the left screen it doesn't want to seem to work.

       

      All this is to say how do I get a button to do different "if" functions from frame to frame.  It seems like it would be simple but I am having a lot of problems.  Any help would be GREATLY appreciated. 

        • 1. Re: Creating Virtual Tour With Buttons
          Ned Murphy Adobe Community Professional & MVP

          You'll need to show the code that isn't working.  Even if it isn't working it might shed some light on what you might be trying to accomplish with it.

          • 2. Re: Creating Virtual Tour With Buttons
            tkennedy4817 Level 1

            The code string I am currently working with looks like this:

            stop();

             

            up_btn.onRelease = function() {

            if (_root._currentframe == 4) {

            gotoAndStop (7)

            }

            else {

            gotoAndStop (4);

            }

            }

             

             

            left_btn.onRelease = function() {

            if (_root._currentframe == 1) {

            gotoAndStop (2);

            }

            if (_root._currentframe == 4) {

            gotoAndStop (5)

            }

            if(_root._currentframe == 7) {

            gotoAndStop (8)

            }

            };

             

            right_btn.onRelease = function() {

            if(_root._currentframe == 1) {

            gotoAndStop (3);

            }

            if(_root._currentframe == 4) {

            gotoAndStop (6);

            }

            if(_root._currentframe == 7) {

            gotoAndStop (9);

            }

            }

             

            I have a total of nine slides; they are grouped together 123, 456, 789, so that 1, 4, and 7 are "forward" shots while 2, 5, and 8 are "left" and 3, 6, and 9 are "right."  What is weird to me is that the left and right buttons work no matter which frame I am on, but when I add any other "if" statements for the "up" button I don't get any response.  Any ideas?

            • 3. Re: Creating Virtual Tour With Buttons
              Ned Murphy Adobe Community Professional & MVP

              If you plan to maintain the frame design approach as is, you can reduce the code for the left and right buttons....

               

              stop();

               

              up_btn.onRelease = function() {

                   if (_root._currentframe == 4) {

                        gotoAndStop (7)

                   } else {

                        gotoAndStop (4);

                   }

              }

               

               

              left_btn.onRelease = function() {

                   gotoAndStop (_root._currentframe + 1);

              }

               

               

              right_btn.onRelease = function() {

                   gotoAndStop (_root._currentframe + 2);

              }

               

              As for the up_btn, there's nothing qrong with that code, so what other 'if' stratements are you trying to add that causes it to fail?

               

              The wondering I have is what happens if you aren't on frames 1,4, or 7, which will be the case after clicking any of those buttons?  None of the buttons will get you anywhere once you click the right or left button.

              • 4. Re: Creating Virtual Tour With Buttons
                tkennedy4817 Level 1

                That is my main problem.  I wanted the up button to go back to it's original screen when it was on the left or right image, for example if you are looking straight ahead and you look left, when you push "up" it goes back to the screen you were first on, giving it a 90 degree angle from both sides, much like old videogames like Doom.  When I added the addition "if" statements for the up button, such as:

                 

                up_btn.onRelease = function() {
                     if (_root._currentframe == 2) {
                          gotoAndStop (1)
                     }

                 

                it seems to mess up the entire button.  It will only do the first command in the structure.  All of it has been VERY frustrating and I don't know how to structure it so that it will go to the desired frame but also go back to the frame I want when looking left or right.  Thanks for all the help, any ideas about this?

                • 5. Re: Creating Virtual Tour With Buttons
                  tkennedy4817 Level 1

                  Any ideas on how to get the "up" button to work the way I want??