2 Replies Latest reply on Dec 21, 2006 5:49 PM by ntsiii

    creating compenent through action script

    xyco45
      Okay in java you simply do something like this to create a Label

      public JLabel testLabel = new JLabel("text on label");

      then you just added it the canvas later on and when you run the app it displays your label.

      Is it possible to do this sort with flex?

      I mean to say is instead of using the <mx:Label text = "blah, blah />
      can it all be done actionscript like this

      <script >
      <![CDATA[
      import mx.controls.Button;
      public var happy:Button = new Button();
      public tes():void
      {
      happy.text = "fsdfd";
      happy.width = "12";
      happy.height = "12";
      }
      <mx:button click= "test()">

      make it so that when you hit he button it will create the "happy" button in the flex app dymanically... unless it doesn't work like that... Does it?