Trying to Create dynamic buttons in AS3

Hi everyone,

            still continuing to fumble my way with as3. I'm trying to write a class that will create my movieclip buttons dynamically, and assign some text to a dynamic text box inside it, based on the argument I pass to the method in this class. I've got a movieclip in my library with the linkage shown below - 

And I’ve got this so far in its own AS file -



package com.willgoldstone.tutorials {
    
    import flash.display.MovieClip;
    
    public class Mybtn extends MovieClip{

        public var btnName:String;
  
     public function Mybtn(n:String) {
       btnName = n;
       create();
     }
    
    private function create(){
        
        trace("new button that is named "+btnName+" has been made, thank you");
        
        var button1 : MovieClip = new MovieClip();
        addChild(button);
        button1.textSnapshot = btnName;
        
    }
    }
}

And on frame 1 of a new as3 FLA file, I have this -


import com.willgoldstone.tutorials.Mybtn;

var button1:Mybtn = new Mybtn("Winnifred");

Its giving the following errors in output -

And I’m really not sure what this all means!

All I want to do is instantiate a copy of this movieClip in my library and assign a value to its dynamic text field… should be fairly simple?!

Any help really appreciated!

     Many thanks

                  Will