PDA

View Full Version : [FMX] draw and size box w/ AS



jcs
January 23rd, 2003, 01:48 PM
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

eyezberg
January 24th, 2003, 08:17 AM
draw it inside a clip, resize the clip (width/height)..

lostinbeta
January 24th, 2003, 12:30 PM
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.

jcs
January 24th, 2003, 12:40 PM
thanks guys

lostinbeta
January 24th, 2003, 12:45 PM
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.

jcs
January 24th, 2003, 01:46 PM
nice! I had noticed that too, but hadn't thought about "working backwards" like that. A great point!

Marz
January 25th, 2003, 09:12 AM
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