views:

23

answers:

1
package
{
    import fl.controls.Button;
    import fl.controls.TextInput;
    public class MinRecord extends Sprite
    {
          private var recordBtn:Button;
          private var stopBtn:Button;
          private var textInput:TextInput;
...

When I run it reports:

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

Can someone point out what's wrong here?

+2  A: 

Did you add the TextInput and Button components to the library ?

  • Drag a TextInput component from the Components panel to the Library panel.
  • Drag a Button component from the Components panel to the Library panel.

Make sure that there are in your library.

These should be GUI components of Flash CS5.

Edit: I see you have not also set a document class or maybe not properly

The document class is the top level class that associates with your FLA when it is published as a SWF. When you click Test Movie or Publish and instance of this class is produced to the object on the highest level in your swf, allowing properties and methods to be accessed.

You want to deselect all objects on the main stage and click on a blank area. Then you will see the Property window with the Document Properties (width ,framerate etc) . You will be looking for the Document class box and inserting the name of your actionscript file. Say you had all your main code in Main.as you want to insert Main (no .as extenstion)

phwd
How to configure it myself since it's wrong now?
Drag a TextInput component from the Components panel to the Library panel. And do the same for the Button.
phwd
Thanks a lot ! It works now! Weird, why is this necessary?
The components are part of Flash CS5 as I said and not part of ActionScript 3 main library so you need to add it to the library for you to access it. It is meant to mainly work in Flash IDE.
phwd