GORDON CLICK HERE

Monday, August 8, 2011

Step 12

And there you go, this is the final piece and it should look like this:














SO keep playing with values and changing the variables and see what different patterns and looks you can create.

Step 11

If there are any problems or warning messages you can just right click and click "go to source" and it will highlight it on the actions page












The warning page will tell you what's wrong, just make sure you type slow, check spelling, and look out for little mistakes like missing punctuation

Step 10

Once the code is all typed in and you have changed the values and colours of the butterflies to ones you like, test it out by hitting “shift + enter”. This is called exporting and it also creates a swf file. You can play around with the butterfly image, colours, alpha channels, and values to change it up and make it your own, just trial and error.


When playing with values you can always comment out certain text. Just copy and paste the line you want to change and use two forward slashes // to comment out one of the lines, that way you can keep the original text and if it doesn’t work you can always go back and try again













The grey shows the code is not commented out




Step 9


To change the alpha (opacity) of the butterflies: This will make some of the butterflies transparent depending on the value and rotation randomly selected by the variables you chose:


clip.alpha=(Math.random()*3);;


Step 8

To change the scale (size) of the butterflies as well as the rotation: This code will randomly select values between whatever values you select and will change the scale and rotation of them creating an interesting pattern:


clip.scaleX = clip.scaleY = (Math.random() * 0.75) + 0.25;


clip.rotation=(Math.random()*200)+5;

Step 7

To change the colour: Use the HTML colour names to change the colours to which ones you would like:


var color:ColorPool = new ColorPool(

0x33CCCC, 0x339999, 0x336666, 0x333399, 0x33FFCC, 0xFFCCFF, 0x33CC66, 0x99FFFF, 0x33FFFF




Step 6

I will provide you with the code. You can not just copy and paste the code though, you have to write it out yourself. Make sure the names match from whatever you called the movie clip to match the code.

Code:


import hype.extended.color.ColorPool;

import hype.extended.layout.ShapeLayout;

import hype.framework.core.ObjectPool;

import hype.framework.interactive.Adjuster;


MyShape.visible = false;


var pool:ObjectPool = new ObjectPool(MyCircle,500);

var layout:ShapeLayout = new ShapeLayout(MyShape);


var color:ColorPool = new ColorPool(

0x33CCCC, 0x339999, 0x336666, 0x333399, 0x33FFCC, 0xFFCCFF, 0x33CC66, 0x99FFFF, 0x33FFFF


pool.onRequestObject = function(clip) {

clip.scaleX = clip.scaleY = (Math.random() * 0.75) + 0.25;


clip.rotation=(Math.random()*200)+5;

clip.alpha=(Math.random()*3);;

layout.applyLayout(clip);

color.colorChildren(clip);

addChild(clip);

}


pool.requestAll();


var adjuster:Adjuster = new Adjuster();

addChild(adjuster);


pool.activeSet.forEach(adjuster.add);