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

flash actionscript : Moving Attached Clips


evil_muffin_man
4/19/2007 9:41:11 PM
I've used this in two programs, and neither one works.

I attach a movie clip with attachMovie(); and in it I set the name to
"char_mc" or something else.
Then I try to say char_mc._x = blah; and it does not move.

The code I use is on the main storyline. It does not work for _x, _y, _xscale,
_yscale, and probably everthing else. When I trace for one of these values it
says undefined.

_root.attachMovie("Picture1", "pict_mc", 1);

pict_mc._x = 20;
pict_mc._y = 20;
GWD
4/19/2007 9:42:46 PM
try doing it like this:

_root.attachMovie("Picture1", "pict_mc", 1, {_x:20,_y:20});


evil_muffin_man
4/19/2007 10:09:44 PM
I see. But that won't work if I put the update in an if statement.

GWD
4/19/2007 10:47:04 PM
You will be able to make changes to the properties, but not immediately - it
takes some time for the attached movieclip to initialise.
The initialisation object as the last argument for the for the setup
position/size etc.

Then after a very short period of time or 1 frame or whatever you'll be able
to make more changes to the clip properties.

if a standard movieclip property for your pict_mc is undefined then its not
yet ready.


evil_muffin_man
4/20/2007 12:41:11 AM
AddThis Social Bookmark Button