7 Replies Latest reply on Jul 7, 2006 6:45 PM by Rothrock

    Here I go again

      I asked previously about this subject about controlling MCs from the main timeline via AS. However, the code I use does not work correctly and will not advance the movie along the way I intend it . Two crabs are tossing a disc back and forth. These nested clips need to trigger each other in succession in order for the movie to work right-crab calls disc which calls other crab, ect. A helpful user sent me this function code to allow me to use frame labels as targets for the movie clips, since _currentframe can only identify frame numbers:


      MovieClip.prototype.isAtLabel = function(label){
      var iniFrame = this._currentframe;
      this.gotoAndStop(label);
      var returnVal = (this._currentframe == iniFrame);
      this.gotoAndPlay(iniFrame);
      return returnVal;
      };

      I then modified the following code accompanying this with MC namesL

      this.onEnterFrame = function(){
      if (Ceab1.isAtLabel("down")){ discPath.play(); }
      if (discPath.isAtLabel("out")){ Crab2.play(); }
      if (Crab2.isAtLabel("caught")){ discPath.play("back"); }
      };

      The resulting movie does not play through. The disc will stop in the first fram of its own time line, or not play at all. the crab 2 movie does not play either. I have Stop actions on these movie clips to control their playback, but i don't see them executing properly either. The one time I was able to get the disc beyond its first frame it went to the other extreme of looping endlessly. I have instance named all these clips, by the way.

      I would greatly appreciate any suggestions to figure out why these clips are misbehaving.
        • 1. Re: Here I go again
          kglad Adobe Community Professional & MVP
          the play() method does not accept a parameter and your third conditional (if resolved to true) contains one. that should be discPath.gotoAndPlay("back").
          1 person found this helpful
          • 2. Re: Here I go again
            Thanks for replying. Changing the play() method is fine. However, the movie never reaches it anyway. The problem is that the disc generally never even moves.

            The big picture is that the AS commands are not working from the root timeline, even though they should.
            • 3. Re: Here I go again
              kglad Adobe Community Professional & MVP
              the disc "not moving" has nothing to do with the code you showed. if you need help with some other part of your coding, you should post that part of your code.
              1 person found this helpful
              • 4. Re: Here I go again
                Thanks for replying again.

                The disc MC's code consists of a Stop() action in two frame locations. It runs on amotion ath.

                The individual MC's (crabs and disc) work fine. They worked when I wrote actions inside of them. They DON'T work when I wirte the actions outside of them.

                I cannot believe the difficulty I am having not only finding and answer to this problem, but getting somene to understand what i am talking about. Unlike a lot of people who post to these forums the minute something does not work, I have spent hours and hours reading postings and Flash technical manuals before coming here. I also reealize that it is likely user error The results from my investigation so far has been far from satisfying and extremely frustrating

                I am looking for explanation, not lectures.
                • 5. Re: Here I go again
                  kglad Adobe Community Professional & MVP
                  then you most likely have a path reference problem
                  • 6. Re: Here I go again
                    duh.
                    • 7. Re: Here I go again
                      Rothrock Level 5
                      Put your code back on the inside of the clips. Problem solved.

                      And you won't have to ask for help anymore.

                      Nobody here has to get your project done or working. Everybody here is a volunteer and you are really being a jerk to one of the most helpful, knowledgeable, and giving members of this community.
                      1 person found this helpful