Code

The readme.txt file in the download ZIP (linked to at the left) provides full instructions on installing and using the code.  Example document classes are provided.  Below is the operative code from a simple frequency spectrum bar so that you get the idea.

Assuming that you import the WoodPecker package as detailed in the ZIP file.

public function Beautiful() {

 mySound = new Sound();
 mySound.load(new URLRequest("beautiful.mp3"));
 myChannel = mySound.play();
 myChannel.addEventListener(Event.SOUND_COMPLETE, replay); 

// set up the parameters to pass to the WoodPecker Object
// clip is a MovieClip with its linkage in the library set to Bar
// num is how many clips you want to show
// size is their maximum animation size
// type is an array specifying animation of width, height, alpha
// drag lets people drag the clips

 var clip:Class = Bar;
 var num:Number = 40;
 var size:Number = 100;
 var type:Array = [false, true, false];
 var frequency:Boolean = true;
 var drag:Boolean = false;

 myBars = new WoodPecker(clip, type, num, size, frequency, drag);
 addChild(myBars);

}

There are more methods available to customize the beats including  setting different types of clips

// here is a method to set multiple settings and properties
// for instance, the clips are set to C1, C2, etc.
myWoodPecker.setBeatObject({
 clip:[C1,C2,C3,C4,C5,C6,C7,C8],
 x:[0,20,40,60,80,100,120,140],
 y:[0,0,0,0,0,0,0,0],
 alpha:[1,1,1,1,1,1,1,1],
 color:[,,,,,,,],
 blendMode:['difference','','','','','','',''],
 filters:[[new BlurFilter()],,,,,,,],
 beatSize:[90,90,90,90,90,90,90,90],
 startSize:[0,0,0,0,0,0,0,0]
});
// you can also set all the clip values for a property like so:
myWoodPecker.setAllBeats("y", 100);
// or set a value for a specific clip like so:
myWoodPecker.setBeat("y",2,300);
Advertisements

One Response

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: