我需要帮助大约QUOT;动作脚本3,公共功能与按钮和QUOT;脚本、按钮、动作、功能

2023-09-09 21:56:38 作者:你以为我刀枪不入啊

 公共功能PencereyiGizle(BTN:按钮)

{
....
....
}
 

我有一个问题 BTN:按钮

  

1046:类型找不到或没有被   编译时常:按钮..

 包
{
    进口的flash.display.MovieClip;
    进口flash.display.NativeWindow在;
    进口flash.display.NativeWindowInitOptions;
    进口对象类型:flash.events.Event;
    进口flash.events.MouseEvent;
    进口flash.display.SimpleButton;


    公共类PencereyiGizle扩展影片剪辑
    {
        公共变种natWindow:NativeWindow的=的新的NativeWindow(
        新的NativeWindowInitOptions());
        公共变种pencereyiAc_Btn:按钮;

        公共职能PencereyiGizle(往返:按钮)
        {
            pencereAc_Btn =来回;
            // Pencere ekleniyor
            natWindow.width = 500;
            natWindow.height = 400;
            natWindow.activate();
            natWindow.addEventListener(Event.CLOSING,pencereyiSakla);
            pencereyiAc_Btn.label =Pencereyi AC;
            pencereyiAc_Btn.addEventListener(的MouseEvent.MOUSE_DOWN,pencereyiAktifEt);
        }
        // pencereninkapanmasınıengelleyip pencereyi gizliyoruz;
        私有函数pencereyiSakla(五:事件):无效
        {
            即preventDefault();
            natWindow.visible = FALSE;
        }

        // gizlenen pencereyi tekrar aktif硬朗getiriyoruz
        私有函数pencereyiAktifEt(E:MouseEvent)方法:无效
        {
            natWindow.activate();
        }
    }

}

Ñ​​空气;

进口PencereyiGizle;

VAR FIRAT:PencereyiGizle =新PencereyiGizle();
的addChild(FIRAT);
 

然后,我得到这个问题1046:类型找不到或不是编译时间常数:按钮

我跟BTN一个问题:按钮

解决方案

你的问题是你的类PencereyiGizle正在寻找一个按钮传递在构造一个参考,你不是在做

  VAR FIRAT:PencereyiGizle =新PencereyiGizle();
的addChild(FIRAT);
 
按键精灵录制了5个脚本,如何设置可以每次随机运动其中一个脚本,随机循环

您需要通过一个按钮或者一个实例名称

  VAR FIRAT:PencereyiGizle =新PencereyiGizle(someButton);
的addChild(FIRAT);
 

,或创建一个新的按钮,并沿

传递

  VAR someButton:按钮=新的按钮
VAR FIRAT:PencereyiGizle =新PencereyiGizle(someButton);
的addChild(FIRAT);
 

Public function PencereyiGizle ( btn:Button )

{
....
....
}

I have a problem with the btn:Button

1046: Type was not found or was not a compile-time constant:Button..

package 
{
    import flash.display.MovieClip;
    import flash.display.NativeWindow;
    import flash.display.NativeWindowInitOptions;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.display.SimpleButton;


    public class PencereyiGizle extends MovieClip
    {
        public var natWindow:NativeWindow=new NativeWindow(
        new NativeWindowInitOptions());
        public var pencereyiAc_Btn:Button;

        public function PencereyiGizle(fro:Button)
        {
            pencereAc_Btn = fro;
            //Pencere ekleniyor
            natWindow.width = 500;
            natWindow.height = 400;
            natWindow.activate();
            natWindow.addEventListener(Event.CLOSING,pencereyiSakla);
            pencereyiAc_Btn.label = "Pencereyi Ac";
            pencereyiAc_Btn.addEventListener(MouseEvent.MOUSE_DOWN,pencereyiAktifEt);
        }
        //pencerenin kapanmasını engelleyip pencereyi gizliyoruz.;
        private function pencereyiSakla(e:Event):void
        {
            e.preventDefault();
            natWindow.visible = false;
        }

        //gizlenen pencereyi tekrar aktif hale getiriyoruz
        private function pencereyiAktifEt(e:MouseEvent):void
        {
            natWindow.activate();
        }
    }

}

N AIR;

import PencereyiGizle;

var firat:PencereyiGizle= new PencereyiGizle();
addChild(firat);

and then, i get that problem "1046: Type was not found or was not a compile-time constant:Button. "

I have a problem with the btn:Button

解决方案

you problem is your class PencereyiGizle is looking for a button to be passed as a reference in the constructor which you are not doing

var firat:PencereyiGizle= new PencereyiGizle();
addChild(firat);

you need to pass either an instance name of a button

var firat:PencereyiGizle= new PencereyiGizle( someButton );
addChild(firat);

or create a new button and pass it along

var someButton:Button = new button
var firat:PencereyiGizle= new PencereyiGizle( someButton );
addChild(firat);