1046:未找到类型或不是编译时常量:按钮

时间:2011-04-23 21:28:49

标签: actionscript-3

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();
        }
    }


}

IN AIR;

import PencereyiGizle;

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

然后,我得到那个问题“1046:找不到类型或者不是编译时常量:按钮。”

1 个答案:

答案 0 :(得分:3)

根据你的导入内容,我认为你想使用SimpleButton类而不是Button类。 (这是一个闪存组件)

或者您缺少此导入

import fl.controls.Button;

这是按钮组件上adobe的artilce。 http://www.adobe.com/devnet/flash/quickstart/button_component_as3.html