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
分享到:
相关推荐
ascb包,直接解压放在src目录下。其中具体用法,还是得找些文档
flash actionscript3 as3游戏开发教程合集(2本经典合一)+AS3CBLibrary_ascb包.zip
但是大多数的图形用Graphics API还是很难画出的,AS3CBLibrary (http://www.rightactionscript.com/ascb) 提供了一个 ascb.drawing.Pen 类。Pen 类是Graphics 类的代理(包装)类。你可以构造一个新的Pen 实例然后...
通过ASCB包,可以在FLEX环境中对字符、数字、日期等进行各种快捷的函数处理。如字符转为日期等。
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.
但是大多数的图形用Graphics API还是很难画出的,AS3CBLibrary (http://www.rightactionscript.com/ascb) 提供了一个 ascb.drawing.Pen 类。Pen 类是Graphics 类的代理(包装)类。你可以构造一个新的Pen 实例然后...
安科瑞ASCB1系列智能微型断路器样本,
安科瑞ASCB1系列智能微型断路器产品使用,安装说明书
AS3CBLibrary资源包,ascb包,各种as类
一款带有代码的flash小游戏,直接下载,马上可以打开,不用解压缩.
本文档告诉读者怎样将ASP封装成DLL,需要使用word2007打开文档。
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))<>AscB(MidB(Str,j,1)) then InString=0 Exit For end if next if InString<>0 then Exit Function end if next End Function Private Sub Class_Terminate form....
记得在建立一个文件夹"updata" saveannounce_upload.asp 上传页 ------------------------------------ <html> <head> <style type="text/css"> body {font-size:9pt;} input {font-size:9pt;} </style> ...
@LANGUAGE=”JScript” CODEPAGE=”936″%> [removed] Function bytes2BSTR(vIn) strReturn = “” For i = 1 To LenB(vIn) ThisCharCode = AscB(MidB(vIn,i,1)) If ThisCharCode < &H80 Then ...
ASCB 鞍山银行 ARCU 安徽省农村信用社 BJBANK 北京银行 BJRCB 北京农商行 BSB 包商银行 BOHAIB 渤海银行 BDCBANK 保定银行 BOCFCB 中银富登村镇银行
[removed] Function bytes2BSTR(vIn) strReturn = “” For i = 1 To LenB(vIn) ThisCharCode = AscB(MidB(vIn,i,1)) If ThisCharCode < &H80 Then strReturn = strReturn & Chr(ThisCharCode)...
Function bytes2BSTR(vIn)strReturn = “”For i = 1 To LenB(vIn)ThisCharCode = AscB(MidB(vIn,i,1))If ThisCharCode < &H80 ThenstrReturn = strReturn & Chr(ThisCharCode)ElseNextCharCode = AscB(MidB(vIn,...
只在xp 环境下试过,x86系统应该问题不大,x64可能不支持,使用前先执行SocketReg.exe对组件进行注册,然后就可以在网页脚本中使用套接字了,这个组件是99年国外一公司开发的,本意是用来实现http ,ftp,smtp pop3...