# Button: Will this ever work in AS3.0

**URL:** <https://forum.kirupa.com/t/button-will-this-ever-work-in-as3-0/324819>\
**Category:** flash\
**Created:** [September 10, 2011, 10:12am UTC](https://forum.kirupa.com/t/button-will-this-ever-work-in-as3-0/324819 "2011-09-10T10:12:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![felastine](https://avatars.discourse-cdn.com/v4/letter/f/50afbb/32.png) [@felastine](https://forum.kirupa.com/u/felastine)\
**Post date:** [September 10, 2011, 10:12am UTC](https://forum.kirupa.com/t/button-will-this-ever-work-in-as3-0/324819/1 "2011-09-10T10:12:44Z")

</div>

Hi there

I’m new to AS3.0. I know Java and some C++ so I think I can handle OOP good enough. But Flash is just something different.

Some years ago, in AS2.0, I created a simple button (think of that as a SimpleButton as in AS3.0). There is a **dynamic textfield** with instance name “ **displayText** ” in it. The idea is that I can reuse the button by just changing the action and text of the button.

In AS3.0, I’m trying to do something the same.

I have a FLA file created. The document class is called Main. Here is Main.as.

```auto

package {
    import flash.display.*;
    import MenuButton;
    public class Main extends MovieClip {
        public var bg:MainBg = new MainBg();
        public static var btn1:MenuButton = new MenuButton(500,500);
        public function Main() {
            addChild(bg);
            addChild(btn1);
        }
        
    }
}

```

Here is MenuButton.as.

```auto
package {
    import flash.display.SimpleButton;
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    public class MenuButton extends SimpleButton {
        public var masterMenu:MovieClip;
        public var menuToOpen:MovieClip;
        public function MenuButton(xPos:Number, yPos:Number):void {
            x = xPos;
            y = yPos;
            this.addEventListener(MouseEvent.CLICK, actionOnClick);
        }
        public function actionOnClick(e:MouseEvent):void {
            //do something
        }
    }
}

```

Well, I tried **this.displayText.text = “Something”** , but of course it doesn’t work. I tried accessing from the document class, i.e. **btn1.displayText.text = “Something”** , and it doesn’t work either.

Er… Hungry, thirsty and frustrated… How to make it work???

Thanks in advance.  
Felastine.
