Hi and thanks in advance for reading this
Ok i got a code from this webiste
http://www.n99creations.com/vieweg.php?id=4 its a circlar Menu and i've downloaded the sample file....it works fine and all but i only want it to work for 4 buttons instead of 5 buttons but when i delete one button it doesn't move any more and plus i tried my best to change the code but i'm not very good in array
Here is the code
var xCentre:Number = Stage.width/2;
var yCentre:Number = Stage.height/2;
var radius:Number = 150;
var myArray:Array = [];
var allClips:Array = [];
var i:Number = 1;
var easeSpeed:Number = 10;
while (_root["but"+i]) {
_root["but"+i].ivar=i, allClips.push(_root["but"+i]);
_root["but"+i++].onEnterFrame = spin;
}
for (var e:Number = 1; e<i; e++) {
myArray.push((2*Math.PI)*_root["but"+e].ivar/(i-1));
}
onEnterFrame=function () {
for (var obj in allClips) {
allClips[obj].theta = myArray[obj];
}
}, leftButton.onPress=function () {
var lastItem = allClips[allClips.length-1];
allClips.pop(), allClips.unshift(lastItem);
}, rightButton.onPress=function () {
var firstItem = allClips[0];
allClips.shift(), allClips.push(firstItem);
};
function spin() {
this._x += ((xCentre+Math.cos(this.theta)*radius)-this._x)/easeSpeed;
this._y += ((yCentre+Math.sin(this.theta)*radius)-this._y)/easeSpeed;
}
- var xCentre:Number = Stage.width/2;
- var yCentre:Number = Stage.height/2;
- var radius:Number = 150;
- var myArray:Array = [];
- var allClips:Array = [];
- var i:Number = 1;
- var easeSpeed:Number = 10;
- while (_root["but"+i]) {
- _root["but"+i].ivar=i, allClips.push(_root["but"+i]);
- _root["but"+i++].onEnterFrame = spin;
- }
- for (var e:Number = 1; e<i; e++) {
- myArray.push((2*Math.PI)*_root["but"+e].ivar/(i-1));
- }
- onEnterFrame=function () {
- for (var obj in allClips) {
- allClips[obj].theta = myArray[obj];
- }
- }, leftButton.onPress=function () {
- var lastItem = allClips[allClips.length-1];
- allClips.pop(), allClips.unshift(lastItem);
- }, rightButton.onPress=function () {
- var firstItem = allClips[0];
- allClips.shift(), allClips.push(firstItem);
- };
- function spin() {
- this._x += ((xCentre+Math.cos(this.theta)*radius)-this._x)/easeSpeed;
- this._y += ((yCentre+Math.sin(this.theta)*radius)-this._y)/easeSpeed;
- }
now i just want only 4 buttons to rotate ....can someone explain what is the code about ...becoz they just gave code and no explaination ....i wanna know what it means no point of doing projects if u don't understand them ....please help