PDA

View Full Version : Need help creating simple component



wmarcello
July 30th, 2009, 10:31 PM
I'm trying to create a simple component that extends the MovieClip class. It's just a basic component... no live preview, no extending UIComponent, etc.

What is giving me problems is that I am trying to include a prebuilt Flash component within my own custom component, and it's throwing errors. Here is my stripped down code.



package
{
import flash.display.MovieClip;
import fl.controls.Slider;

public class Foo extends MovieClip
{
private var _mySlider:Slider;

public function Foo()
{ }
}
}
On stage I have the component built from various MovieClips, and it also includes a prebuilt Slider component. Now, if I try to right click my main MovieClip in the Library to give it its linkage name and component definition, I am greeted with weird errors. The weirdest error is:


Actionscript 2.0 class scripts may only define class or interface constructs.The offending line seems to be the _mySlider variable declaration. If I comment that out the errors go away, but then I can't do anything with the Slider on stage. Can anybody help? This is driving me mad. Thanks.