Flash 我如何通过oop编写此代码

Flash 我如何通过oop编写此代码,flash,actionscript-3,oop,Flash,Actionscript 3,Oop,我有一个按钮叫profile\u btn 我想通过OOP来编写这段代码 profile_btn.addEventListener(MouseEvent.CLICK,profile_btnClickHandler); function profile_btnClickHandler(ev:MouseEvent):void { //The actual code to jump to a specific frame this.gotoAndPlay('play'); } 此外,如

我有一个按钮叫
profile\u btn

我想通过OOP来编写这段代码

profile_btn.addEventListener(MouseEvent.CLICK,profile_btnClickHandler);
function profile_btnClickHandler(ev:MouseEvent):void
{
    //The actual code to jump to a specific frame
    this.gotoAndPlay('play');
}

此外,如何通过actionscript3将与任何对象无关的三个类包含到特定帧中?如果您有一个类(在链接中指定的名称)配置文件,则可以使用以下内容

var myButton:profile_btn =new profile_btn()
如果要将其添加到舞台,请使用:

stage.addChild(myButton);
因此,您的代码可能看起来像

var myButton:profile_btn =new profile_btn()

stage.addChild(myButton);

myButton.addEventListener(MouseEvent.CLICK,profile_btnClickHandler);

function profile_btnClickHandler(ev:MouseEvent):void
{
    //The actual code to jump to a specific frame
    this.gotoAndPlay('play');
}

第7 1046行:找不到类型或类型不是编译时常量:profile_btn.profile_btn应该是stage上按钮的实例名…..对于刚才提到的错误u。在profile_btn类型的对象上声明了实例名'profile_btn',但在类型的对象上使用实例名'profile_btn'时存在冲突flash.display.SimpleButton.它是库中btn的名称,链接到此按钮的类我只想动态创建按钮并转到我想要的框架“向一个框架添加3个类”没有意义。而且,我认为在新线程中提出新问题比编辑旧线程更好。我得到以下错误:错误#1023:发生堆栈溢出。在flash.display::MovieClip/get currentScene()在fl.motion::AnimatorBase/handleEnterFrame()在btn_profile()以及如何通过ActionScript3将该类包含在特定帧中我不明白,您所要做的就是将按钮的“class”值设置为profile_btn。其余代码将自动引用并添加它。Ohh确保您选中“导出到第1帧”和“导出到AS”。我复制此代码而不进行编辑,它的工作没有错误,但btn没有出现,如果我想让它出现在特定的帧中,我如何才能做到这一点,请注意库中的按钮,因为我使用addChild方法时没有将其放在后台