Hey, I'm new to Flex Builder and trying to create a button at runtime in an
ActionScript project.  

 

Flex Builder won't compile the AS 3 code below because the 'type is not
found'.

 

I know in flash we have to drag the component to the library or it won't
show up on stage. Is there a comparable procedure using Flex Builder?  Do I
need to attach a .fla to my ActionScript project in Flex Builder? (if so
how?)

 

package {

            import flash.display.Sprite;

            import mx.controls.Button;                          // thought
this should help the compiler find the runtime

            

            public class Generic_DB extends Sprite {

                                                

            public function Generic_DB() {     

                    var stopButton:Button;               // Type is not
found or not a compile-time constant:Button

                    stopButton = new Button();        //  Call to a possibly
undefined method 'Button'

                    this.addChild(stopButton);


            }

            }

}

 

I got to this point from the code listing at:
http://labs.adobe.com/wiki/index.php/Flex_Framework:tutorials:runtime_compon
ents

 

Thanks,

mike

 

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to