[FMX] draw and size box w/ AS

love the way fonts for flash (http://www.fontsforflash.com/) opens those different boxes for content to go in. Would like to experiment with this, but need help. I can build the box with teh drawing API, but how do they resize it?

thanks,
JCS

draw it inside a clip, resize the clip (width/height)…

Hey eyez… for movie clips it is _width and _height to resize width and height I believe is for Stage.width and Stage.height.

And yes… _width and _height allow you to resize by pixels and _xscale and _yscale allow you to resize by percent of the current size.

thanks guys

No problem. On a lighter note… if you resize an object to bigger than the original size, it usually causes the border to stretch too, making it look ugly.

When I do this I make the box as bis as the stage and resize it smaller right after I draw it (with the drawing API). This way you can resize it to whatever and experience no distortion.

nice! I had noticed that too, but hadn’t thought about “working backwards” like that. A great point!

You can do it that way… Or you can avoid the resizing problems by just designing a function…



MovieClip.prototype.buildBox = function(x1, y1, x2, y2)
{
     // just add the x1,y1,x2,y2 values in here
     // it shouldn't be too large to do it this 
     // way and you have more control over
     // the number of boxes you can have
}

// This would be how you would call that...

_root.createEmptyMovieClip("box", 100);
_root.box.buildBox(100,100,200,200);


It would then create a box to the dimensions you set it for at those locations…

Later On