-
Senior Member
Attaching a MC from a library and setting its X and Y
Hi all!
I have a movie in the library which I want to attach to the stage by code. Here's the code I've been using:
Code:
count = 0;
_quality="High";
onEnterframe = function () {
attachMovie("main", "circle"+count, count++);
};
This code works, but it puts the attached MC (circle) in the middle of the stage. How can I set its X and Y coordinates to place it exectly where I need it? I tried a few things, but the code I tried shifted the entire stage instead of that MC alone... So how can I do it?
Thanks in advance!
Sometimes the most simple things are the most effective...
-
Senior Member
Code:
count = 0;
_quality="High";
onEnterframe = function () {
attachMovie("main", "circle"+count, count++);
this["circle"+count]._y = number;
this["circle"+count]._x = number;
};
If you don't think you're going to like the answer, then don't ask the question.
-
Senior Member
Thanks!!!
Apparently I was close, but not close enough...
These 2 lines of code also gave me the idea how to scale that darn MC with the code.
Once again, thank you!
Sometimes the most simple things are the most effective...
-
Monkey Moderator
attachMovie also allows you to use an init Object. the attached movie will have its properties set to whatever you set in the init Object. e.g.
Code:
count = 0;
_quality="High";
onEnterframe = function () {
attachMovie("main", "circle"+count, count++,{_x:count*10, _y:10});
};
www.lexicon-design.co.uk
If we aren't supposed to eat animals, then why are they made of meat?
If Vegetarians like animals so much, why do they eat all their food?
-
Senior Member
If you don't think you're going to like the answer, then don't ask the question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|