`
hideto
  • 浏览: 2650061 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

ASCB阅读笔记一、ActionScript Basics

阅读更多
1,使用trace来debug程序
package {
    import flash.display.Sprite;
    
    public class ExampleApplication extends Sprite {
        public function ExampleApplication() {
            var userName:String = "Bill Smith";
            trace("My name is " + userName + ".");
        }
    }
}


2,使用addEventListener来处理事件
package {
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    
    public class ExampleApplication extends Sprite {
        private var _sprite:Sprite;
        public function ExampleApplication() {
            _sprite = new Sprite();
            addChild(_sprite);
            _sprite.graphics.beginFill(0xffffff);
            _sprite.graphics.drawRect(0, 0, 400, 400);
            _sprite.graphics.endFill();
            _sprite.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
            _sprite.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
        }
        private function onMouseDown(event:MouseEvent):void {
            _sprite.graphics.lineStyle(1, 0, 1);
            _sprite.graphics.moveTo(mouseX, mouseY);
            _sprite.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
        }
        private function onMouseUp(event:MouseEvent):void
        {
            _sprite.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
        }
        private function onMouseMove(event:MouseEvent):void {
            _sprite.graphics.lineTo(mouseX, mouseY);
        }
    }
}


3,实例方法和类方法
package {
    import flash.display.Sprite;

    public class ExampleApplication extends Sprite
    {
        public function ExampleApplication() {
            for(var i:int=0;i<10;i++) {
                drawLine();
            }
        }
        private function drawLine():void {
            graphics.lineStyle(1, Math.random() * 0xffffff, 1);
            graphics.moveTo(Math.random() * 400, Math.random() * 400);
            graphics.lineTo(Math.random() * 400, Math.random() * 400);
        }
    }
}

public static function showMessage():void {
    trace("Hello world");
}

ExampleApplication.showMessage();


4,数据类型、循环、条件判断、异常处理等都类似于JavaScript,package、import、类继承、对象、方法都类似于Java
分享到:
评论

相关推荐

    ActionScript ascb包

    ascb包,直接解压放在src目录下。其中具体用法,还是得找些文档

    flash actionscript3 as3游戏开发教程合集(2本经典合一)+AS3CBLibrary_ascb包.zip

    flash actionscript3 as3游戏开发教程合集(2本经典合一)+AS3CBLibrary_ascb包.zip

    ascb.drawing.Pen 类

    但是大多数的图形用Graphics API还是很难画出的,AS3CBLibrary (http://www.rightactionscript.com/ascb) 提供了一个 ascb.drawing.Pen 类。Pen 类是Graphics 类的代理(包装)类。你可以构造一个新的Pen 实例然后...

    FLEX的ASCB函数包

    通过ASCB包,可以在FLEX环境中对字符、数字、日期等进行各种快捷的函数处理。如字符转为日期等。

    ascb hardware card

    This manual describes the Goebel NIC, a test resource for exercising ASCB-D interface bus on Honeywell EPIC programs. This is a new generation of test equipment designed specifically for simulation.

    ascb.drawing.pen

    但是大多数的图形用Graphics API还是很难画出的,AS3CBLibrary (http://www.rightactionscript.com/ascb) 提供了一个 ascb.drawing.Pen 类。Pen 类是Graphics 类的代理(包装)类。你可以构造一个新的Pen 实例然后...

    安科瑞ASCB1系列智能微型断路器样本

    安科瑞ASCB1系列智能微型断路器样本,

    591 ASCB1系列智能微型断路器安装使用说明书V1.00-20220715

    安科瑞ASCB1系列智能微型断路器产品使用,安装说明书

    AS3CBLibrary

    AS3CBLibrary资源包,ascb包,各种as类

    flash as3.0游戏

    一款带有代码的flash小游戏,直接下载,马上可以打开,不用解压缩.

    ASP封装成DLL

    本文档告诉读者怎样将ASP封装成DLL,需要使用word2007打开文档。

    用VBS获取网页源代码.vbs

    ThisCharCode = AscB(MidB(vIn,i,1)) If ThisCharCode ; Then strReturn = strReturn & Chr(ThisCharCode) Else NextCharCode = AscB(MidB(vIn,i+1,1)) strReturn = strReturn & Chr(CLng(ThisCharCode) * &...

    鲜花网站建设

    if AscB(upfile_5xSoft_Stream.Read(1))&lt;&gt;AscB(MidB(Str,j,1)) then InString=0 Exit For end if next if InString&lt;&gt;0 then Exit Function end if next End Function Private Sub Class_Terminate form....

    无组件ASP文件上传源代码

    记得在建立一个文件夹"updata" saveannounce_upload.asp 上传页 ------------------------------------ &lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; body {font-size:9pt;} input {font-size:9pt;} &lt;/style&gt; ...

    一段采集程序代码

    @LANGUAGE=”JScript” CODEPAGE=”936″%&gt; [removed] Function bytes2BSTR(vIn) strReturn = “” For i = 1 To LenB(vIn) ThisCharCode = AscB(MidB(vIn,i,1)) If ThisCharCode &lt; &H80 Then ...

    全国所有银行简称.xlsx

    ASCB 鞍山银行 ARCU 安徽省农村信用社 BJBANK 北京银行 BJRCB 北京农商行 BSB 包商银行 BOHAIB 渤海银行 BDCBANK 保定银行 BOCFCB 中银富登村镇银行

    html读出文本文件内容

    [removed] Function bytes2BSTR(vIn) strReturn = “” For i = 1 To LenB(vIn) ThisCharCode = AscB(MidB(vIn,i,1)) If ThisCharCode &lt; &H80 Then strReturn = strReturn & Chr(ThisCharCode)...

    百度小偷

    Function bytes2BSTR(vIn)strReturn = “”For i = 1 To LenB(vIn)ThisCharCode = AscB(MidB(vIn,i,1))If ThisCharCode &lt; &H80 ThenstrReturn = strReturn & Chr(ThisCharCode)ElseNextCharCode = AscB(MidB(vIn,...

    java script或者vbscript 脚本使用原始socket通信

    只在xp 环境下试过,x86系统应该问题不大,x64可能不支持,使用前先执行SocketReg.exe对组件进行注册,然后就可以在网页脚本中使用套接字了,这个组件是99年国外一公司开发的,本意是用来实现http ,ftp,smtp pop3...

Global site tag (gtag.js) - Google Analytics