动作脚本3 - 课堂全屏

时间:2013-12-13 10:35:33

标签: actionscript-3 flash package fullscreen

请注意,对于Actioncript 3来说,我是一个新手,而且我在AS2中能够做到的合理能力很多我现在不能在AS3中,我的挫败感!好的,我正在充实一个简单的拖放并在Flash中装饰应用程序。我想使用外部动作脚本类/包来允许它从我的桌面全屏,我陷入困境,构造函数错误被抛出并且各种各样。任何人都可以给出任何指示吗?

package {
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
        import flash.display.Stage;
        import flash.display.StageDisplayState;

    public class fullmode extends MovieClip {
         public function fullmode() {
             fullbtn.addEventListener(MouseEvent.CLICK, fullScreen); 
         }// btn declared - - - - - - - - 

         //public function fullmode(event:MouseEvent):void {
         stage.displayState=StageDisplayState.FULL_SCREEN;
         }

    }




     //--------------------- drag item
     public class DragDrop extends MovieClip {
         public function DragDrop() {
            dragme.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
            dragme.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
        }

        private function mouseDownHandler(evt:MouseEvent):void {
            var obj = evt.target;
            obj.startDrag();
         }
         private function mouseUpHandler(evt:MouseEvent):void {
            var obj = evt.target;
             obj.stopDrag();
        }
    }
 }

谢天谢地!

1 个答案:

答案 0 :(得分:0)

你有一些语法错误/拼写错误,我已在下面修复它们:

package 
{
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    import flash.display.Stage;
    import flash.display.StageDisplayState;

    public class Fullmode extends MovieClip 
    {
        public function Fullmode() 
        {
            fullbtn.addEventListener(MouseEvent.CLICK, fullScreen); 
        }

        private function fullScreen(event:MouseEvent):void 
        {
            stage.displayState = StageDisplayState.FULL_SCREEN;
        }
    }
}

标准做法规定您的班级名称应大写,因此Fullmode而不是fullmode

此外,您已将MouseEvent.CLICK侦听器命名为与您的类相同,而不是您想要的名称。