2 Replies Latest reply on May 7, 2007 7:41 AM by draxzion

    Function getURL Not Calling Right in Movie

    draxzion
      I'm trying to get multiple buttons to work inside of a movie clip. I've created the functions on the main timeline. It's only wokring the first time through on the first button though.

      Here's a link to the site; http://www.aspenspasstl.com ;the problem banner is on the lower left.

      Here's a link to the fla file. http://www.apepinc.com/aspenspas/home_spa_info.fla

      Code that shouldn't be giving me a problem:

      mc_spas.canyon_button.onRelease = function() {
      getURL(" http://www.aspenspasstl.com/canyon.htm", "_self");
      };
      mc_spas.extreme_button.onRelease = function() {
      getURL(" http://www.aspenspasstl.com/extreme.htm", "_self");
      };
      mc_spas.monarch_button.onRelease = function() {
      getURL(" http://www.aspenspasstl.com/monarch.htm", "_self");
      };
      mc_spas.sopris_button.onRelease = function() {
      getURL(" http://www.aspenspasstl.com/sopris.htm", "_self");
      };

      Hope someone can help,

      David
        • 1. Re: Function getURL Not Calling Right in Movie
          dr_ross Level 1
          when you're applying the onRelease handlers to the buttons they don't actually exist yet as the frame with them on has not yet been passed by the play head.

          just put this code in to see for yourself after you apply the handlers.

          trace(mc_spas.canyon_button);
          trace(mc_spas.extreme_button);
          trace(mc_spas.monarch_button);
          trace(mc_spas.sopris_button);

          what you need to do is either have to code directly on the button itself which is a bit of a hack but by far the quickest.
          i.e

          on(release)
          {
          getURL("www.yahoo.com");
          }

          or have all the buttons on frame 1, and then if you really want all the code on the root have a onEnterFrame on the mc_spas to check the frame number and then set _visible property for each button when required.
          • 2. Re: Function getURL Not Calling Right in Movie
            draxzion Level 1
            Thanks dr_ross, I'm just using the hack right now.

            I'll look into the set_visible property and try to get it to work that way.

            I'm trying to learn how to keep all of the code on the first frame of the movie. Using the trace is probably good debugging practice.