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

flash actionscript : Why do variables not work in this script?



Canbrit1000
2/8/2004 5:31:36 PM
I am trying to set a movie clip on the stage at a specific location set by x,y
values
This is the code I use
onClipEvent (enterFrame)
_x = x_pos
_y = y_pos

x_pos and y_pos being the variables
It does not work

If I substitute value
onClipEvent (enterFrame)
_x = 20
_y = 50

the script works
I have made up a simple FLA file to show what I mean
I couldn't get the file attachment to work so I put the FLA file on my sit

http://wgadesign.com/positioning_movie_clips.fl

Jack
2/8/2004 5:42:34 PM
use -
onClipEvent (load) {
x_pos = 20;
y_pos = 50;
// if x_pos and y_pos are set from the main timeline, use
// x_pos = _parent.x_pos;
// y_pos = _parent.y_pos;
}

onClipEvent (enterFrame)
_x = x_pos;
_y = y_pos;
}

hth


[quoted text, click to view]

AddThis Social Bookmark Button