4 Replies Latest reply on Aug 6, 2010 3:35 PM by ssardar

    Flex error: type was not found or was not a compile-time constant: Button

    jerry98225

      Hi guys..

         I am trying to build a pure as3 project in flex and I got the following error:

       

          type was not found or was not a compile-time constant: Button

       

          type was not found or was not a compile-time constant: TextField

       

      My code is:

       

       

              import fl.controls.TextInput;  // import my textinput

       

      import flash.display.Shape;

      import flash.display.SimpleButton;

      import flash.display.Sprite;

      import flash.text.TextField;

      import fl.controls.Button;   //import my button

       

       

      public class SearchYoutube extends Sprite

      {

      private var textBx:TextField=new TextField();

      private var controls:Controls;

      private var bground:Sprite=new Sprite();

      private var searchButton:Button;

       

          /************************Constructor*********************/

          public function SearchYoutube()

          {

          /*********************Create Search Form****************************/

          createSearchForm("Please Enter Your Keyword");

         

          }

       

       

       

      /*********************Search Form****************************/

      private function createSearchForm(title:String):void{

       

      var searchInput:TextInput = new TextInput();  //error here

      searchInput.width = 200;

      searchInput.x=150;

      searchInput.y=450;

      searchKeyword=searchInput.text;

      addChild(searchInput);

       

      searchButton = new Button();   //error here

      searchButton.x = 380;

      searchButton.y = 450;

      searchButton.label = "Search";

      addChild(searchButton);

      }

       

      }

      }

       

      I appreciate any helps!