PDA

View Full Version : Boxes and more boxes



esnetni
January 14th, 2006, 12:59 AM
Here is my entry:tie:


_root.createEmptyMovieClip("square", 0);
square.beginFill(0x0), square.moveTo(10, 10), square.lineTo(10, 10), square.lineTo(10, 20), square.lineTo(20, 20), square.lineTo(20, 10), square.endFill();
square._x=Stage.width/2, square._y=Stage.height/2;
square.onRollOver = function() {
genParts(this);
};
function genParts(ob) {
ob.useHandCursor = false;
var cl:Color = new Color(ob), clr = "0x"+random(999999);
cl.setRGB(clr);
for (var i:Number = 0; i<random(5);i++){ ob.duplicateMovieClip("s"+i, _root.getNextHighestDepth(), {_alpha:random(75)+25, _rotation:random(359), spd:random(10)+20, _x:ob._x+random(10), _y:ob._y+random(10), onEnterFrame:function () {
this.spd<=1 ? delete this.onEnterFrame : null, this._x += Math.sin(this._rotation*(Math.PI/180))*(this.spd *= .8), this._y -= Math.cos(this._rotation*(Math.PI/180))*this.spd;
}, onRollOver:function () {
genParts(this);
}});
}
}

NiñoScript
January 14th, 2006, 01:28 AM
looks pretty :)

here's the same code, but counting the lines, so judges can judge faster and easier

_root.createEmptyMovieClip("square", 0);
//1
square.beginFill(0x0);
//2
square.moveTo(10, 10);
//3
square.lineTo(10, 10);
//4
square.lineTo(10, 20);
//5
square.lineTo(20, 20);
//6
square.lineTo(20, 10);
//7
square.endFill();
//8
square._x = Stage.width/2;
//9
square._y = Stage.height/2;
//10
square.onRollOver = function() {
genParts(this);
//11
};
function genParts(ob) {
ob.useHandCursor = false;
//12
var cl:Color = new Color(ob);
//13
clr = "0x"+random(999999);
//14
cl.setRGB(clr);
//15
for (var i:Number = 0; i<random(5); i++) {
//16
ob.duplicateMovieClip("s"+i, _root.getNextHighestDepth(), {_alpha:random(75)+25, _rotation:random(359), spd:random(10)+20, _x:ob._x+random(10), _y:ob._y+random(10), onEnterFrame:function () {
//17
this.spd<=1 ? delete this.onEnterFrame : null;
//18
this._x += Math.sin(this._rotation*(Math.PI/180))*(this.spd *= .8);
//19
this._y -= Math.cos(this._rotation*(Math.PI/180))*this.spd;
//20
}, onRollOver:function () {
genParts(this);
//21
}});
}
}

kirupa
January 14th, 2006, 01:30 AM
You don't have to number it :P Just pasting into Flash works the same way, for it displays the line number anyway.

forq - that's a neat effect :)

esnetni
January 14th, 2006, 01:40 AM
:cross-eye
(|)
/ \