Why don't you fade?

But what should i do then with the move function when i use the loop (if it’s a very obvious answer, it’s getting late…)

Because I read the button text from a label i’m putting these in an array too so i can use the array for the .onPress

if you can wait while tomorrow, i`ll remake it for you but its late here too.

Thanks alot! I already have the array for the names ready, so everything is ready except the moving part.

on each of the buttons add
on (releaseOutside) {
fade();
}
on the main timeline

function init() {
speed = 5;
numbbut = 5;
gap = 100;
startArray = ;
for (var i = 0; i<numbbut; i++) {
this[“btn”+i].ivar = i;
this[“btn”+i].startX = this[“btn”+i]._x;
this[“btn”+i].endX = this[“btn”+i].startX+gap;
startArray.push(this[“btn”+i]);
}
}
init();
for (var i = 0; i<startArray.length; i++) {
startArray*.onPress = function() {
if (this._x == this.startX) {
for (var j = this.ivar; j<startArray.length; j++) {
move(startArray[j], startArray[j].endX);
}
} else if (this._x == this.endX) {
for (var k = this.ivar; k>-1; k–) {
move(startArray[k], startArray[k].startX);
}
}
};
}
function move(obj, targetx) {
obj.onEnterFrame = function() {
x = targetx-this._x;
this._x += x/speed;
if (Math.abs(targetx-this._x)<1) {
this._x = targetx;
delete this.onEnterFrame;
}
};
}

Seems to be working ok and we have retained your function.
Time for work.

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!

yeh i wasn`t really sure exactly what you wanted but glad you figured it out on your own.

well now i’m about to make submenu’s… so here is another problem: i’ve made a function (again…) and again it doesn’t work.


function submenu(loc) {
	setProperty(loc, _visible, true);
	loc.onEnterFrame = function() {
		trace("boe");
		this._alpha = this._alpha + 2;
		if (this._alpha>=100) {
			delete this.onEnterFrame;
		}
	};
}

well, the making visible works, but then it wont do the onEnterFrame function! the function wont start! and i dont get it because this


 function move(obj, targetx) {
	obj.onEnterFrame = function() {
		x = targetx-this._x;
		this._x += x/speed;
		if (Math.abs(targetx-this._x)<1) {
			this._x = targetx;
			delete this.onEnterFrame;
		}
	};
}

DOES work. and it seems like almost the same code to me.

Any chance of uploading the file?

yep here it is!

Also i would like the gap to depend on the button you clicked… i tried a lot, but nothing works.

still not sure what you are trying to do,when you say name =this.txt are you trying to make the text on the main buttons disappear and then fade in?

maybe like this

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…

it is getting a bit messy but you can still make it work.
Give each submenu a seperate instance name, pics0,pics1,pics2 so we can use ivar to reference again. Just done it quickly here with 3, you`ll have to positionthem correctly

Thanks! Do you know a way to change the gap, because i want the gap to be as big as the submenu, and the submenu’s will change from size… Thanks for putting so much time in my projects! I’ve learned a lot the past days! About your script… could you tell me why you use createEmptyMovieClip? Because thats the only part i dont understand about the code…

created empty movieclip because it worked better for the onEnterFrame(“loc”)
Im pretty sure we can use the submenus_width to vary the spacing. If you get your submenus in place, ill have a try because i`m still not sure where they are going.

well ive placed everything at the right spot… but know the submenus stay visible… i dont get it.

you have to embed font outlines when altering _alpha of dynamic text

ok i’ll try that