2 Replies Latest reply on Jul 22, 2008 4:45 AM by tame_it

    Help me with some Target Practice!

    tame_it

      i have 4 layers in my main timeline. three of those layers represent the three reels of a slot machine. the fourth layer is just the body of the machine. so i am trying to tell the three other layers where to stop depending on the random numbers.

      tellTarget ("/leftreel")
      {
      gotoAndStop(reel1);
      }

      actionscript is giving the following error:
      Target not found: Target="/leftreel" Base="_level0"

      I would really appreciate any help on this.

      Thanks,
      S
        • 1. Re: Help me with some Target Practice!
          Rothrock Level 5
          There are so many things -- not exactly wrong -- but not good about this. First is that tellTarget has been depreciated and that unless you are publishing using Flash 4 you don't need to be using the style of notation that you are using. This style is so old that most people here don't know how to use it and won't be able to help you much. So it really is worth updating a bit.

          The next thing is that Flash doesn't have (never did, most likely never will) recognize layers. The layers are just a way for the artist/animator to organize and stack their artwork. When published to a swf the layers are used to determine the depth of each bit of artwork and then the layers are thrown away.

          What Flash does understand are MovieClips. So if you want to address something and tell it to go somewhere you need to have make it a MovieClip and make sure it has an instance name. You assign that using the properties panel. And remember that spelling and capitalization count!

          The next thing is to stop using TellTarget and the "/" notation. Assuming you have a movieclip isntance called leftReel on the stage you can tell it to go to a frame with code like this:

          leftReel.gotoAndStop(reel1);

          I'm assuming reel1 is a random number, right? Much easier to read and type if you ask me. This code would go in the actionscript panel on a frame where the movieClip existed.

          To make sure the code is on a frame make sure you don't have any of the artwork selected and select the frame. Bring up the actionscript window and it should say "Frame" at the top. If it doesn't then you've got something selected.
          • 2. Re: Help me with some Target Practice!
            tame_it Level 1

            thanks a ton for your thoughtful reply. it has been very very helpful.
            s