29 July 2007

» Audio Spectrum Effect [FlashMX]

I'm not sure if this is the real name of what I'm going to talk about - sound bars, or audio bars - if you know it please leave a comment so I can change it.



Since everyone listens to music I suppose everyone has already seen this bars. I made it a year ago when I was finishing school and I was doing a web-site for a band and I needed something like this, but i didn't use it. Why? Because this isn't "real", it's just a "fake" animation.

I also found a component for Flash MX that was supposed to do this real animation, but guess what, it didn't worked...

So, if you're searching for an easy way to do this animation you'll find it below!

1 » You need to add 2 layers and call it "action" and "bars".

2 » Draw a vertical bar on your bars layer. Then select the 2nd frame of that layer and press F5. Now select your bar and press F8, choose "movie clip" and click OK. Your bar is now a movie clip! Then change the instance name to bar1.
(if you don't know where is that "instance name" box check this image from my latest tutorial)

3 » Go to your action layer and select the 1st frame, then press F9 and type the code below:
num1=random(120);
setProperty(_root.bar1, _yscale, num1);


The first line will generate a random number between 0 and 120 and host it on var num1.
(is also recommended to use the function Math.random(); instead of random(); but that didn't work as well on Flash MX, try it yourself!)
The second line will change the height of the object bar1 with the value hosted on var num1.

4 » Now select the 2nd frame of your action layer and press F6, then press F9 and type gotoAndPlay(1); to make a cycle between the 1st and 2nd frames.

(your timeline should look like this)

5 » You have finished your work in one bar, now you just have to copy your movie clip bar1 and create as many others as you wish, BUT, after that you must change their names because there can't be 2 bars with the same name (actually it can, but we don't want it). Select each bar separately and change its instance name to bar2, then bar3, bar4, bar5 and so on...

Then you have to create the function for each bar, select the 1st frame of action layer and copy/paste that 2 lines and replace the names bar1 with bar2 (or other number) and num1 to num2 (depending on which bar you're working).


And that's it, now you just have to save it and enjoy your "sound bars" effect!

Download link: http://www.sendspace.com/file/x1ezjn
(password: www.weknowyousuck.blogspot.com)

Labels: , , , , , , , , , , , ,


2 Comments:

Blogger Jesus said...

Iorai!

July 30, 2007 1:10 pm  
Blogger Anonymous Niggerson said...

I ai!
Sabes o nome do cenas ao menos? lol

July 30, 2007 6:46 pm  

Post a Comment

Subscribe to Post Comments [Atom]

go home!



my world visitor map