1 Reply Latest reply on Apr 21, 2009 10:21 PM by roshankolar

    Really Really need Help with action script

      I really really need help. My class project is due today and I haven't been able to figure out how to make my project work right. I need it to do two things. If a fish is right it needs to play a movie in the fish movie clip. This I have working. if the answer is wrong I need it to play a different frame within the fish movie clip.

      Please see link for example. Like I said I really really need help and appreciate any help or advice.

      I have attached my main action script for you to see.
        • 1. Re: Really Really need Help with action script

          Hi Shariha,


              I'm unable to see any ling for downloading the source. Maybe problem with my browser. But lets get to the problem. Looks like you have a fish_mc MovieClip right?


          The movieclip should have two parts, one for the right answer and one for the wrong answer. Add




          1. to the beginning of the movieclip, where the right answer animation starts.

          2. to the last frame of the correct answer animation.

          3. and another one in the end of the wrong answer animation frame.


          Note : The last frame of the correct answer animation should be the same as the first frame, default frame the user always sees on the screen. And the end frame of the wrong answer animation should also be the same type.


          You should realize that the fiash_mc is a large strip of two animations. fine?


          Now in the code, when you detect that the answer is right, do


          fish_mc.gotoAndPlay(2); //which starts playing the correct answer animation


          Now this animation will stop wherever you have the next immediate stop();, and that is at the end of the correct answer animation.


          Same way, if the answer is wrong, do


          fish_mc.gotoAndPlay(12);//considering 11th frame is the correct answer's stop();.
                                 //so obviously we start from 12th so that the wrong answer anim would play.


          And after the wrong answer anim plays, we have the next immediate stop which is in the end of the fish_mc.


          This way the user will never know that we are playing a single movieclip, and what all goes into it.

          This is a common way we work with movieclips when dealing with quiz like apps and many tougher apps. Its simple and very easy.


          Hope I made the point clear? And if by any chance you donot have animations and just frames to show in the MC, then use


          gotoAndStop(at that frame!);