|
-
Center movieclip noScale
Hi and thanks for all the help here... Very appreciated!!!
I while ago i posted a thread about align movieclips. I my movie i've got this movie clip called "copy" where all the copyright text is shown. The movieclip is always in the right bottom corner. I want my other movieclip, called "main", to always be centered and my third, called "logo" to be in the left upper corner. This must be possible, but how?
I use this script to get my mc copy in the right corner:
Code:
Stage.scaleMode = 'noScale';
Stage.align = 'TL';
myListener = new Object();
myListener.onResize = function(){
sw = Stage.width;
sh = Stage.height;
copy._x = sw - 0;
copy._y = sh - 0;
}
Stage.addListener(myListener);
myListener.onResize();
Thanks in advance
-
Top left is easy. In that case both _x and _y are 0.
To find the center is also not very difficult. Just divide stage width and height by 2.
Code:
Stage.scaleMode = 'noScale';
Stage.align = 'TL';
myListener = new Object();
myListener.onResize = function(){
sw = Stage.width;
sh = Stage.height;
logo._x = 0;
logo._y = 0;
main._x = sw / 2;
main._y = sh / 2;
copy._x = sw;
copy._y = sh;
}
Stage.addListener(myListener);
myListener.onResize();
Depending on where (0,0) is inside your movieclips you may have to add correction values. Another way to detect those correction values automatically is to use getBounds to detect the boundaries of each movieclip.
-
thanks for the very very fast reply willbert!
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
|