0

Error 5000 "must subclass flash.display.MovieClip" / "must subclass flash.display.SimpleButton" I finally decided to ask after forum hopping for answers. Basically, when I extend MovieClip the error for the movie clip goes away but the simple button error shows up. When I extend simple button, the movie clip error appears. What is the simplest way to include both or otherwise make this work?

//psuedo code 

import flash.display.*;
public class classInSession extends MovieClip //or SimpleButton
{
    var Btn:SimpleButton;//This needs SimpleButton
    public function reception123() {

        stop();//This needs MovieClip
        Btn.enabled = true;//This needs SimpleButton
        Btn.addEventListener(MouseEvent.MOUSE_DOWN, goSomewhere);

        function goSomewhere(event:MouseEvent):void{
            gotoAndStop(1);//This also needs MovieClip
        }
    }
}
Dave
  • 44,275
  • 12
  • 65
  • 105
Syed
  • 79
  • 1
  • 8

2 Answers2

0

It doesn't make sense for something to be both a MovieClip (which is for animation) and a SimpleButton (which is for buttons).

What you want is a MovieClip which has a SimpleButton.

The code you posted does that, but I think your main problem is that you didn't actually create Btn, so it is null when that call is made (and therefore doesn't subclass SimpleButton):

  1. Your class should have a constructor;
  2. Inside the constructor, you create the button with Btn = new SimpleButton();.
Dave
  • 44,275
  • 12
  • 65
  • 105
  • A designed object has an implicit constructor, but indeed his `Btn` variable will not be filled, as it's declared elsewhere but the names of that MC's components. – Vesper Apr 02 '13 at 03:29
  • @Dave: I tried your suggestion of creating the button but now I also get error 1046 saying it does not recognize 'MouseEvent' in addition to the error 5000 of there being no subclass of SimpleButton. – Syed Apr 02 '13 at 06:47
  • @WalterWilliams so is `Btn` on the stage? If so, I think actionscript doesn't work like that; `Btn` will become a property of the root object for that frame (without a declaration), but I'm only familiar with using actionscript independently from an IDE (i.e. creating everything with code). As for the new error, you need to `import flash.events.*;` at the top. – Dave Apr 02 '13 at 10:40
0

I did a lot but I believe the arrow that hit the mark was unchecking "automatically declare stage instances" from the publish settings.

Syed
  • 79
  • 1
  • 8