6 Replies Latest reply on Mar 29, 2013 3:18 PM by kglad

    Need help modifying a symbol in Actionscript

    TobinShields

      Hey guys, I think this might be my 2nd or 3rd actual post on here, so be kind to the newbie! I took a class in high school on how to use flash, but am picking it up now again a few years later! My mother is a teacher, and she kept telling me that she had some kind of review game (like jepordy) for the book 'The Hunger Games', so as a surprise I am going to make on for her in flash!. I had a question though, and I am not sure how I would go about asking it in 'actionscript' terms, so I will ask in plain english and see if I could get help translating it... hahaha

       

      My goal:

      I have a menu that displays 5 boxes with the numbers 100 - 500 ont hem (think jeprody). When the user clicks on a box, they are taken to the corrisponding question, and then the answer. However, when the user comes back to that main screen, I would like the question they just selected to be about 75-50% transparent, indicating a sort of 'vistied' look to it, so they don't just go through the same question again. If I couldn't get a transparent look, I would even be okay with swapping out the symbol with another one (basically a transprent duplicate of the first one).

       

      Right now, I am just making an icon in illustraor, importinting into flash, and then uisng the "on (release) gotoAndPlay(keyframe);" to nagivigate through my different frames. When I was looking online to find a soultion, everyone was trying to do something WAY more complicated then I needed, and so maybe it's just something really simple.

       

      Please let me know if I can give you guys any more info! Thanks so much!

       

      -Tobin

        • 1. Re: Need help modifying a symbol in Actionscript
          kglad Adobe Community Professional & MVP

          each of your icons/questions should be a movieclip (not button) and in your onRelease, use:

           

          this._alpha=50;

          clickedA.push(this);

           

          where clickedA is an array that is initialized only once when your game starts:

           

          var alreadyExecuted:Boolean;

          if(!alreadyExecuted){

          var clickedA:Array=[];

          } else {

          for(var i:Number=0;i<clickedA.length;i++){

          clickedA[i]._alpha=50;

          }

          }

          • 2. Re: Need help modifying a symbol in Actionscript
            TobinShields Level 1

            Thanks for the quick answer! I am still struggling with it, but I think I am on the right track! All of my 'buttons' are actually images that I imported from AI and converted them all into movie clips so I could put actionscript one them.

             

            As of right now, here is what I have, on my first frame in my actions layer I have:

             

            stop();

             

             

            var alreadyExecuted:Boolean;

            if(!alreadyExecuted){

            var clickedA:Array=[];

            } else {

            for(var i:Number=0;i<clickedA.length;i++){

            clickedA[i]._alpha=50;

            }

            }

             

             

            Then, on my actual movie clip I have the following (I am using a rollover/rollout effect on the buttons as well--that is working fine):

             

            on (release) {

                 this._parent.gotoAndStop(1);

                 this._alpha=50;

                 clickedA.push(this);

            }

            on (rollOver) {

                 gotoAndPlay(2);

             

             

            }

            on (rollOut) {

                 gotoAndPlay(10);

            }

             

             

            But nothing is happening? Did I put things in the wrong order/place?

            • 3. Re: Need help modifying a symbol in Actionscript
              TobinShields Level 1

              One more question: should I be putting this script on the clip that's on my main stage? Or should I double click into the sybmol and place it on it within there? If that makes sense?

              • 4. Re: Need help modifying a symbol in Actionscript
                kglad Adobe Community Professional & MVP

                use:

                 

                 

                 

                stop();

                 

                 

                var alreadyExecuted:Boolean;

                if(!alreadyExecuted){

                var clickedA:Array=[];

                } else {

                for(var i:Number=0;i<clickedA.length;i++){

                clickedA[i]._alpha=50;

                }

                }

                 

                 

                Then, on my actual movie clip I have the following (I am using a rollover/rollout effect on the buttons as well--that is working fine):

                 

                on (release) {

                     this._parent.gotoAndStop(1);

                     this._alpha=50;

                     _parent.clickedA.push(this);

                }

                on (rollOver) {

                     gotoAndPlay(2);

                 

                 

                }

                on (rollOut) {

                     gotoAndPlay(10);

                }

                 

                 

                 

                and it would be best if you attached no code to movieclips/buttons and used:

                 

                yourbutton.onRelease=function(){

                 

                }

                yourbutton.onRollOver=function(){

                this.gotoAndPlay(2);

                }

                etc

                1 person found this helpful
                • 5. Re: Need help modifying a symbol in Actionscript
                  TobinShields Level 1

                  Thanks for that fast responce! So, you are telling me that:

                   

                  yourbutton.onRelease=function(){

                   

                  }

                  yourbutton.onRollOver=function(){

                  this.gotoAndPlay(2);

                  }

                  etc

                   

                   

                  Shouldn't go onto my movie clip? Where woudl it go then, just on the keyframe itself? Oh, and where is says "yourbutton" that is the instance name of the clip right? Thanks so much for helping such a new guy out!

                  • 6. Re: Need help modifying a symbol in Actionscript
                    kglad Adobe Community Professional & MVP

                    correct, that code would be attached to a timeline frame (the same one that contains your movieclip buttons).

                     

                    and correct, "yourbutton" would be replaced by the instance name (listed in the properties panel after clicking your movieclip button to select it) of your movieclip button.

                    1 person found this helpful