import hype.extended.color.ColorPool;
import hype.extended.layout.ShapeLayout;
import hype.framework.core.ObjectPool;
import hype.framework.interactive.HotKey;
MyShape.visible = false;
var color:ColorPool = new ColorPool(
0x587b7C, 0x719b9E, 0x9FC1BE, 0xE0D9BB, 0xDACB94, 0xCABA88, 0xDABD55, 0xC49F32, 0xA97409
);
var pool:ObjectPool = new ObjectPool(MyCircle, 500);
var layout:ShapeLayout = new ShapeLayout(MyShape);
function colorClip(clip) {
color.colorChildren(clip);
}
function layoutClip(clip) {
layout.applyLayout(clip);
}
function colorAll() {
pool.activeSet.forEach(colorClip);
}
function layoutAll() {
pool.activeSet.forEach(layoutClip);
}
pool.onRequestObject = function(clip) {
clip.scaleX = clip.scaleY = (Math.random() * 0.75) + 0.25;
colorClip(clip);
layoutClip(clip);
addChild(clip);
}
pool.requestAll();
var hk:HotKey = new HotKey(stage);
// Map to the ‘C’ Key
hk.addHotKey(colorAll, ‘c’);
// Map to the ‘L’ Key
hk.addHotKey(layoutAll, ‘l’);