2 Replies Latest reply on Jun 30, 2006 11:34 AM by

    Root timeline control of sequence nesteed clips with frame events

      I have been trying to improve my AS skills by learning to write AS in the main timeline rather than on the clips themselves. However, I cannot seem to get the clips to communicate with each other.

      The movie is two crabs tossing a disc back and forth. Originally I wrote to the clips themselves, but I would like to be able to make the code centralized and reusable for other versions that might have 3 or more crabs tossing the disc around.

      The sequence of the movie is:
      1. Crab 1 pinches the disc
      2. frame event in Crab 1 calls the disc to move (motion path) towards crab 2
      3. as disc approaches it triggers Crab 2 animation to "catch "disc, which stops at Crab 2
      4. Crabs 1 & 2 switch places and new Crab 1 triggers return of disc to starting point where Crab 2 now sits.

      Some of the code I tried follows this logic:
      if (pinch._currentframe ==5) {
      if (disc._currentframe==5){
      //when snatch reaches the end of its timeline it send root timeline to frame 2 where the crabs are in different positions.
      if (snatch._currentframe==10){
      this.gotoAnd Stop(2)}

      I have seen FLAs where Root actionscript controls nested clips, but not for clips with tweens and motion paths. Shouldn't these principles apply to all types of movie clips?

      Thanks for any feedback,
        • 1. Re: Root timeline control of sequence nesteed clips with frame events
          Jan-Paul K. Level 1
          I suggest you explain a little more detailed what your problem is.
          To answer you question: yes, they should apply to all types of movie clips.
          Via AS you can do almost everything you can do in the designtime (or even more). You can control all movies in the timeline no matter if they are nested in other movies or not. All you need to do is to give instance names to all these movieClips in order to address them via AS.
          1 person found this helpful
          • 2. Re: Root timeline control of sequence nesteed clips with frame events
            Thanks for your reply.

            What it comes down to is that I want to write all the script for all of the clips in the main timeline. I do understand the conventions of naming your instances, using frame labels, and target paths. I am new to writing functions and variables.

            For example When I generate the IF statements to make the crab 1 instance call up the disc to move to crab 2, I cannot see that the action is correctly taking place. The trigger frame in Crab 1 does not activate the disc instance. The best I have gotten is that the disc advanced 1 frame into its timeline and stops, or it loops through its timeline even though there are two STOP actions placed in it. Never mind the actions that are supposed to follow.

            I want these clips to work interdependent ly- Crab1 calls disc, disc calls Crab 2, ect- but to have the script for these commands Originate from the main movie timeline. I also want these individual clips to execute their own scripts correctly within their own timelines-Stop if they have a stop action in their own keyframe.

            I have gotten feedback from others and done hours of reading to solve what would seem to be a relatively simple problem.

            If more detail is required I would be happy to send my test FLA.