Groups | Blog | Home
all groups > flash actionscript > april 2004 >

flash actionscript : _x and _y not working..


art1234
4/23/2004 7:55:36 PM
I've been trying to attach and place on the screen the four instances of a
button. I can see that the instances were created because when I hardcoded
(button1_btn._x=300; for example) it does work. But the result that I have with
the following code are, four instances of that button placed at 0,0 (default)
and not to the coordenates that I would like.
Note that I am using the same array (varButton[]) for the attachMovie and _x
_y.
Does anyone have an answer or tell me about an alternative?
Your help is much appreciated.
varButton = new Array();
for (c=1; c<5; c++) {
varButton[c]="button"+c+"_btn";
attachMovie("smallButton",varButton[c],c);
myY=c*30;
varButton[c]._x = 200;
varButton[c]._y = myY;
}
tofletch
4/23/2004 8:00:07 PM
Hi,

try this...

_root["varButton"+c].x = 200;
_root["varButton"+c].y = myY;

stwingy
4/23/2004 8:14:26 PM
or maybe
varButton = new Array();
for (c=1; c<5; c++) {
myClip = attachMovie("smallButton", "button"+c+"_btn", c);
//don`t really need array for this but maybe for
something else?
varButton.push(myClip);
myY = c*30;
myclip._x = 200;
myclip._y = myY;
}
art1234
4/23/2004 8:20:14 PM
Thanks but didn't work.
I've also created a var to copy the value in the array, like this:
temBtn=varButton[c];
_root["tempBtn"]._x = 200;
_root["tempBtn"]._y = myY;
and I used both .y and ._y syntaxes just in case. but no...I also tryied
_root[ and _root.[
Looks like I am stuck
art1234
4/23/2004 8:30:38 PM
OK. You got it.
... and I have removed the array as well..
This is the result that worked.
Thanks to both of you ..
:
//varButton = new Array();
for (c=1; c<5; c++) {
myClip = attachMovie("smallButton", "button"+c+"_btn", c);
//don`t really need array for this but maybe for something else?
//varButton.push(myClip);
myY = c*30;
myClip._x = 200;
myClip._y = myY;
}
AddThis Social Bookmark Button