13 Replies Latest reply on May 3, 2009 8:58 PM by Madhav Subedi

    Is it possible to use mx.controls in ActionScript class?

    LeighWW

      I am very new to Flex, with a very small amount of experience in ActionScript so forgive me if the answer to this is obvious. I've tried searching and haven't found a conclusive solution to my problem.

       

      I have a Flex project that I am building in Flex Builder 3. The main application is in mxml, but most of the classes I'm using are in ActionScript.

       

      The general purpose of the application is to create a flowchart that accepts certain inputs on the elements in the charts. The chart components are all ActionScript classes. I am attempting to add a combobox to a component, but despite not getting any errors or warnings I can't get the combobox to show up.

       

      Here's a simplified version of the code within the class (I've left out the stuff that doesn't directly relate to my issue):

       

      ...


          import mx.controls.ComboBox;


      ...      
               
                newComboBox = new ComboBox();
               
      newComboBox.initialized = true;
               
      newComboBox.alpha = 1;
               
      newComboBox.dataProvider = valueArray;
               
      newComboBox.x = 5;
               
      newComboBox.y = -5;
               
      newComboBox.height = 20;
               
      newComboBox.width = width - 60;
               
      newComboBox.visible = true;
                addChild(
      newComboBox);

       

      ...