header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
Wilson
Points:0
Posts:0

8/8/2010 11:40:59 PM

Title: Multiline Label


Can we have a multiline label?



1
Rayan
Points: 700
Posts:0
8/9/2010 1:39:17 AM



extend you label component to add this functionality, here is the extended class code to make a label multiline


package components
{
 import mx.core.UITextField;
 import flash.text.TextFieldAutoSize;
 import mx.controls.Label;
 import flash.display.DisplayObject;

 public class MultiLineLabel extends Label
 {

 override protected function createChildren() : void
 {
 // Create a UITextField to display the label.
 if (!textField)
 {
 textField = new UITextField();
 textField.styleName = this;
 addChild(DisplayObject(textField));
 }
 super.createChildren();
 textField.multiline = true;
 textField.wordWrap = true;
 textField.autoSize = TextFieldAutoSize.LEFT;
 }
 }
}

2
Prestine
Points: 190
Posts:0
8/11/2010 12:55:28 AM



Yes, we can have multi line label.

Try this example : Hope this is what you were loooking for.


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:Script>
        <![CDATA[
            import mx.events.FlexEvent;
            import mx.controls.Label;
            import mx.controls.Alert;
            import mx.containers.FormItem;

            private function init3(evt:FlexEvent):void {
               // var lbl:Label = FormItem(evt.currentTarget).itemLabel as Label;
                label3.htmlText = "<b>" + label3.text + "</b>" + "\n" + "Street Name";
                label3.selectable = true;
                label3.height		=	100;
               // label3.addEventListener(TextEvent.LINK, label_link);
            }

           
        ]]>
    </mx:Script>

   <mx:Form minWidth="1000" height="100%">
        <mx:FormItem id="formItem3"
                >
            <mx:Label id="label3" width="100%" text="Multi line Label Multi line Label "
                    creationComplete="init3(event);"/>
        </mx:FormItem>
    </mx:Form>

</mx:Application>

3
dhd
Points: 0
Posts:0
5/26/2011 4:05:27 AM



kjl


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 5+1 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions