Hi Athi,

I am not sure why so much of code being written for this :). Flex 4 supports
the new text engine which lets you format however you need with all and more
of your requirements covered. Please read :

http://labs.adobe.com/technologies/textlayout/

Wish you good luck.

Cheers,
Naveen

On Fri, Nov 12, 2010 at 10:49 AM, athi <[email protected]> wrote:

> hi
> i am working in flex 4.
>
> i use one string varaible named str and i stored
> str="Would  become computer literal to be able to alll of its things
> in six months with one computer."
>
> i want to split the str variable into fline and sline. I used to split
> str variable using the following lines
>
>                if(str.length>50)
>                                {
>                                fline= str.substring(0, str.lastIndexOf(" ",
> 50));
>                                sline =  str.substring(str.lastIndexOf(" ",
> 50) +  1);
>                                firstLine();
>                                //Alert.show(sline);
>                                }
>                                else
>                                {
>                                        fline=str;
>                                        sline=" ";
>                                        firstLine();
>
>                                }
>
> Then i want to create label of each words using this lines
>
>
> private function firstLine():void
>                {
>                   //Alert.show(fline);
>                        var l1:Number=fline.length;
>                        //      Alert.show(l1.toString());
>
>                        myarr=fline.split(" ");
>                        myarr1=sline.split(" ");
>
>                        //var l1:Number=Number(l);
>                        inputValue = myarr.length;
>                        //Alert.show(inputValue.toString());
>                        for(var intLoop:int=0;intLoop<inputValue;intLoop++)
>                        {
>                                lbl = new Label();
>                                lbl.id="l"+intLoop;
>                                lbl.text = myarr[intLoop];
>                                lbl1 = new Label();
>                                lbl1.id="l"+intLoop;
>                                lbl1.text = myarr1[intLoop];
>
>
>                                lbl.addEventListener(MouseEvent.MOUSE_OVER,
> onLabelOver);
>                                lbl.addEventListener(MouseEvent.CLICK,
> onLabelClick);
>                                lbl.addEventListener(MouseEvent.MOUSE_OUT,
> onLabelOut);
>                                lbl.styleName="hai1";
>
>                                lbl1.addEventListener(MouseEvent.MOUSE_OVER,
> onLabelOver);
>                                lbl1.addEventListener(MouseEvent.CLICK,
> onLabelClick);
>                                lbl1.addEventListener(MouseEvent.MOUSE_OUT,
> onLabelOut);
>                                lbl1.styleName="hai1";
>
>
>                                labelBox.addChild(lbl);
>                                labelBox1.addChild(lbl1);
>
>
>
>                                }
>                                labelBox.styleName="lblalign";
>
>
>                        }
>
> after i split the words add the words(lbl) into labelBox and
> labelBox1.
> Here the LabelBox and LabelBox1
>
> <mx:HBox id="labelBox" x="54" y="263" width="389" height="18"
> color="#FFFFFF" alpha="0.40" backgroundColor="#000101"  >
>                </mx:HBox>
>                <mx:HBox id="labelBox1" width="389" height="20"
> color="#FFFFFF"
> alpha="0.40" backgroundColor="#000000" x="54" y="280">
>
>                </mx:HBox>
>
>
> This is displayed as follows
> Would  become computer literal to be able to alll
> of its things in six months with one computer
>
> but my requirement is align this line to center.
>
>            Would  become computer literal to be able to alll
>                of its things in six months with one computer
>
> Is it possible.
> if possible means give some ideas to me.
>
> regards
> athi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Flex India Community" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<flex_india%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/flex_india?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to