1 Reply Latest reply on Nov 3, 2010 3:33 AM by rabinprithvi

    Label Width is zero

    rabinprithvi Level 2

      Hi,

       

      Unable to get the width of the label control.

       

      code is below.

       

      <?xml version="1.0" encoding="utf-8"?>

       

      <s:Application

         xmlns:fx="http://ns.adobe.com/mxml/2009"

         xmlns:s="library://ns.adobe.com/flex/spark"

         creationComplete="init()">

       

       

       

       

       

       

      <fx:Script>

       

      <![CDATA[

       

           import mx.controls.Alert;

       

           import spark.components.Label;

       

       

           private var label:Label

       

       

           private function init():void

       

           {

                label = new Label()

                label.text = "Hello World";

                addElement(label);

       

                Alert.show(String(label.width));

       

      }

       

       

      ]]>

       

      </fx:Script>

       

       

      </s:Application>