# Need help creating simple component

**URL:** <https://forum.kirupa.com/t/need-help-creating-simple-component/293587>\
**Category:** flash\
**Created:** [July 31, 2009, 2:31am UTC](https://forum.kirupa.com/t/need-help-creating-simple-component/293587 "2009-07-31T02:31:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wmarcello](https://avatars.discourse-cdn.com/v4/letter/w/b5e925/32.png) [@wmarcello](https://forum.kirupa.com/u/wmarcello)\
**Post date:** [July 31, 2009, 2:31am UTC](https://forum.kirupa.com/t/need-help-creating-simple-component/293587/1 "2009-07-31T02:31:08Z")

</div>

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.

```auto

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.
