here is a class for repositioning assets when we resize the stage.
example:
StageResizeManager.addConstraint(clip,StageResizeManager.TOP,50);
//Will position clip at 50 pixels from the top of the stage
StageResizeManager.addConstraint(clip,StageResizeManager.CENTERX,0);
//Will position clip in the center on the x axis
StageResizeManager.addConstraint(clip,StageResizeManager.CENTERX,-clip.width/2);
//if the anchor point is on the top left of the clip (which is the default in flash) this will center the clip and shift the position of the half of the width of the clip to make it perfectly centered
StageResizeManager.addConstraint(clip,StageResizeManager.PERCENTY,33);
//this will position the clip at 33 percent on the y axis
The availables constraints which are defined as constants of the class are :
RIGHT
LEFT
TOP
BOTTOM
CENTERX
CENTERY
PERCENTX
PERCENTY
Source + example
class
No comments:
Post a Comment