3 Replies Latest reply on Mar 4, 2011 9:41 AM by somascope

    equalizer animation

    esbekken

      Can anybody help me with an equalizer animation

        • 1. Re: equalizer animation
          somascope Level 3

          Are you wanting this in AS2 or AS3? And do you want people to actually create this for you and hand you the code, or are you loooking for guidance as to "what goes into this, to help get me started", otherwise, I'd suggest you search online for the relevant phrase, like "flash as3 equalizer animation". There is likely a modest amount of programming here... And, finding an example via your searching (or going through the steps of a tutorial) will help your AS3 programming skills.

          • 2. Re: equalizer animation
            esbekken Level 1

            I have found a code for it in AC2

             

            onClipEvent(enterFrame){

                  _yscale = Math.random()*300 + 10;

            }

             

            That i wonder if there is one for AC3

            • 3. Re: equalizer animation
              somascope Level 3

              You are correct, this is code that is valid only for ActionScript 2 (AS2), and doesn't work in AS3.

               

              However, this is a small little code snippet that only does one thing: Set the Y scale of an object (such as one of the graphic EQ's bars) to a random number (in this example's case, between 10 - 310, depending how you would round the numbers).

               

              The AS3 equivalent, in a simple example, is:

               

              addEventListener(Event.ENTER_FRAME, randomSize);

              function randomSize(e:Event):void{

                  // Assigns a random value to the scaleY property

                  // The range is from ~ 0.1 to 1

                  // 0 = 0% of orig height, 1 = 100% of orig height

                  someBarClip.scaleY = (Math.random()*90 + 10) / 100;

              }

               

               

              Of course, this isn't immediately usable for anything other than a single objectl it's only a sample of what you could use and apply to multiple objects

               

              So another question I'd have for you us, do you want a real-time "related to the sound that's playing" type of EQ? That is one thing (which I don't believe was achievable in AS2). Or, do you want the bars of your EQ to just randomly jump around, sort of "faking" it, just to give the neat-looking illusion of an EQ? The two approaches are different, and do require different programming.

               

              To see a real-time sound EQ in AS3 that somebody did:

              http://www.everyday3d.com/blog/index.php/2008/03/26/classic-sound-equalizer-in-flashas3/