this is a way without rewriting your functions altogether, you have stuff in your move function which you dont need so ive taken the liberty of removing
function move(obj, endx) {
obj.onEnterFrame = function() {
speed = 10;
x = endx-this._x;
this._x += x/speed;
if (this._x == endx) {
delete this.onEnterFrame;
}
};
}
then for one of your buttons
BIO.onRelease = function() {
if (this.pressed == false) {
this.pressed = true;
} else {
(this.pressed=false);
}
if (!this.pressed) {
move(PICS, 500, 184);
move(MAIL, 592, 276);
move(LINKS, 684, 368);
} else {
move(PICS, 184, 500);
move(MAIL, 276, 592);
move(LINKS, 368, 684);
}
};
well at least you have got the hang of functions quickly.
If i were making something like this from scratch, i`d label the buttons btn0,btn1,btn2 etc and then put them in an array and just loop through the array. Much less code but not really any better.
I discovered that your code didn’t work correctly, sometimes you have to click 2 times before something moves. I want that, if you click bio pics,mail and links will move to the right and then if you click bio again OR if you click for example mail from the menu pics and mail go back to their original place and links stays at the right side. Do you know what i mean and do you think that is possible without rewriting the whole code?
(Everybody is welcome to help, not only stringy!!)
yes i know, but if you label them like i said, it is easier to loop through them and also easier to follow what is going on if you put them in an array.
for example
6 movieclips labelled btn0,btn1,btn2…
numbbut = 6
for (var i = 0; i<numbbut; i++) {
this[“btn”+i].onPress = function() {
this.pressed = true;
trace(this.pressed);
};
}
if you click on a button the buttons goes to the right aswell, i dont know if that was what you wanted, but i changed (a little tiny bit) of your code, so it looks like i want it to look. i’ve changed this
if (this._x == this.startX) {
for (var j = this.ivar; j<startArray.length; j++) {
move(startArray[j], startArray[j].endX);
}
to
if (this._x == this.startX) {
for (var j = this.ivar+1; j<startArray.length; j++) {
move(startArray[j], startArray[j].endX);
}
so if you click know, the clicked button won’t go to the right, but i guess you could figured this out by yourself. But thanks for all this scripting again!
no, as you can see the main timeline has two layers, 1 layer with the menu and the other menu with the submenu (forgot to turn _alpha to 100, so that’s why you can’t see the submenu), this submenu is called PICS. Now i’ll explain pieces of my code:
startArray*.onPress = function() {
// so now you're in the mc you clicked
subhide(placeold);
// hides the previous submenu
place = this.txt;
// this indicates the movieclip you clicked,
// inside the btns (btn0, btn1 etc) is txt
// the title of the btn (PICS, HOME etc)
submenu(place);
//does the function submenu, if you clicked PICS, place = PICS
placeold = this.txt;
// sets the mc you clicked to oldplace for the next time you click a button
now the function that isnt working
function submenu(loc) {
// loc = place = mcyouclicked.txt = (PICS/HOME etc)
setProperty(loc, _visible, true);
// sets the visibility of the submenu true
loc.onEnterFrame = function() {
// submenu.onEnterFrame
trace("boe");
this._alpha = this._alpha + 2;
// lets the mc fade in from 0 to 100
if (this._alpha>=100) {
delete this.onEnterFrame;
// when mc is fully visible, delete this.onEnterFrame
}
};
}
i’ll hope you do know what i mean now… i think its difficult to explain problems well ;(
No i’m sorry, because the other buttons (BIO, MAIL) will have submenu’s too, and you’ve only fixed it for pics. It want the submenu to fade in depends on the button you’ve clicked… maybe it’s to complicated…