How to use one set of buttons to control different movieclip?

I have one set of buttons for moving up, down, left, right of the movieclip. now I have two movieclips they need the same functions. Is that possible I apply the same buttons to both of the movieclips and works on the one which I clicked.

anyother suggestions are welcome too!

I’m not too sure what you mean?? Do you want one button to control several movieClips? or Several buttons which all have the same code?

In the set of buttons, just give example of moving up button.

I have two movieclips. And I want this moving up button can have effect on both of them. And if I click the first movieclip and then click the up button, it goes upward. And if I click the second movieclip and then click the up button, the second one goes upward, and the first one stays where it was.

Am I made myself clear this time.

yea…you can make a variable. Then when you click on the first MC, the variable = 1, and the second MC, the variable = 2.

Then you say if whatever_variable == 1 {
moveUp();
}

then the same with ‘2’. Make a function called moveUp and tahts all!

BTW, did you post two of the same questions? youre not suppose to :-\

Hello, thanks for your idea. I have tried but there is some problem with it.

I have on the first movieclip:
on (release) {
var spress=1;
}
and on the second one
on (release) {
var spress=2;
}

and on the moving upward button, I have

on (release) {
trace(_root.spress); // the spress is undefined when
//I trace it ,so cannot continue

if (spress==1) {
	_root.screen._y -= 5;
	switch (state) {
	case 1 :
		y_value1 = _root.screen._y;
		break;
	case 2 :
		y_value2 = _root.screen._y;
		break;
	case 3 :
		y_value3 = _root.screen._y;
		break;
	case 4 :
		y_value4 = _root.screen._y;
		break;
	}
}
else if(spress==2) {
	_root.mulscreen._y -= 5;
	switch (state) {
	case 1 :
		y_valuem1 = _root.mulscreen._y;
		break;
	case 2 :
		y_valuem2 = _root.mulscreen._y;
		break;
	case 3 :
		y_valuem3 = _root.mulscreen._y;
		break;
	case 4 :
		y_valuem4 = _root.mulscreen._y;
		break;
	}
	
	
	}

}

Any idea about this ? Thanks in advance !

Try using AS tags next time :slight_smile:

I havn’t really used switch;break, so i don’t really understand it but thats not the main problem. I have always had a problem doing:

var spress = 1

instead i just do:
_root.spress = 1
_root.spress = 2

Seems to work better for me. Try it and tel lme if it works :slight_smile:

Thanks for your idea of _root.spress=1. Now it works perfectly well. and the switch also works. Thanks again!

By the way, do u have idea about the combo box for changing the font face of the input and output textfields. I can make the font face shown on the input textfiles, but not on the output textfield after submit. Do u have any idea about that?

Do you have an example? i’m not too sure what you mean :-\

Here is the attachment of it there. Many thanks in advance.

Sbuh,

I made this cos i was bored, and cos i knew how to do it. Enjoy.

Regards,
Viru.