Hi guys
This is what my original post was:
http://www.actionscripts.org/forums/....php3?t=140294
Now that i have achieved in randomly rotating my menu items, i have to try and attach the current menu item on which my mouse rests to the mouse. This has a defined area, if the mouse moves out of that area the menu item goes back and to its original position. Also when the mouse is over the particular item the current item should have the highest depth on the stage.
here's my code for rotating the menu items:
ActionScript Code:
var numPoints:Number = 4;
var fl:Number = 300;
var vpX:Number = Stage.width/2;
var vpY:Number = Stage.height/2;
dx = 10;
dy = 10;
init();
function init() {
//attaching the movieclips
var point3:MovieClip = attachMovie("point3", "point3", this.getNextHighestDepth());
point3.x = Math.random()*200-100;
point3.y = Math.random()*200-100;
point3.z = Math.random()*200-100;
var point1:MovieClip = attachMovie("point1", "point1", this.getNextHighestDepth());
point1.x = Math.random()*200-100;
point1.y = Math.random()*200-100;
point1.z = Math.random()*200-100;
var point2:MovieClip = attachMovie("point2", "point2", this.getNextHighestDepth());
point2.x = Math.random()*200-100;
point2.y = Math.random()*200-100;
point2.z = Math.random()*200-100;
}
//rotation of the movieclips
function onEnterFrame():Void {
var angleY:Number = (_xmouse-vpX)*.001;
var cosY:Number = Math.cos(angleY);
var sinY:Number = Math.sin(angleY);
var angleX:Number = (_ymouse-vpY)*.001;
var cosX:Number = Math.cos(angleX);
var sinX:Number = Math.sin(angleX);
for (var i:Number = 1; i<numPoints; i++) {
var point:MovieClip = this["point"+i];
var x1:Number = point.x*cosY-point.z*sinY;
var z1:Number = point.z*cosY+point.x*sinY;
var y1:Number = point.y*cosX-z1*sinX;
var z2:Number = z1*cosX+point.y*sinX;
point.x = x1;
point.y = y1;
point.z = z2;
if (point.z<=-fl) {
point._visible = false;
} else {
point._visible = true;
var scale:Number = fl/(fl+point.z);
point._xscale = point._yscale=scale*100;
point._x = vpX+point.x*scale;
point._y = vpY+point.y*scale;
point.swapDepths(-point.z);
}
}
}
how should i go about it?
Thanks for your help guys.