|
-
setting Registration Point of Dynamic Movieclip
Hi All,
I have created one dynamic movie clip. I have loaded one image in it.
I want to rotate that image. it is rotating nicely. But the problem is the center for rotation. So i want to set registration point of that image to center.
But i dont know how to set the registration point of a movie clip dynamically.
I am using AS2.
Any help would be appreciable.
Thanks In Advance...
-
The registration point of a movie clip is just the center of that movie clip. For instance, if you double click into a movie clip where you have an image, and set that image's X and Y coordinates to 0,0 you will effectively be giving that image a Top left corner registration. So, while I'm probably not as efficient with the code as some of the other guys here, I can help you with the concept. All you need to do is be able to center the image inside the movie clip and it should work.
So, unless there's a centering command for AS that I'm not familiar with you'll probably have to do this the hard way (It's not really that hard though).
Find the width and height of each image (if they're the only thing inside this movie clip, then you can just use "movieClip._width" and "movieClip._height".
Then divide both of them by 2 and set the coordinates of the image to the negative of that number.
i.e. :
Code:
imageWidth = movieClip._width //(or image._width if you can do that)
imageHeight = movieClip._height //(or image._height if you can do that)
imageWidth = imageWidth/2
imageHeight = imageHeight/2
image._x = imageWidth*-1
image._y = imageHeight*-1
I'm not as familiar with AS as most of the guys on here, and this may be sloppy, but in theory it should work.
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
|