user310291
user310291

Reputation: 38180

I copied and paste sample code from adobe help and it doesn't work

I create a document class Main and use Adobe Sample code from

http://help.adobe.com/en_US/as3/components/WS5b3ccc516d4fbf351e63e3d118a9c65b32-7f9f.html

and I got error:

1046: Type was not found or was not a compile-time constant: TextInput.

I don't understand why:

package {

    import flash.display.MovieClip;
    import fl.controls.Label; 
    import fl.controls.TextInput; 

    public class Main extends MovieClip
    {



        public function Main()
        {   
            var nameLabel:Label = new Label(); 
            var nameTi:TextInput = new TextInput(); 
            var tf:TextFormat = new TextFormat(); 

            addChild(nameLabel); 
            addChild(nameTi); 

            nameTi.restrict = "A-Z .a-z"; 

            tf.font = "Georgia"; 
            tf.color = 0x0000CC; 
            tf.size = 16; 

            nameLabel.text = "Name: " ; 
            nameLabel.setSize(50, 25); 
            nameLabel.move(100,100); 
            nameLabel.setStyle("textFormat", tf); 
            nameTi.move(160, 100); 
            nameTi.setSize(200, 25); 
            nameTi.setStyle("textFormat", tf); 

        }

    }
}

Upvotes: 0

Views: 107

Answers (1)

weltraumpirat
weltraumpirat

Reputation: 22604

You need to include the referenced components. fl.control.TextInput is not part of the core library.
Check out this tutorial.

Upvotes: 1

Related Questions