# freeskier89→ 2. Interactive Tree

**URL:** <https://forum.kirupa.com/t/freeskier89-2-interactive-tree/176259>\
**Category:** Uncategorized\
**Created:** [January 22, 2006, 2:51am UTC](https://forum.kirupa.com/t/freeskier89-2-interactive-tree/176259 "2006-01-22T02:51:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![freeskier89](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@freeskier89](https://forum.kirupa.com/u/freeskier89)\
**Post date:** [January 22, 2006, 2:51am UTC](https://forum.kirupa.com/t/freeskier89-2-interactive-tree/176259/1 "2006-01-22T02:51:47Z")

</div>

Here is my second entry. It is 25 lines. Please let me know your thoughts!  
[AS]Stage.scaleMode = “noScale”;  
createEmptyMovieClip(“container”,16);  
colors=[0xE7EDEA,0xD5DFDB,0xC2D1CB];  
init = function (container,n) {  
container.createEmptyMovieClip(“tree”+n,n);  
};  
Tree=function(x,y,depth){  
this.dimensions = {l:40,w:10,d:depth};  
this.tree=container.createEmptyMovieClip(“tree”+depth, depth);  
this.stack = [{x:x,y:y,a:0}];  
this.Location={x:x,y:y};  
for (var i =0 ;i\<3;i++) init(this.tree,i+1);  
for (var n=0; n\<5; n++) {  
for (i=0; i\<Math.pow(2,n); i++) {  
var branch = this.stack.shift();  
var newposition = {y:branch.y-this.dimensions.l_Math.sin((branch.a+90)Math.PI/180),x:branch.x-this.dimensions.lMath.cos((branch.a+90)Math.PI/180)};  
for(var i2=0;i2\<3;i2++){  
this.tree[“tree”+(i2+1)].lineStyle(this.dimensions.w+(-i29+20), colors[i2], 100);  
this.tree[“tree”+(i2+1)].moveTo(branch.x, branch.y);  
this.tree[“tree”+(i2+1)].lineTo(newposition.x, newposition.y);  
var dup = this.tree[“tree”+(i2+1)].duplicateMovieClip(“reflection”+(i2+1),i2+4);  
dup.\_y+=17+this.Location.y_(4/3);  
dup.\_yscale=-30;  
dup.\_alpha=20;  
}  
this.stack.push({x:newposition.x,y:newposition.y,a:branch.a-(\_xmouse-this.Location.x)/2.5},{x:newposition.x,y:newposition.y,a:branch.a-(\_ymouse-y)/2.5});  
}  
this.dimensions.w -= 2;  
this.dimensions.l -= 6;  
}  
}  
onMouseMove = function () {  
new Tree(275,250,0)  
}[/AS]  
-freeskier89
