Well, what I did is make 9 parts to my graphic,
topLeft_mc
topCenter_mc
topRight_mc
centerLeft_mc
center_mc
etc.
Then, put those in a movieClip with the respective instance names. Then pass
that clip to a scale function, also pass width and height parameters. Then in
the function, do some calculations. Something like this (this example attaches
the scale 9 clip from the library):
private function scale9():MovieClip {
t = this.target_mc.attachMovie("scale9graphic ", "scale9graphic_mc",
theDepth);
t._x = x;
t._y = y;
x1 = 0;
x2 = t.topLeft_mc._width;
x3 = w-(t.topLeft_mc._width);
y1 = 0;
y2 = t.topLeft_mc._height;
y3 = h-t.bottomLeft_mc._height;
w1 = t.topLeft_mc._width;
w2 = w-(t.topLeft_mc._width + t.topRight_mc._width);
w3 = t.topRight_mc._width;
h1 = t.topRight_mc._height;
h2 = h-(t.topRight_mc._height+t.bottomRight_mc._height);
h3 = t.bottomRight_mc._height;
t.topLeft_mc._x = x1;
t.topLeft_mc._y = y1;
t.topCenter_mc._x = x2;
t.topCenter_mc._y = y1;
t.topCenter_mc._width = w2;
t.topRight_mc._x = x3;
t.topRight_mc._y = y1;
t.centerLeft_mc._x = x1;
t.centerLeft_mc._y = y2;
t.centerLeft_mc._height = h2;
t.center_mc._x = x2;
t.center_mc._y = y2;
t.center_mc._width = w2;
t.center_mc._height = h2;
t.centerRight_mc._x = x3;
t.centerRight_mc._y = y2;
t.centerRight_mc._height = h2;
t.bottomLeft_mc._x = x1;
t.bottomLeft_mc._y = y3;
t.bottomCenter_mc._x = x2;
t.bottomCenter_mc._y = y3;
t.bottomCenter_mc._width = w2;
t.bottomRight_mc._x = x3;
t.bottomRight_mc._y = y3;
return t;
};
Jason Merrill
Bank of America
Learning & Organization Effectiveness - Technology Solutions
>>-----Original Message-----
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Marcos Neves
>>Sent: Thursday, July 20, 2006 8:48 AM
>>To: Flashcoders mailing list
>>Subject: Re: [Flashcoders] scale9grid how to
>>
>>And how it can be done?
>>
>>On 7/20/06, Merrill, Jason <[EMAIL PROTECTED]> wrote:
>>> If it gets too messy, you can also roll your own scale 9 function for
>>> graphics -
>>that's what I did since I'm building for Flash 7. It's pretty easy actually.
>>>
>>> Jason Merrill
>>> Bank of America
>>> Learning & Organization Effectiveness - Technology Solutions
>>>
>>>
>>>
>>>
>>>
>>> >>-----Original Message-----
>>> >>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>> >>[EMAIL PROTECTED] On Behalf Of Marcos Neves
>>> >>Sent: Wednesday, July 19, 2006 4:34 PM
>>> >>To: Flashcoders mailing list
>>> >>Subject: [Flashcoders] scale9grid how to
>>> >>
>>> >>How can I use programaticlly scale9grid to don´t deform a roundRect when
>>> >>scaled?
>>> >>I´know how it works at design time on flash.
>>> >>_______________________________________________
>>> >>[email protected]
>>> >>To change your subscription options or search the archive:
>>> >>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>> >>
>>> >>Brought to you by Fig Leaf Software
>>> >>Premier Authorized Adobe Consulting and Training
>>> >>http://www.figleaf.com
>>> >>http://training.figleaf.com
>>> _______________________________________________
>>> [email protected]
>>> To change your subscription options or search the archive:
>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>
>>> Brought to you by Fig Leaf Software
>>> Premier Authorized Adobe Consulting and Training
>>> http://www.figleaf.com
>>> http://training.figleaf.com
>>>
>>_______________________________________________
>>[email protected]
>>To change your subscription options or search the archive:
>>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>>Brought to you by Fig Leaf Software
>>Premier Authorized Adobe Consulting and Training
>>http://www.figleaf.com
>>http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com