On Tue, Dec 23, 2008 at 9:05 AM, Stephen More <stephen.m...@gmail.com> wrote:
> On Mon, Dec 22, 2008 at 5:39 PM, Manish Jethani
> <manish.jeth...@gmail.com> wrote:
>>> Is there an easy way to get text inside of a mx.controls.Alert to wrap ?
>>
>> It already wraps.
>>
>> <mx:Button click="Alert.show('The quick brown fox jumped over the
>> wall. The quick brown fox jumped over the wall. ...')" />
>>
>> Perhaps you want to reduce the width of the box?
>
> Here is a little background, my flex application is really small....
> width 125 x height 300.
>
> I would like the Alert box to be slightly smaller than the flex application.
>
>            import mx.controls.Alert;
>            import mx.managers.PopUpManager;
>
>            private function showAlert() : void
>            {
>                var myAlert:Alert = Alert.show('The quick brown fox
> jumped over the wall. The quick brown fox jumped
>  over the wall. ...');
>                myAlert.width = Application.application.width - 20;
>                PopUpManager.centerPopUp( myAlert );
>            }
>
> The text is wrapping in your example, but it does wrap tight enough as
> it is overflowing the edges.
> How can the text wrap such that all text will fall within myAlert.width ?

I just looked at the source, and I'm sorry to say that the algorithm
for calculating the width of the text object is fixed and cannot be
overridden. The width is calculated based on the length of the title
text and the width of the buttons (both factors). Any width you set on
the Alert object has no effect on the width of the text inside it.

Your options are to either chop up the text programmatically into
multiple lines, so it appears to be wrapped, or patch the framework's
AlertForm component to respect the width assigned to it.

-- 
manishjethani.com

Reply via email to