??xml version="1.0" encoding="utf-8" standalone="yes"?>在线观影网站,成人在线视频一区,国产精品精品视频http://www.aygfsteel.com/gembin/category/33694.html<font color="red">OSGi, Eclipse Equinox, ECF, Virgo, Gemini, Apache Felix, Karaf, Aires, Camel, Eclipse RCP</font><br/><br/> <font color="green">HBase, Hadoop, ZooKeeper, Cassandra</font><br/><br/> <font color="blue">Flex4, AS3, Swiz framework, GraniteDS, BlazeDS etc.</font><br/><br/> <font color="black"> There is nothing that software can't fix. Unfortunately, there is also nothing that software can't completely fuck up. That gap is called talent.</font> <br/><br/> <a >About Me</a> <script type="text/javascript" src="http://platform.linkedin.com/in.js"></script><script type="in/share" data-counter="right"></script> zh-cnSat, 21 Jul 2012 20:48:27 GMTSat, 21 Jul 2012 20:48:27 GMT60Flash 3d Sokoban Prototype With Alternativa3dhttp://www.aygfsteel.com/gembin/archive/2012/07/21/383679.htmlgembingembinSat, 21 Jul 2012 15:03:00 GMThttp://www.aygfsteel.com/gembin/archive/2012/07/21/383679.htmlhttp://www.aygfsteel.com/gembin/comments/383679.htmlhttp://www.aygfsteel.com/gembin/archive/2012/07/21/383679.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/383679.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/383679.html阅读全文

gembin 2012-07-21 23:03 发表评论
]]>
Flash 3d Sokoban Prototype With Alternativa3d Textured Versionhttp://www.aygfsteel.com/gembin/archive/2012/07/21/383678.htmlgembingembinSat, 21 Jul 2012 15:00:00 GMThttp://www.aygfsteel.com/gembin/archive/2012/07/21/383678.htmlhttp://www.aygfsteel.com/gembin/comments/383678.htmlhttp://www.aygfsteel.com/gembin/archive/2012/07/21/383678.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/383678.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/383678.html阅读全文

gembin 2012-07-21 23:00 发表评论
]]>
Flash 3d Sokoban Prototype With Alternativa3d Textured Versionhttp://www.aygfsteel.com/gembin/archive/2012/07/21/383677.htmlgembingembinSat, 21 Jul 2012 14:58:00 GMThttp://www.aygfsteel.com/gembin/archive/2012/07/21/383677.htmlhttp://www.aygfsteel.com/gembin/comments/383677.htmlhttp://www.aygfsteel.com/gembin/archive/2012/07/21/383677.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/383677.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/383677.htmlEmanuele Feronato added textures and some environment to Sokoban game prototype made with Flare3D.

I reproduced this prototype on Alternativa3D engine. And here you can find it:

Generally this port is bit different from Emanuele’s version. I can’t find information about feature like SkyBox in Alternativa3D, so this feature coded manually. Another difference is camera behavior. Emanuele binds camera to object and during rotations player object stand still and only camera fly around by its orbit. In Alternativa3d version object rotates too, this allow us to face player object it to it’s current direction. Camera is not binded to the object directly it is binded to object container and we can manipulate with player object in container, add animations, rotations etc. But both variants are good I think.


Here is source code:

package  { 	import alternativa.Alternativa3D; 	import alternativa.engine3d.containers.*; 	import alternativa.engine3d.controllers.*; 	import alternativa.engine3d.core.Camera3D; 	import alternativa.engine3d.core.Clipping; 	import alternativa.engine3d.core.Debug; 	import alternativa.engine3d.core.MipMapping; 	import alternativa.engine3d.core.MouseEvent3D; 	import alternativa.engine3d.core.Object3D; 	import alternativa.engine3d.core.Object3DContainer; 	import alternativa.engine3d.core.Sorting; 	import alternativa.engine3d.core.View; 	import alternativa.engine3d.materials.FillMaterial; 	import alternativa.engine3d.materials.TextureMaterial; 	import alternativa.engine3d.objects.Sprite3D; 	import alternativa.engine3d.primitives.Box; 	import alternativa.engine3d.primitives.Plane; 	import alternativa.engine3d.primitives.Sphere; 	 	import flash.display.BitmapData; 	import flash.display.BlendMode; 	import flash.display.Sprite; 	import flash.display.StageAlign; 	import flash.display.StageQuality; 	import flash.display.StageScaleMode; 	import flash.events.Event; 	import flash.events.KeyboardEvent; 	import flash.filters.GlowFilter; 	import flash.geom.ColorTransform; 	import flash.geom.Vector3D; 	import flash.sampler.NewObjectSample; 	import flash.system.Capabilities; 	import flash.ui.Keyboard; 		 	[SWF(backgroundColor="#000000", frameRate="100", width="640", height="480")] 	public class alternativa3dSokoban extends Sprite  	{ 		private const CUBESIZE:Number=10; 		//embeding textures images 		[Embed(source="resource/crateTextureImg.jpg")] static private const crateTextureImg:Class; 		[Embed(source="resource/floorTextureImg.png")] static private const floorTextureImg:Class; 		[Embed(source="resource/crateTopTextureImg.jpg")] static private const crateTopTextureImg:Class; 		[Embed(source="resource/crateTopGoalTextureImg.jpg")] static private const crateTopGoalTextureImg:Class; 		[Embed(source="resource/wallTextureImg.png")] static private const wallTextureImg:Class; 		[Embed(source="resource/goalTextureImg.jpg")] static private const goalTextureImg:Class; 		[Embed(source="resource/playerTextureImg.jpg")] static private const playerTextureImg:Class; 		[Embed(source="resource/backBitmapImg.jpg")] static private const backTextureImg:Class; 		[Embed(source="resource/backBottomBitmapImg.jpg")] static private const backBottomTextureImg:Class;  		// sokobal demo level and player position 		private var levels:Array=[[1,1,1,1,0,0,0,0],[1,0,0,1,1,1,1,1],[1,0,2,0,0,3,0,1],[1,0,3,0,0,2,4,1],[1,1,1,0,0,1,1,1],[0,0,1,1,1,1,0,0]]; 		private var playerCol:uint; 		private var playerRow:uint; 		private var playerRotation:Number=0; 		private var playerAngle:Number=0; 		private var playerMovement:Number=0; 		private var dRow:int; 		private var dCol:int; 		 		// alternativa3d  engine variables 		private var camera:Camera3D; 		private var controller:SimpleObjectController; 		private var container:ConflictContainer;			 		private var frame:Sprite = new Sprite(); 		public var player:Sphere;// Sphere primitive representing the player 		public var cplayer:SimpleObjectController; //controller for player object 		public var conplayer:Object3DContainer; //container for player 		private var movingCrate:Box;// cube primitive representing the moving crate		 			 		// textures		 		private var crateTexture:TextureMaterial = new TextureMaterial(new crateTextureImg().bitmapData); 		private var floorTexture:TextureMaterial = new TextureMaterial(new floorTextureImg().bitmapData); 		private var crateTopTexture:TextureMaterial = new TextureMaterial(new crateTopTextureImg().bitmapData); 		private var crateTopGoalTexture:TextureMaterial = new TextureMaterial(new crateTopGoalTextureImg().bitmapData); 		private var wallTexture:TextureMaterial = new TextureMaterial(new wallTextureImg().bitmapData); 		private var goalTexture:TextureMaterial = new TextureMaterial(new goalTextureImg().bitmapData); 		private var playerTexture:TextureMaterial = new TextureMaterial(new playerTextureImg().bitmapData); 		// SkyBox textures 		private var backTexture:TextureMaterial = new TextureMaterial(new backTextureImg().bitmapData); 		private var backBottomTexture:TextureMaterial = new TextureMaterial(new backBottomTextureImg().bitmapData); 						 		public function alternativa3dSokoban()  		{			 			stage.scaleMode = StageScaleMode.NO_SCALE; 			stage.align = StageAlign.TOP_LEFT; 			stage.quality = StageQuality.BEST; 			 			// Camera 			camera = new Camera3D(); 			camera.view = new View(640, 480); 			addChild(camera.view); 						 			// Camera controller 			controller = new SimpleObjectController(stage, camera, 200, 3); 			 			// Root object 			container = new ConflictContainer(); 			container.resolveByAABB = true; 			container.resolveByOOBB = true; 			 			//Player controller 			conplayer = new Object3DContainer(); 			cplayer = new SimpleObjectController(stage, player, 3); 			 //i am not shure about SkyBox in Alternativa and will prepare it manually 			var backBottom:Plane = new Plane(200*CUBESIZE/2,200*CUBESIZE/2); 			backBottom.setMaterialToAllFaces(backBottomTexture); 			backBottom.x = 0; 			backBottom.y = -100*CUBESIZE/2; 			backBottom.z = 0; 			backBottom.rotationX = 90*Math.PI/180; 			container.addChild(backBottom); 			 			var backLeft:Plane = new Plane(200*CUBESIZE/2,200*CUBESIZE/2); 			backLeft.setMaterialToAllFaces(backTexture); 			backLeft.x = 0; 			backLeft.y = 0; 			backLeft.z = 100*CUBESIZE/2; 			container.addChild(backLeft);  			var backRight:Plane = new Plane(200*CUBESIZE/2,200*CUBESIZE/2); 			backRight.setMaterialToAllFaces(backTexture); 			backRight.x = 0; 			backRight.y = 0; 			backRight.z = -100*CUBESIZE/2; 			container.addChild(backRight);  			var backFront:Plane = new Plane(200*CUBESIZE/2,200*CUBESIZE/2); 			backFront.setMaterialToAllFaces(backTexture); 			backFront.x = -100*CUBESIZE/2; 			backFront.y = 0; 			backFront.z = 0; 			backFront.rotationY = 90*Math.PI/180; 			container.addChild(backFront);  			var backBack:Plane = new Plane(200*CUBESIZE/2,200*CUBESIZE/2); 			backBack.setMaterialToAllFaces(backTexture); 			backBack.x = 100*CUBESIZE/2; 			backBack.y = 0; 			backBack.z = 0; 			backBack.rotationY = 90*Math.PI/180; 			container.addChild(backBack); // end SkyBox 			 			var box:Box; 			/* 			[[1,1,1,1,0,0,0,0], 			 [1,0,0,1,1,1,1,1], 			 [1,0,2,0,0,3,0,1], 			 [1,0,3,0,0,2,4,1], 			 [1,1,1,0,0,1,1,1], 			 [0,0,1,1,1,1,0,0]]; 			*/ 			// level construction 			for (var i:uint=0; i<6; i++)  			{ 				for (var j:uint=0; j<8; j++)  				{ 					switch (levels[i][j])  					{ 						case 0 : 							box = new Box(CUBESIZE,CUBESIZE/2,CUBESIZE,1,1); 							box.setMaterialToAllFaces(floorTexture); 							box.x = CUBESIZE*j; 							box.y = 0; 							box.z = CUBESIZE*i; 							container.addChild(box); 							break; 						case 1 : 							box = new Box(CUBESIZE,CUBESIZE/2,CUBESIZE,1); 							box.setMaterialToAllFaces(floorTexture); 							box.x = CUBESIZE*j; 							box.y = 0; 							box.z = CUBESIZE*i; 							container.addChild(box); 							 							box = new Box(CUBESIZE,CUBESIZE,CUBESIZE,1); 							box.setMaterialToAllFaces(wallTexture); 							box.x = CUBESIZE*j; 							box.y = CUBESIZE*3/4; 							box.z = CUBESIZE*i; 							container.addChild(box); 							break; 						case 2 : 							box = new Box(CUBESIZE,CUBESIZE/2,CUBESIZE,1); 							box.setMaterialToAllFaces(goalTexture); 							box.x = CUBESIZE*j; 							box.y = 0; 							box.z = CUBESIZE*i; 							container.addChild(box); 							break; 						case 3 : 							box = new Box(CUBESIZE,CUBESIZE/2,CUBESIZE,1); 							box.setMaterialToAllFaces(floorTexture); 							box.x = CUBESIZE*j; 							box.y = 0; 							box.z = CUBESIZE*i; 							container.addChild(box); 							box = new Box(CUBESIZE,CUBESIZE,CUBESIZE,1); 							box.name = "crate_"+i+"_"+j; 							box.setMaterialToAllFaces(crateTexture); 							box.x = CUBESIZE*j; 							box.y = CUBESIZE*3/4; 							box.z = CUBESIZE*i; 							box.rotationX -= 90*Math.PI/180; 							// top of the crate 							box.faces[4].material=crateTopTexture; 							box.faces[5].material=crateTopTexture;  							container.addChild(box); 							break; 						case 4 : 							box = new Box(CUBESIZE,CUBESIZE/2,CUBESIZE,1); 							box.setMaterialToAllFaces(floorTexture); 							box.x = CUBESIZE*j; 							box.y = 0; 							box.z = CUBESIZE*i; 							container.addChild(box); 														 							player = new Sphere(CUBESIZE/2,16,16,false,playerTexture);  							conplayer.addChild(player); 							conplayer.visible = true; 							conplayer.x = CUBESIZE*j; 							conplayer.y = CUBESIZE*3/4; 							conplayer.z = CUBESIZE*i; 							conplayer.rotationX -= 90*Math.PI/180; 							container.addChild(conplayer); 							playerCol=j; 							playerRow=i; 							break; 					} 				} 			}  			// Adding camera 			container.addChild(camera); 			 			// View frame 			addChild(frame);												 			onResize();		 			stage.addEventListener(Event.ENTER_FRAME, updateEvent);			 			stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDwn);		 			stage.addEventListener(Event.RESIZE, onResize); 		}  		private function onKeyDwn(e:KeyboardEvent):void  		{ 			if (playerRotation==0&&playerMovement==0)  			{ 				switch (e.keyCode)  				{ 					case Keyboard.LEFT : 						playerRotation=+9; 						playerAngle+=90; 						break; 					case Keyboard.RIGHT : 						playerRotation=-9; 						playerAngle-=90; 						break; 					case Keyboard.UP : 						movingCrate=null; 						playerAngle=Math.round(conplayer.rotationY*180/Math.PI)%360; 						if (playerAngle<0)  						{ 							playerAngle+=360; 						} 						// we have to determine the difference between current row and column 						// and the new row and column according to player heading 						switch (playerAngle)  						{ 							case 0 : 								dRow=0; 								dCol=-1; 								break; 							case 90 : 								//dRow=-1; 								dRow=1; 								dCol=0; 								break; 							case 180 : 								dRow=0; 								dCol=1; 								break; 							case 270 : 								//dRow=1; 								dRow=-1; 								dCol=0; 								break; 						} 						if (levels[playerRow+dRow][playerCol+dCol]==0||levels[playerRow+dRow][playerCol+dCol]==2)  						{ 							// the player can move 							playerMovement=-CUBESIZE/10; 						}  						else  						{ 							if (levels[playerRow+dRow][playerCol+dCol]==3||levels[playerRow+dRow][playerCol+dCol]==5) { 								if (levels[playerRow+2*dRow][playerCol+2*dCol]==0||levels[playerRow+2*dRow][playerCol+2*dCol]==2) { 									// the player can move and can push a crate 									movingCrate=container.getChildByName("crate_"+(playerRow+dRow)+"_"+(playerCol+dCol))as Box; 									playerMovement=-CUBESIZE/10; 								} 							} 						} 						break;  				} 			} 		}   		public function updateEvent(e:Event):void  		{		 				if (playerRotation)  				{ 					conplayer.rotationY+=playerRotation*Math.PI/180; 					 					if (Math.abs(Math.round(conplayer.rotationY*180/Math.PI))%90==0) 					{ 						playerRotation=0; 					} 				} 				 				if (playerMovement)  				{					 					switch (playerAngle)  					{ 					case 0 : 						conplayer.x += playerMovement; 						player.rotationY -= 18*Math.PI/180; 					break; 					case 90 : 						conplayer.z += -playerMovement; 						player.rotationY -= 18*Math.PI/180; 					break; 					case 180 : 						conplayer.x += -playerMovement; 						player.rotationY -= 18*Math.PI/180; 						break; 					case 270 : 						conplayer.z += playerMovement; 						player.rotationY -= 18*Math.PI/180; 						break; 					} 					 					if (movingCrate)  					{ 						switch (playerAngle)  						{ 							case 0 : 								movingCrate.x += playerMovement; 								break; 							case 90 : 								movingCrate.z += -playerMovement; 								break; 							case 180 : 								movingCrate.x += -playerMovement; 								break; 							case 270 : 								movingCrate.z += playerMovement; 								break; 						} 					}  					// we need this to know if the player stopped on the destination tile 					if ((playerAngle%180==0&&(Math.round(conplayer.x*10)/10)%CUBESIZE==0)||(playerAngle%180!=0&&(Math.round(conplayer.z*10)/10)%CUBESIZE==0))  					{ 						playerMovement=0; 						levels[playerRow+dRow][playerCol+dCol]+=4; 						levels[playerRow][playerCol]-=4; 						if (movingCrate) { 							levels[playerRow+2*dRow][playerCol+2*dCol]+=3; 							if (levels[playerRow+2*dRow][playerCol+2*dCol]==5) { 								// changing materials on the fly 								movingCrate.setMaterialToAllFaces(crateTexture); 								// top of the crate on goal 								movingCrate.faces[4].material=crateTopGoalTexture; 								movingCrate.faces[5].material=crateTopGoalTexture;								  							} 							else  							{ 								//movingCrate.setMaterialToAllFaces(crateMaterial); 								movingCrate.setMaterialToAllFaces(crateTexture); 								// top of the crate 								movingCrate.faces[4].material=crateTopTexture; 								movingCrate.faces[5].material=crateTopTexture;								 							} 							levels[playerRow+dRow][playerCol+dCol]-=3; 							movingCrate.name="crate_"+(playerRow+2*dRow)+"_"+(playerCol+2*dCol); 						} 						playerCol+=dCol; 						playerRow+=dRow; 					} 				}  				onEnterFrame(); 		}			  		public function correct_camera_angles():void 		{ 			//set camera position 			var r:Number = 10*CUBESIZE/3;			 			var a:Number = -conplayer.rotationY; 			var cx:Number = conplayer.x+Math.cos(a)*r; 			var cz:Number = conplayer.z+Math.sin(a)*r; 			var cy:Number = conplayer.y+r;			 			controller.setObjectPosXYZ(cx,cy,cz); 			 			//look at player box 			controller.lookAtXYZ(conplayer.x,conplayer.y,conplayer.z); 			 			//correct camera angles			 				var cprotY:Number; 				 				cprotY=Math.round(conplayer.rotationY*180/Math.PI)%360;			 				if (cprotY<0)  				{ 					cprotY+=360; 				} 				if (cprotY>180) 				{ 					camera.rotationX = camera.rotationX + (90*Math.PI/180)*Math.sin((cprotY%180)*Math.PI/180); 				}										 				camera.rotationY = camera.rotationY+90*Math.PI/180-conplayer.rotationY; 		} 		 		public function onEnterFrame(e:Event = null):void  		{ 			controller.update(); 			correct_camera_angles(); 			cplayer.update(); 			camera.render();		 		} 		  		public function onResize(e:Event = null):void  		{ 			//here you can add border size for view 			var pd:Number = 0; 			camera.view.width = stage.stageWidth - pd*2; 			camera.view.height = stage.stageHeight - pd*2; 			camera.view.x = pd; 			camera.view.y = pd; 			 			frame.graphics.clear(); 			frame.graphics.beginFill(0x000000, 0); 			frame.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight); 			//frame.graphics.lineStyle(0, 0x7F7F7F); 			frame.graphics.drawRect(pd, pd, camera.view.width, camera.view.height); 			frame.graphics.endFill(); 		} 	} }

Here you can download sources.



gembin 2012-07-21 22:58 发表评论
]]>
Embedding fonts into ActionScript 3 projecthttp://www.aygfsteel.com/gembin/archive/2012/07/21/383676.htmlgembingembinSat, 21 Jul 2012 14:56:00 GMThttp://www.aygfsteel.com/gembin/archive/2012/07/21/383676.htmlhttp://www.aygfsteel.com/gembin/comments/383676.htmlhttp://www.aygfsteel.com/gembin/archive/2012/07/21/383676.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/383676.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/383676.html阅读全文

gembin 2012-07-21 22:56 发表评论
]]>
Comparing the syntax of Java 5 and ActionScript 3http://www.aygfsteel.com/gembin/archive/2012/07/07/382482.htmlgembingembinSat, 07 Jul 2012 14:44:00 GMThttp://www.aygfsteel.com/gembin/archive/2012/07/07/382482.htmlhttp://www.aygfsteel.com/gembin/comments/382482.htmlhttp://www.aygfsteel.com/gembin/archive/2012/07/07/382482.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/382482.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/382482.html

This list is not complete, and your input is appreciated.

Concept/Language Construct

Java 5.0

ActionScript 3.0

Class library packaging

.jar

.swc

Inheritance

class Employee extends Person{…}

class Employee extends Person{…}

Variable declaration and initialization

String firstName=”John”;

Date shipDate=new Date();

int i;

int a, b=10;

double salary;

var firstName:String=”John”;

var shipDate:Date=new Date();

var i:int;

var a:int, b:int=10;

var salary:Number;

Undeclared variables

n/a

It’s an equivalent to the wild card type notation *. If you declare a variable but do not specify its type, the * type will apply.

A default value: undefined

var myVar:*;

Variable scopes

block: declared within curly braces,
local: declared within a method or a block

member: declared on the class level

no global variables

No block scope: the minimal scope is a function

local: declared within a function

member: declared on the class level

If a variable is declared outside of any function or class definition, it has global scope.

Strings

Immutable, store sequences of two-byte Unicode characters

Immutable, store sequences of two-byte Unicode characters

Terminating statements with semicolons

A must

If you write one statement per line you can omit it.

Strict equality operator

n/a

===

for strict non-equality use

!==

Constant qualifier

The keyword final

final int STATE=”NY”;

The keyword const

const STATE:int =”NY”;

Type checking

Static (checked at compile time)

Dynamic (checked at run-time) and static (it’s so called ‘strict mode’, which is default in Flex Builder)

Type check operator

instanceof

is – checks data type, i.e. if (myVar is String){…}

The is operator is a replacement of older instanceof

The as operator

n/a

Similar to is operator, but returns not Boolean, but the result of expression:

var orderId:String=”123”;

var orderIdN:Number=orderId as Number;

trace(orderIdN);//prints 123

Primitives

byte, int, long, float, double,short, boolean, char

all primitives in ActionScript areobjects.
Boolean, int, uint, Number, String

The following lines are equivalent;

var age:int = 25;

var age:int = new int(25);

Complex types

n/a

Array, Date, Error, Function, RegExp, XML, and XMLList

Array declaration and instantiation

int quarterResults[];

quarterResults =
new int[4];

int quarterResults[]={25,33,56,84};

var quarterResults:Array
=new Array();

or

var quarterResults:Array=[];

var quarterResults:Array=
[25, 33, 56, 84];

AS3 also has associative arrays that uses named elements instead of numeric indexes (similar to Hashtable).

The top class in the inheritance tree

Object

Object

Casting syntax: cast the class Object to Person:

Person p=(Person) myObject;

var p:Person= Person(myObject);

or

var p:Person= myObject as Person;

upcasting

class Xyz extends Abc{}

Abc myObj = new Xyz();

class Xyz extends Abc{}

var myObj:Abc=new Xyz();

Un-typed variable

n/a

var myObject:*

var myObject:

packages

package com.xyz;

class myClass {…}

package com.xyz{

class myClass{…}

}

ActionScript packages can include not only classes, but separate functions as well

Class access levels

public, private, protected

if none is specified, classes have package access level

public, private, protected

if none is specified, classes haveinternal access level (similar to package access level in Java)

Custom access levels: namespaces

n/a

Similar to XML namespaces.

namespace abc;

abc function myCalc(){}

or

abc::myCalc(){}

use namespace abc ;

Console output

System.out.println();

// in debug mode only

trace();

imports

import com.abc.*;

import com.abc.MyClass;

import com.abc.*;

import com.abc.MyClass;

packages must be imported even if the class names are fully qualified in the code.

Unordered key-value pairs

Hashtable, Map

Hashtable friends = new Hashtable();

friends.put(“good”,
“Mary”);

friends.put(“best”,
“Bill”);

friends.put(“bad”,
“Masha”);

String bestFriend= friends.get(“best”);

// bestFriend is Bill

Associative Arrays

Allows referencing its elements by names instead of indexes.

var friends:Array=new Array();
friends["good"]=”Mary”;

friends["best"]=”Bill”;

friends["bad"]=”Masha”;

var bestFriend:String= friends[“best”]

friends.best=”Alex”;

Another syntax:

var car:Object = {make:”Toyota”, model:”Camry”};

trace (car["make"], car.model);

// Output: Toyota Camry

Hoisting

n/a

Compiler moves all variable declarations to the top of the function, so you can use a variable name even before it’s been explicitly declared in the code.

Instantiation objects from classes

Customer cmr = new Customer();

Class cls = Class.forName(“Customer”);

Object myObj= cls.newInstance();

var cmr:Customer = new Customer();

var cls:Class = flash.util.getClassByName(“Customer”);
var myObj:Object = new cls();

Private classes

private class myClass{…}

There is no private classes in AS3.

Private constructors

Supported. Typical use: singleton classes.

Not available. Implementation of private constructors is postponed as they are not the part of the ECMAScript standard yet.

To create a Singleton, use public static getInstance(), which sets a private flag instanceExists after the first instantiation. Check this flag in the public constructor, and if instanceExists==true, throw an error.

Class and file names

A file can have multiple class declarations, but only one of them can be public, and the file must have the same name as this class.

A file can have multiple class declarations, but only one of them can be placed inside the package declaration, and the file must have the same name as this class.

What can be placed in a package

Classes and interfaces

Classes, interfaces, variables, functions, namespaces, and executable statements.

Dynamic classes (define an object that can be altered at runtime by adding or changing properties and methods).

n/a

dynamic class Person {

var name:String;

}

//Dynamically add a variable // and a function

var p:Person = new Person();

p.name=”Joe”;

p.age=25;

p.printMe = function () {

trace (p.name, p.age);

}

p.printMe(); // Joe 25

function closures

n/a. Closure is a proposed addition to Java 7.

myButton.addEventListener(“click”, myMethod);

A closure is an object that represents a snapshot of a function with its lexical context (variable’s values, objects in the scope). A function closure can be passed as an argument and executed without being a part of any object

Abstract classes

supported

n/a

Function overriding

supported

Supported. You must use the override qualifier

Function overloading

supported

Not supported.

Interfaces

class A implements B{…}

interfaces can contain method declarations and final variables.

class A implements B{…}

interfaces can contain only function declarations.

Exception handling

Keywords: try, catch, throw, finally, throws

Uncaught exceptions are propagated to the calling method.

Keywords: try, catch, throw, finally

A method does not have to declare exceptions.

Can throw not only Error objects, but also numbers:

throw 25.3;

Flash Player terminates the script in case of uncaught exception.

Regular expressions

Supported

Supported




gembin 2012-07-07 22:44 发表评论
]]>
AS3~码规范http://www.aygfsteel.com/gembin/archive/2011/06/03/351658.htmlgembingembinFri, 03 Jun 2011 03:20:00 GMThttp://www.aygfsteel.com/gembin/archive/2011/06/03/351658.htmlhttp://www.aygfsteel.com/gembin/comments/351658.htmlhttp://www.aygfsteel.com/gembin/archive/2011/06/03/351658.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/351658.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/351658.html阅读全文

gembin 2011-06-03 11:20 发表评论
]]>
AS3 depth sorting of display objectshttp://www.aygfsteel.com/gembin/archive/2010/11/18/338393.htmlgembingembinThu, 18 Nov 2010 08:04:00 GMThttp://www.aygfsteel.com/gembin/archive/2010/11/18/338393.htmlhttp://www.aygfsteel.com/gembin/comments/338393.htmlhttp://www.aygfsteel.com/gembin/archive/2010/11/18/338393.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/338393.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/338393.html阅读全文

gembin 2010-11-18 16:04 发表评论
]]>
AS3-DI-Metadatahttp://www.aygfsteel.com/gembin/archive/2010/11/12/337911.htmlgembingembinFri, 12 Nov 2010 06:44:00 GMThttp://www.aygfsteel.com/gembin/archive/2010/11/12/337911.htmlhttp://www.aygfsteel.com/gembin/comments/337911.htmlhttp://www.aygfsteel.com/gembin/archive/2010/11/12/337911.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/337911.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/337911.htmlWhat a Metamess

Spring Actionscript, Dawn, SmartyPants, Swiz, Spicelib (used by Parsley) and SwiftSuspenders (used by Robotlegs) perform Dependency Injection.

Moreover they can all perform automatic DI by parsing class metadata. It would be grand if the common DI related metadata tags could be standardised. That way we really could write code that is decoupled from any particular framework.

Injection by Type

Dawn, Swiz, Spicelib, SwiftSuspenders, SmartyPants: [Inject] (above property, setter or method)
Spring AS: [Autowire] (above property, setter or method)

Most popular

[Inject] by 5

Notes

[Inject] is clear and simple and used by almost all of the libraries. It also directly correlates to @Inject from the JSR-330 Dependency Injection for Java specification. Let’s use it.

Injection by Name/Id

Dawn, SwiftSuspenders, SmartyPants: [Inject(name=“SomeName”)] (above property, setter or method)
Swiz: [Inject(source=“SomeName”)] (above property, setter or method)
Spicelib: [Inject(id=“SomeName”)] (above property, setter or method)
Spring AS: [Autowired(name=“SomeName”)] (above property, setter or method)

Most popular

[Inject(name=“SomeName”)] by 3

Notes

Since you can define default attributes best practice could be to leave out the attribute: [Inject(“SomeName”)]

Constructor Injection:

SwiftSuspenders: [Inject] (above class)
Spicelib: [InjectConstructor] (above class)
Swiz, Spring AS, Dawn: ?

Most popular

?

Notes

I don’t see the need for an extra tag ([InjectConstructor]) when we could simply use [Inject].

Object Lifecycle – Post Injection:

Dawn, SwiftSuspenders, SmartyPants, Swiz: [PostConstruct] (above method)
Spicelib: [Init] (above method)

Most popular

[PostConstruct] by 4

Notes

@PostConstruct is used in Java for the same purpose. Let’s use the most popular, established one.

Object Lifecycle – Teardown:

SwiftSuspenders, SmartyPants, Dawn: none?
Swiz: [PreDestroy] (above method)
Spicelib: [Destroy] (above method)

Most popular

Notes

@PreDestroy is used in Java for the same purpose. Let’s use the most familiar, established one.

Factory/Provider:

SwiftSuspenders, SmartyPants, Swiz: none?
Dawn: [Provider] (above method)
Spicelib: [Factory] (above method)



gembin 2010-11-12 14:44 发表评论
]]>
Smartfoxserver http://www.aygfsteel.com/gembin/archive/2010/11/12/337880.htmlgembingembinFri, 12 Nov 2010 02:32:00 GMThttp://www.aygfsteel.com/gembin/archive/2010/11/12/337880.htmlhttp://www.aygfsteel.com/gembin/comments/337880.htmlhttp://www.aygfsteel.com/gembin/archive/2010/11/12/337880.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/337880.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/337880.htmlSmartFoxServer 是专门ؓAdobe Flash设计的跨q_socket服务器,让开发者高效地开发多人应用及游戏. 该服务器主要用来创徏多玩家游戏。ƈ提供强大的制作工P各种回合制游戏和实时游戏都可以胜仅R?SmartFoxServer 支持的播攑֙从Flash player6版到最新的Flash Player 9Qƈ提供丰富的Actionscript 1.0, 2.0 and 3.0 APIs,同时也支?Flex Builder 2 and 3. 该品带有详l的帮助文档, 大约 35 个带源代码的CZ q有强大的远E管理工? 本入门假定你会基本的flex3开发知识?/p>

SFS介快?可靠:

SmartFoxServer 是基于高效和可升U的l构Q可以在单CPU服务器机子上处理数千的客L. 是有名的qx的服务器Q最低支持P2-350Mhz。很多公司和游戏机构都已l?SmartFoxServer 开发出了很多高质量的在U多玩家应用及游戏。比如Club Penguin

高制作能?

SmartFoxServer 带有一套支持Actionscript 1.0, 2.0 ?Actionscript 3.0 的APIs 他们都是从flash核心对象扩展出来的新功能Q可以让开发者简单快速地开发多玩家应用.

扩展?

SmartFoxServer 可以使用Actionscript, Javascript, Python and Javaq行服务器端的扩? 自定义服务器端扩展,可以执行复杂的应用,游戏逻辑Q高U用P戉K理Q及服务器新行ؓQ等{?另外?/p>

跨^台?

SmartFoxServer 可以q行在Q何系l上: 因ؓSmartFoxServer ?00%的纯 Java 开发的应用,它可以运行在Mq_?如:Windows (NT/2K/XP/2003), Linux, MacOS X (10.4 or higher), Solaris {等.

强大的附加Y?

SmartFoxServer 带有强大的附加Y件来扩展其功?

BlueBox:

让玩安开|络限制(防火? 代理) 来进行多玩家游戏Q而不牺牲q接速度. 因ؓ API 会自动在”q后“选择最好的q接pȝ?/p>

RedBox:

免费开源的附加软gQ在SmartFoxServer的框架中集成了音?视频的能力Qred5Q? q简化了 A/V应用的开发难度?/p>

什么是SFS客户端的APIQ?/p>

Sfs已经Z做好了基本的客户端网l通信通道Q这个通道可以联通服务端的相兛_能模块来实现相关功能。比如用L?戉K登陆/用户信息q播/更新用户戉K信息{等。你只调用和扩展通道中的指定Ҏ(gu)卛_?/p>

如何安装Q?/p>

从www.smartfoxserver.com 中找到最新版本的smartfoxserverproQ?.6.2Q。然后安装找到RedBoxClient_AS3.SWC在flex3中导入此客户端插件。当然也可以flashapi中的AS3中源文g直接拷到自己的项目中。这样就可以调用SFS的客L的API了?/p>

基本步凑

发vsocketq接:q是W一? 像是在敲服务器的门。如果服务器开着׃相应你,q激zM个连接?/p>

d: 在这一阶段Q你要告诉服务器你是谁你惛_哪个应用交互Q如果操作成功的话,你就可以当前zone里的戉K列表

加入戉K: 一旦进入了戉KQ你可以和其他用户和应用的逻辑q行交互?/p>

SmartFoxClient 详细介绍

安装Q?/p>

在flex3中导入项目Examples/as3/smartfoxchatQ?/p>

smartfoxchat.mxml是其客户端的L件?/p>

重要帔R信息Q?/p>

// Connection constants

private const serverIp:String = “211.157.41.204″

private const serverPort:int = 9339

private const serverZone:String = “simpleChat ”

以上都是q接的重要信息,W一个是serverip是你的服务器的IP地址Q第二个子是端口PW三个是Zone名称Qzone是服务端对于相关集成的功能模块的单位代称Q;

常用事gQ?/p>

package …{

import flash.display.Sprite;

//Establish connection with the server

public function connect():void

{

sfs.connect(serverIp, serverPort)

}

以上是连接服务端的方法,只要知道IP和端口号我们可以对SFS服务器进行联接了?/p>

sfs = new SmartFoxClient(true)

sfs.debug = false;

// Add event listeners

sfs.addEventListener(SFSEvent.onConnection, onConnection)

以上代码是生成一个客LSFS通道实例。然后监听联q,一旦客L与服务联通后客户端就可以收到onConnection的这个事件信息?/p>

sfs.addEventListener(SFSEvent.onLogin, onLogin)

Sfs的事件监听基本上是按smartfoxchat.mxml的顺序在走的Qonconnetion之后׃会监听到onloginQ这个事件的用处只在于失败登录后客户端会在debug里看到自定义的一D错误信息?/p>

sfs.addEventListener(SFSEvent.onRoomListUpdate, onRoomListUpdate)

d成功后第一件是收到一个房间列表,客户端的相关list控g通常会绑定这个列表信息这样就可以昄了。要注意的是q里最后有一个sfs.autoJoin()Q如果执行将会自动的q行一个房间如果不执行dE序到此结束?/p>

sfs.addEventListener(SFSEvent.onJoinRoom, onJoinRoom)

当客L执行了sfs.joinRoom(roomId)Q服务端会z֏onJoinRoom事g客户端,客户端再执行onJoinRoom?/p>

常用实例Ҏ(gu)Q?/p>

代码

sendObject (obj:Object, roomId:int = -1) : void                  //在当前房间发送一个Actionscript对象l其他用戗?/p>

setUserVariables (varObj:Object, roomId:int = -1) : void             //讄一个或多个用户变量?/p>

sendPublicMessage (message:String, roomId:int = -1) : void           //发送一个公有消息?/p>

sendPrivateMessage (message:String, recipientId:int, roomId:int = -1) : void   //发送一个私有消息给用户?/p>

joinRoom (newRoom:*, pword:String = “”, isSpectator:Boolean = false, dontLeave:Boolean = false, oldRoom:int = -1) : void //加入一个房间?/p>

leaveRoom (roomId:int) : void //d一个特定的戉K。(断开一个特定房间的q接Q?/p>

C:\Program Files\SmartFoxServerPRO_1.6.2\Docs\index.htm

q是SFS的文主界面Q里面有全部的所有SFS的相兌料及所有类的及Ҏ(gu)属性的介绍?/p>

市面上其实还有与SFS同类的相关品,比如adobe的FMSQflash medio server)媒体服务器可以高效的处理flash媒体服务(专门针对视音频流不是专门针对游戏Q。Java的minaQjava的可用于多h实时的服务器。sun game server(sgs)http://www.projectdarkstar.com/。还有python中的twisted框架也可以实现较单的服务器?/p>

以上说的服务器都是指可以多h实时大部分都支持socketQfms除外



gembin 2010-11-12 10:32 发表评论
]]>
Flex 4: change baseColor to chromeColor and useChromeColor=truehttp://www.aygfsteel.com/gembin/archive/2010/06/18/323834.htmlgembingembinFri, 18 Jun 2010 09:30:00 GMThttp://www.aygfsteel.com/gembin/archive/2010/06/18/323834.htmlhttp://www.aygfsteel.com/gembin/comments/323834.htmlhttp://www.aygfsteel.com/gembin/archive/2010/06/18/323834.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/323834.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/323834.html阅读全文

gembin 2010-06-18 17:30 发表评论
]]>
as3 9-slice scalinghttp://www.aygfsteel.com/gembin/archive/2010/06/14/323579.htmlgembingembinMon, 14 Jun 2010 14:10:00 GMThttp://www.aygfsteel.com/gembin/archive/2010/06/14/323579.htmlhttp://www.aygfsteel.com/gembin/comments/323579.htmlhttp://www.aygfsteel.com/gembin/archive/2010/06/14/323579.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/323579.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/323579.html阅读全文

gembin 2010-06-14 22:10 发表评论
]]>
视频: L2 Adobe ROME Adobe Max 2009(COOL!)http://www.aygfsteel.com/gembin/archive/2009/10/12/297992.htmlgembingembinMon, 12 Oct 2009 14:26:00 GMThttp://www.aygfsteel.com/gembin/archive/2009/10/12/297992.htmlhttp://www.aygfsteel.com/gembin/comments/297992.htmlhttp://www.aygfsteel.com/gembin/archive/2009/10/12/297992.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/297992.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/297992.html阅读全文

gembin 2009-10-12 22:26 发表评论
]]>
Adobe ROME Preview(COOL!)http://www.aygfsteel.com/gembin/archive/2009/10/12/297989.htmlgembingembinMon, 12 Oct 2009 14:20:00 GMThttp://www.aygfsteel.com/gembin/archive/2009/10/12/297989.htmlhttp://www.aygfsteel.com/gembin/comments/297989.htmlhttp://www.aygfsteel.com/gembin/archive/2009/10/12/297989.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/297989.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/297989.html阅读全文

gembin 2009-10-12 22:20 发表评论
]]>
[原创] Dynamic DataService registration in OSGi Container for Graniteds v1.1.0http://www.aygfsteel.com/gembin/archive/2008/12/04/244374.htmlgembingembinThu, 04 Dec 2008 06:51:00 GMThttp://www.aygfsteel.com/gembin/archive/2008/12/04/244374.htmlhttp://www.aygfsteel.com/gembin/comments/244374.htmlhttp://www.aygfsteel.com/gembin/archive/2008/12/04/244374.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/244374.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/244374.html阅读全文

gembin 2008-12-04 14:51 发表评论
]]>
MAX2007q会ȝ十项技??http://www.aygfsteel.com/gembin/archive/2008/09/24/230871.htmlgembingembinWed, 24 Sep 2008 06:21:00 GMThttp://www.aygfsteel.com/gembin/archive/2008/09/24/230871.htmlhttp://www.aygfsteel.com/gembin/comments/230871.htmlhttp://www.aygfsteel.com/gembin/archive/2008/09/24/230871.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/230871.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/230871.html关键? flex max

1. Flex Builder 3/AIR beta2 on lab

q两样东西会?span> max 期间攑և beta 2 (M5) 应该是旧闻Q还有h事先不知道才是比较奇怪?/span>beta2 本n的新功能?wiki 上有详细介绍Q但重点不外乎在 IDE 本n的强化?span>AIR 整合?span>CSS 设计?span> Profiler{?/span>比较重要的是大概有三?/span>-新售价出来了Q将?span> FB 分两U版?/span>
Standard: $299
Pro: $699
Standard 比现?span> $499 q降200元,所以现在是行新版本都要降两百?/span>Q不q没?span> charting component, q些玩意(包含?span> AdvancedDataGrid q种 visual data component{?span>)
都移?span> Pro 版?/span>q样做的意义很明显,主要是要大q降?span> flex 的进入门坎,原本?span>$499 才能有拥?span> IDEQ现在只?span> $299 几乎是hZ的vQ另一斚wQ对每天靠开?span> flex 为生的h来说Q将好料的一ơ全塞入pro版,而且比现?span> $799 低了 100元,也算是方便许多,臛_付一ơ钱可以买到全部的东西(而不用再一hM费然后拼h)Q这个市场策略不错?/span>-Linux 版问?/span>
q世界上g有很多h一直想?span> linux 上开?span> flexQ而且只用 text editor + sdk q不够,一定要?span> IDE
才过瘾,现在可称心如意了Q?span>beta
版已可在 lab 上下载?/span>-flex testing framework 改ؓ免费
以往要用 Mercury Quicktest Pro 来做 UI testing Ӟ必需要先?span> testing framework, 但它需要一l?span> FDS 的序h能用,而几乎没Z愿意?span> $6,000-$12,000
的h(hun)钱去买这玩意?/span>两个月前我在玩某?span>fb3 beta 版本Ӟ意外在安装目录下发现居然内徏了这?span> installerQ而且q真的可以装也可以用Q那时我以ؓ是只是单U的意外不小心包了进?span>(或是 adobe 心想反正卖不掉干脆欢乐大N?span>)Q现在才知道原来q些是故意的?span>~

2. Thermo

_略介看q里

Max 期间另一个重头戏是 Thermo 初亮相,|络上已l有一些媄片可看?/span>

目前看来它的操作方式很像 adobe 产品的大合体Q我观察到的包含-可直接读?span> Photoshop PSD ,q且当然保留所有的 layer 信息?span> meta info-d?span> psd 档会?span> tracing image 的方式显C在底层(q是?span> dreamweaver ?span> golive 借来的概?span>)-可用cM edit in place (q是 fireworks, image ready, golive 时代有的东?span>)画面元素{换ؓ mxml lgQ而且会保?span> style info-转换?span> mxml 后会使用新的 tag 来标识,例如 mx:bitmapGraphic ?/span>
mx:borderSkinFactory
-可制作多?span> state q在光切换(q跟 fireworks cs3 里新出现?span> page 面板概念完全一?span>)-拥有 timeline 可制?span> transition/effectQ例?span> mouseover 时某个对象要渐大或渐等变化Q乍看之下很像是 flash 附n XD整段q看完初步的感觉如下:1、我臛_?span> thermo 里看?span> photoshop, flash, fireworks, dreamweaver, image ready, golive {Y件的功能与媄子,q应该可说是合ƈ?span> 1+1 > 2 的例子之一?/span>2、目前看来工作流E会是这?/span>Photoshop -> Thermo < -> Flex也就是视觉的东西 70% 都在 photoshop/illustrator 里做好,然后?span> psd 丢给 thermo ?span> interaction designQ但它也同时提供?span> mxml 产生器,让设计师可以进一步跨界将视觉元素转成可编E的 mxml lgQ最后交l工E师?span> coding?/span>3、至?span> thermo 实不实用呢?嗯,q要看你怎么定位它?/span>从历史上来看Q类?span> fireworks/image ready q种 psd to html 产生器的工作程基本上从来没成功q,因ؓ one-way 式的?span> psd ?span> html 或许很容易,但当 html 要回?span> psd Ӟ困难度就很高Q到最后都是『工人智慧』来解决?/span>但如果从 quick-prototyping or Proof of Concept(POC)的角度来看,thermo 可能会是很好的帮手,因ؓ设计师可以尽情的发挥视觉设计美的版面做出来,然后透过 thermo 产生可实际操作的 flex 接口Q这样客户可以看的到也摸的到来实际成品可能的样貌,制作团队也能比较完整的掌握客h要的东西?/span>至于真正要开始制?span> flex appӞ我想 thermo 的帮助就不大Q因不懂E序的设计师来帮忙切 ui lgQ决定每?span> module 该如何画分?q样冒的风险实在太大Q切出来?span>mxml 大概也没法用Q最后还是要重新来?/span>但这又带到另一个鸡生蛋、蛋生鸡的老问题?/span>Thermo ? 所以会出现Q是Z解决工程师不懂如何将视觉画面转换为成品,因此希望p计师来帮忙这件事Q但p计师来做qg事缺点也很多Q上面也已稍微解释,所以这 仍然是一个两隄问题Q也是设计师帮忙切画面Q切出来的东西可能工E师觉得不好用或无法用,但由工程师去切画面,可能整支E序画面也就毁了Q所以最l下 场差不多?/span>依我q几q全职开?span> flash/flex 的经验来看,以往许多人提出的
graphic designer - interaction designer - developer
三分工制只能算是第一步,thermo 的出现可能可以实质帮?span> interaction designer 的忙Q但 interaction designer ?span> developer q段仍然会是断层Q而解决之道,则是要找C个方式将q?span> missing link
l补hQ这也将?span> thermo
成|的最大关?span>(目前看来Q?span>blend/expression/xaml 的尝试不甚成功,希望 adobe可以另觅它途让人眼睛一亮啊)

3. Flash Player 10 (codename Astro)

FP9 ?span> as2 发展?span> as3 可说?span> flash 十年来最惊h的大跃进Q几乎完全改写了 RIA 的历Ԍ原本以ؓ大概很难再看到同?span> level 的改版,但很昄我错了?/span>FP10 新增的几个重点功能大略包?/span>-易的 hardware 3D supportQ看来原本打M愿意?span> fp 加入3d功能?span> engineering team q是很顺应民情啊Q当然目前看到的 3d 功能q非常有限,有hU它?span> 2.5DQ也有hUCؓ card-game style 3DQ不q就我对 flash player team 的了解,来内徏?span> 3D 功能q上 Papervision3D 应该是没问题的?/span>-advanced text layout: q包含了 multi-column 的走文方式,也包含了 right-to-left layout(RTL)Q这两g事在q去我们都遇q,d制作的一个大?span>app在多国语a化时Q客户居焉Q『希伯来文版的接口文字应该是从右到左啊,可以改一下吗Q』当时心里的回答Q『当然可以,你先C flash player team 交给我指挥,我保证半q内生出来给?span>…』现在这件事可简单多了,只是 UI Component 部䆾要改写的东西q是很费力啊?/span>-custom filter/effect with “Hydra” image processing language:
q算是非常有的新玩意,Hydra 是一U类?span> C 的语aQ?span>user
可用它编辑自已独门的 filter/effectQ之前有 Vector/Bitmap API 大家已l玩Z堆疯狂的把戏Q现在有了更 low-level 的工P呵呵呵,_ֽ可期Q只是以后教 flash 的讲师是不是也要q修一?span> C/C++
?span>? Orz

4. Flash Lite 3 推出

功能介绍?span>q里重点?/span>
-flash home:
q个是真正的新玩意Q以往 flash lite 都是?span> app 的型式存在于手机上,也就是要用时才启动,?span> flash home 则是直接?span> flash lite
取代掉手机的开机画面,一开机完是 flash lite 在那里,而且它是 instant on?/span>
之前曾聊q?span> LG phone 整个 UI 都用 flash lite 写成Q现在则是更q一步攻占了开机画面,未来的发展非常有啊Q希望它能尽快追?span> as3 的脚步,把传说中?span> flex framework for mobile 搬出来,届时可就玩到乐翻天了?/span>-as2 support: q个好像喊很久了Q现在真的支?span> class 了吗Q?/span>
-flv support:
q个到是很重要的新功能,不过已经不是新闻Q今q初时就已发?/span>
-xml loading:
?span> flash lite 2.1 起就可以支持 socket serverQ所以要在手Z?span> push/pull 变的非常?/span>
 

5. VOIP in flash

FP 支?span> voip 不是新闻Q但真正看到它运作还是吓一跟?/span>Pacifica 是这个品的代号Q它?yu)提供下列功?span>:Version 1:
* HQ voice chat
* text instant messaging
* presence
* NAT/Firewall traversal
* Ajax/HTML, Flash/Flex
Future Roadmap:
* video chat
* p2p
* AIR
* PSTN Access
要注意的重点是这几个?span>: VoIP, SIP, SDP ?span> P2P?/span>
你能惌一?span> flash player 本n内徏 VoIP ?span> SIP 支持后,可能的应用有多广吗?单来_上面listing 里面随便一,都可以将q个世界再翻一遍,差不多就是这L影响力?/span>

6. CoCoMo

q可不是 Adobe ?Beach Boys 的异业结盟?/span>CoCoMo ?span> Adobe Connect (也就?span> Breeze) 新版本的代号Q不出所料果然用 flex 全部改写Q但更惊人的是它开始玩起另一个更有潜力的市场Q?span>API platform ! flex developer 可操?span> Adobe Connect ?span> API 来制作各U?span> desktop sharing, audio/video chat & collaborationQ相较之下,之前炒的火热?span> facebook platform 实在是没什么啊(不过当然q两者可以是完美的互补,不一定是零合游戏)?/span>

7. Share

一?span>在线文g、分享、阅ȝq_Q每?span>user ?span> 1gb I间?/span>同样?span> flex 写成Q用了许多熟(zhn)的lgQ例?span> page component (oh, the great Ely!) ?span> flash paperQ也提供 REST style API 可供 mesh upQ将来打整?span> Buzzword 提供~辑功能?/span>从本质来看,online-doc sharing q种东西当然早就有h做过了,|络上随侉K可以扑ֈ一狗票Q同h让h上传文gQ然后{成 swf 再用 flash player 来看Q那 adobe 又何苦呢Q?/span>我来看Q?span>Share ?span> adobe ?span> web publishing 斚w的新试Q主要利用的优势当然是自家?span> PDF ?span> flash playerQ但跟其它单U只?web 2.0 startup 公司不同的是Q?span>adobe 心里想的应该是它完整?span> electronic publishing q_Q从内容、制作、生成到消费Q希望能通通包下来Q徏立大一l的体系Q我怿 Share 与之前介l过?span> ebook reader 都只是这个计划下的部份物,未来发展q待观察?/span>

8. C/C++ to AS3 conversion

 LLVM

q个玩意非常有趣Q这位神人写了一?span> compilerQ可以将 C/C++ ?span> code 直接转译?span> AS3Q然后再~译?span> swf ?span> flash/flex/air 使用Q现场最另h震撼?span> demo 是他直接将 Quake (一?span> doom-like 的射L?span>) ~译?span> flash 版然后玩了v来,你可以想见现Z疯狂C么程?span>!! (更酷的是q位工程师还是一副^淡的表情Q真正是扮猪吃老虎的极致表现啊)?/span>好,热情完毕Q接着分析师上w?/span>我主要思考的是下列三点:1. Z需要这个东西?上图中四个角落写着 (ruby, php, python, lua), 它代表什么?
2.
q东西背后的企图是什么?
3.
谁会LQ它可以用在什么地方?发展潜力有多大?
基本上我已经有了一套大致的x与理论,但很有兴想听听各位的想法?/span>

9. Adobe C Buzzword

qg事其实几个月前就有风声出来,?adobe W一批工E师q驻 buzzword 办公室时Q明ghq道是怎么回事了,反而比较奇怪的Z SlideRocket 一直谈不下?span>(h家还?span> IPO 前多撒点钱快Ҏ(gu)定将来比较好办事?span>)Q?/span>从市度来看,Buzzword(cM word 的文字编辑器) ?span> SlideRocket(cM powerpoint 的简单Y?span>) 应该是当?span> RIA 业界最׃表性与杀伤力的两?span>appQ它们几乎有撼动 Office 市场的能力,因此 adobe 对它们的重视与关爱可说是其来有自Q亳不奇怪?/span>比较值得观察的将是,q早 Adobe 手上会有 word, powerpoint ?span> excel 兼容的Y?span>(当然?span> built with Flex/AIR)Q届时世界上只有四间L商业公司有成熟的 office 产品(OO.o q种先不算q来Q呃Q好Q其实还?span> IBM Lotus SymphonyQ不q知名度不高也先放一?span>)-Microsoft: Office 的霸d位无庸置疑,runs on desktop only
-Apple: Mac
上的 Office
, runs on desktop only
-Google: Doc
pd产品Q算是目?span> web-based
里最成熟的一?/span>

-Adobe:
同样?span> web-based, 但因为采?span> flash 制作Q因此操作接口与功能明显超?span> google docs (
与其?span> ajax pd?span> office-apps)而其中只?span> google ?span> adobe 已经很积极在 web-based q块p?span>(MS?span> office live 则还未成?span>)Q从势来看(on-line, access everywhere, collaboration, messaging)Q?span>web式的产品前途是比较看好的,而从技术面来看Q?span>flash式的 web app 往往又比 ajax 式的好一?span>(臛_?span> tool U这个领?span>)Q所?span> adobe 可以说是已经站在比较有利?span> positionQ这是很有趣也值得观察的事(而且要睁大眼睛好好看着)?/span>

10. Flash CS4 ?/strong> Fireworks

CS4Flash 部䆾有许多不错的新功能,例如可在 authoring time live preview video contentQ?span>timeline 大改?span>, tween 方式更自由,以及奇?span> IK 效果Q我惛_能掌握这些新东西的多媒体设计师来_q应该是非常的消息?/span>Fireworks 部䆾则是?span> flex 的整合,例如可在 fireworks 里制作组件与style/skin 然后直接输出?span> scale-9 ?span> swc l?span> flex 用,基本上都q是很粗的整合试Q未?span>12个月q要多努力?/span>

ȝ

lD以上 highlight 出来?span> 10点,如果你仔l去推敲每一点背后所代表的意义,q思考它们未来可能的影响力与冲击效应Q或怽会像我一栯得全w发热心跛_快?/span>基本上观察这?span> Max 揭露的消息,感觉很像在看高手对弈Q当你看到局中一步棋Ӟq道胜负已定,未来所有的步数皆已定Q结果只是时间问题,而更令h惊讶的是Q往往q致胜的一步是如此的不明显与不l意Q轻ȝ滑过决定了未来Q这才是真正让h自叹弗如的地斏V?/span>惛_q里Q只能说q真的是一?span> exciting timesQ很高兴能置w其中、亲自经历而不是在十年后回头来赞叹当年?/span>



gembin 2008-09-24 14:21 发表评论
]]>
Flex Shared Objecthttp://www.aygfsteel.com/gembin/archive/2008/09/23/230662.htmlgembingembinTue, 23 Sep 2008 06:15:00 GMThttp://www.aygfsteel.com/gembin/archive/2008/09/23/230662.htmlhttp://www.aygfsteel.com/gembin/comments/230662.htmlhttp://www.aygfsteel.com/gembin/archive/2008/09/23/230662.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/230662.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/230662.html阅读全文

gembin 2008-09-23 14:15 发表评论
]]>
Memory Profile of MXML vs AS3 for ItemRenderershttp://www.aygfsteel.com/gembin/archive/2008/09/18/229667.htmlgembingembinThu, 18 Sep 2008 05:33:00 GMThttp://www.aygfsteel.com/gembin/archive/2008/09/18/229667.htmlhttp://www.aygfsteel.com/gembin/comments/229667.htmlhttp://www.aygfsteel.com/gembin/archive/2008/09/18/229667.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/229667.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/229667.html阅读全文

gembin 2008-09-18 13:33 发表评论
]]>
Book: Learning Flex 3: Getting up to Speed with Rich Internet Applicationshttp://www.aygfsteel.com/gembin/archive/2008/09/10/228130.htmlgembingembinWed, 10 Sep 2008 05:31:00 GMThttp://www.aygfsteel.com/gembin/archive/2008/09/10/228130.htmlhttp://www.aygfsteel.com/gembin/comments/228130.htmlhttp://www.aygfsteel.com/gembin/archive/2008/09/10/228130.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/228130.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/228130.html阅读全文

gembin 2008-09-10 13:31 发表评论
]]>
Flex 3 Compiler Design(from adobe)http://www.aygfsteel.com/gembin/archive/2008/09/10/228089.htmlgembingembinWed, 10 Sep 2008 03:01:00 GMThttp://www.aygfsteel.com/gembin/archive/2008/09/10/228089.htmlhttp://www.aygfsteel.com/gembin/comments/228089.htmlhttp://www.aygfsteel.com/gembin/archive/2008/09/10/228089.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/228089.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/228089.html阅读全文

gembin 2008-09-10 11:01 发表评论
]]>
14 Papervision 3D sampleshttp://www.aygfsteel.com/gembin/archive/2008/09/10/228078.htmlgembingembinWed, 10 Sep 2008 02:17:00 GMThttp://www.aygfsteel.com/gembin/archive/2008/09/10/228078.htmlhttp://www.aygfsteel.com/gembin/comments/228078.htmlhttp://www.aygfsteel.com/gembin/archive/2008/09/10/228078.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/228078.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/228078.html阅读全文

gembin 2008-09-10 10:17 发表评论
]]>
ActionScript 3 opensource Libshttp://www.aygfsteel.com/gembin/archive/2008/09/10/228076.htmlgembingembinWed, 10 Sep 2008 02:16:00 GMThttp://www.aygfsteel.com/gembin/archive/2008/09/10/228076.htmlhttp://www.aygfsteel.com/gembin/comments/228076.htmlhttp://www.aygfsteel.com/gembin/archive/2008/09/10/228076.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/228076.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/228076.html阅读全文

gembin 2008-09-10 10:16 发表评论
]]>
ActionScript 3.0 Game Programming Universityhttp://www.aygfsteel.com/gembin/archive/2008/09/05/227208.htmlgembingembinFri, 05 Sep 2008 06:17:00 GMThttp://www.aygfsteel.com/gembin/archive/2008/09/05/227208.htmlhttp://www.aygfsteel.com/gembin/comments/227208.htmlhttp://www.aygfsteel.com/gembin/archive/2008/09/05/227208.html#Feedback2http://www.aygfsteel.com/gembin/comments/commentRss/227208.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/227208.html阅读全文

gembin 2008-09-05 14:17 发表评论
]]>
List of 33 Flex APIs, Libraries, Components and Toolshttp://www.aygfsteel.com/gembin/archive/2008/09/05/227204.htmlgembingembinFri, 05 Sep 2008 06:03:00 GMThttp://www.aygfsteel.com/gembin/archive/2008/09/05/227204.htmlhttp://www.aygfsteel.com/gembin/comments/227204.htmlhttp://www.aygfsteel.com/gembin/archive/2008/09/05/227204.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/227204.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/227204.html阅读全文

gembin 2008-09-05 14:03 发表评论
]]>
Flex Builder and AsWing Quick Starthttp://www.aygfsteel.com/gembin/archive/2008/08/13/221729.htmlgembingembinWed, 13 Aug 2008 07:28:00 GMThttp://www.aygfsteel.com/gembin/archive/2008/08/13/221729.htmlhttp://www.aygfsteel.com/gembin/comments/221729.htmlhttp://www.aygfsteel.com/gembin/archive/2008/08/13/221729.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/221729.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/221729.htmlas3corelib).It’s also explain how to install and use subclipse( SVN pulg-in for Eclipse ) to checkout fresh code.

Catalog

Basic Part:
1 Download and install Flex Builder(the standalone version)

1.1 Download Flex Builder2.0
1.2 Stratup Flex Builder

2 Download and install AsWing

2.1 Downlaod AsWingA3
2.2 Import AsWing project
2.3 Clean to Build

3 Create,Compile,Run a Application that use AsWing components.

3.1 Create a new ActionScript Project
3.2 Run the application

Advanced Part:
4 Install Flex Builder as a plugin of Eclipse.

4.1 Download and install JDK1.5
4.2 Download and install Eclpse3.2
4.3 Install Flex Builder pulgin

5 Checkout AsWing from SVN

5.1 Install SVN plugin for Eclipse
5.2 Checkout fresh source code


1 Download and install Flex Builder(the standalone version)

1.1 Download Flex Builder2.0

In Basic Part, we selecte download “Flex Builder 2 (English|Windows|168.78 MB)”;
download flex builder

Double click the file you hava downloaded which name like “FLXB_2.0_Win_WWE.exe
select “Flex Builder and Flex SDK”
select flex builder and flex sdkSelect a folder to install Flex Builder.I change to “G:\Flex\Flex Builder 2”.
Select a folder to install Flex Builder

Installing…
Installing

Flex Builder is installed Complete.
installed Complete

1.2 Stratup Flex Builder.

After Download and Install Flex Builder, we can select Start -> All Programs -> Adobe -> Adobe Flex Builder 2 to open Flex Builder.
The Flex Builder is starting, it’s version is 2.0.1.
Flex Builder is starting

The main window of Flex Builder.
The main window of Flex Builder


2 Download and install AsWing

2.1 Downlaod AsWingA3

At the beginning,we download packaged version of AsWing at Here.
Selecte “AsWing A3 0.8”(it will change when you visit this page). Remember to choose AsWing A3 series which is base ActionScript 3.The downloaded file name is “aswing_a3_0_8.zip”.
Downlaod AsWingA3

Change default Workspace to “G:\acode”, Flex Builder will restart automatic.
Change default Workspace

Choose a folder as workspace of Flex Builder.
Choose a folder as workspace

Create a “Flex Library Project” with name ”AsWingA3”.
Create a “Flex Library Project”

2.2 Import AsWing project.

Unpack the “aswing_a3_0_8.zip” to somewhere. Right-Click on project “AsWingA3″ select “Import”
select “Import”

Select import form “File System”
Select import form “File System”

Select the location you unpacked,
Select the location you unpacked

Select into folder, it’s “AsWingA3″.
Select into folder

Some Properities setup
Right click on the AsWingA3 project, select “Properities” at the bottom.
select “Properities” at the bottom

Change to “Flex Build Path”, check the “src” folder and ,fill “src” in “Main sorce folder”
Change to “Flex Build Path”,

Select “Flex Library Complier” , Uncheck the “Enable warnings”,
Select “Flex Library Complier”

2.3 Clean to Build

Select “Project” -> “Clean…”
Select “Project” -> “Clean…”

Check the projects yout want to clean and rebuild.Press “OK” button.
clean and rebuild.

Building project will take you about one minute.
Building project

After build project, a new library file(AsWingA3.swc) is created.
a new library file(AsWingA3.swc) is created


3 Create,Compile,Run a Application that use AsWing components.

3.1 Create a new ActionScript Project with project name “AsWingExamples”.

Create a new ActionScript Project

Fill AsWingExamples in “Project name” ,click Finish button.
Fill AsWingExamples in “Project name”

Create a Source Code Forlder with name “src”,
Create a Source Code Forlder with name “src”,
fill src

Open Properities pane, select “ActionScript Build Path”->”Source path”,fill “src” in “Main sorce folder”
select “ActionScript Build Path
select “ActionScript Build Path”2

Change to “Library path”,click “Add Project” button,
Change to “Library path”,

select “AsWingA3” as a library.
select “AsWingA3” as a library.

Create a ActionScript Class with name “Test”, copy the code into it:
Create a ActionScript Class
new class

Source code of Test.as


package
{
 import flash.display.Sprite;
 import flash.display.StageScaleMode;

import org.aswing.AsWingManager;
 import org.aswing.JFrame;
 import org.aswing.JLabel;
 import org.aswing.event.AWEvent;
 import org.aswing.geom.IntDimension;public class Test extends Sprite
 {
  public function Test(){
  super();
  stage.scaleMode = StageScaleMode.NO_SCALE;
  stage.stageFocusRect = false;
  AsWingManager.setRoot( this );createFrame();
  }
private function createFrame() : JFrame{
  var frame : JFrame = new JFrame( this, "Test of AsWingA3" );
  frame.getContentPane().append(new JLabel( "Hello world!" ));
  frame.setSize(new IntDimension( 200, 120 ) );
  frame.show();
  return frame;
  }
 }
}


Source code of Test.asSelect “ActionScript Applications”,click “Remove” button to delete “AsWingExamples.as(deleted)”,
Removethen press “Add” button, select “Test.as”,
Addpress “Set as Default” to set “Test.as” as the default Main Class.
the default Main ClassYou’ll find the icon of “Test.as” is changed to which mean Main Class.
find the icon

3.2 Run the application

At the end, press the green “Run” button at ToolBar, select “Test”,
Run

wait a second, a html page is popup with our first ActionScript application.
a html page is popup


4 Install Flex Builder as a plugin of Eclipse.

gembin 2008-08-13 15:28 发表评论
]]>
AsWing布局理器入?/title><link>http://www.aygfsteel.com/gembin/archive/2008/08/11/221360.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Mon, 11 Aug 2008 10:38:00 GMT</pubDate><guid>http://www.aygfsteel.com/gembin/archive/2008/08/11/221360.html</guid><wfw:comment>http://www.aygfsteel.com/gembin/comments/221360.html</wfw:comment><comments>http://www.aygfsteel.com/gembin/archive/2008/08/11/221360.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/gembin/comments/commentRss/221360.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/gembin/services/trackbacks/221360.html</trackback:ping><description><![CDATA[     摘要: AsWing布局理器入?nbsp; <a href='http://www.aygfsteel.com/gembin/archive/2008/08/11/221360.html'>阅读全文</a><img src ="http://www.aygfsteel.com/gembin/aggbug/221360.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/gembin/" target="_blank">gembin</a> 2008-08-11 18:38 <a href="http://www.aygfsteel.com/gembin/archive/2008/08/11/221360.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>AsWing 入门http://www.aygfsteel.com/gembin/archive/2008/08/11/221359.htmlgembingembinMon, 11 Aug 2008 10:36:00 GMThttp://www.aygfsteel.com/gembin/archive/2008/08/11/221359.htmlhttp://www.aygfsteel.com/gembin/comments/221359.htmlhttp://www.aygfsteel.com/gembin/archive/2008/08/11/221359.html#Feedback0http://www.aygfsteel.com/gembin/comments/commentRss/221359.htmlhttp://www.aygfsteel.com/gembin/services/trackbacks/221359.htmlActionScript3.0?/h2>

ActionScript3.0 是Adobe公司为基于flash player q_开发的一U脚本语aQ开发者可以用其开发出Zflash playerq行的多媒体应用E序?br />

Z么选择AsWing 以及 AsWing

请参考,《AsWing介绍文》?/p>

环境准备

说白了AsWing是一套用AS3写成的类库,所以只要有~译AS3E序的环境,p使用AsWing?/p>

从编译环境来说基本就?U,一个是Flash CS3Q另一个就?flex sdk。开发工具就很多了,官方的有 FlashCS3QFlex Builder(推荐用FB3)Q或者用开源的FlashDevelopQ支持用flash和flex sdk~译Q,甚至手动调用mxmlc~译?/p>

有了开发环境,那么我们p下蝲AsWing开发包Qƈ且配|我们的开发工兗?/p>

可以?http://code.google.com/p/aswing/downloads/list 下蝲AsWing开发包?/p>

扑ֈ aswing_a3_1.2_fx.zip ?aswing_a3_1.2_fl.zip 其中 1.2 表示版本P一般下载最新的p。后面的 fx ?fl 代表适合的编译环境。一般如果用flex sdk的话׃载fxl尾的包。用flashCS3的话׃载fll尾的?/p>

当然你也可以通过svn客户端取出最新的AsWing代码Q具体方法就不再赘述了,svn地址见:http://www.aswing.org/?page_id=4 ?/p>

下面具体介绍下在FlexBuilder3和FlashCS3中的配置Ҏ(gu)。其他工具雷同。本Z用Windows操作pȝQ其他系l下的操作方式基本一致?/p>

  • FlexBuilder3:
    压~包解压后,扑ֈ里面的aswing_a3_1.2.zipQ解压,?AsWingA3/bin 目录中的 AsWingA3.swc 复制C存放AS代码库的目录。比如我其攑֜ E:/AS3 目录中。然后再FB3中新Z个ActionScript目Q右键该目打开目属性窗口,选择ActionScript Build PathQ然后切换到 Library pathQ点?Add SWC… 览到刚才复制的那个文gQ按照我刚才存放的\径就? E:/AS3/AsWingA3.swcQ然后点击OK卛_?/li>
  • Flash CS3
    同样先解压然后找到aswing_a3_1.2.zipq解压,׃Flash IDE不支持用纯AS打包的SWC作ؓ~译库\径,所以我们先AsWingA3整个目录复制到所需位置Q如 E:/AS3?br /> ?后打开Flash CS3Q点击菜单栏中的 ~辑 q打开 首选参数窗口点d边列表中的ActionScriptQ然后点下方? ActionScript 3.0 讄… 打开c\径设|窗口,AsWing的src目录dq去Q按照我的文件\径就是将 E:\AS3\AsWingA3\src q个路径dq去Q然后点定可以了?/li>

P.S.当然FB3也可以用目录作为编译\径,是在Library path 旁的 Source path中添加一?AsWing的src目录?/p>

W一个例?Hello WorldQ?/h2>

FB中在刚才建的ActionScript目中新Z个ActionScript class文gQ输入下面的代码?/p>

package {
import flash.display.Sprite;

import org.aswing.AsWingManager;
import org.aswing.FlowLayout;
import org.aswing.JButton;
import org.aswing.JFrame;
import org.aswing.JOptionPane;
import org.aswing.event.AWEvent;

public class HelloAsWing extends Sprite {

private var myFrame:JFrame;
private var myButton:JButton;

public function HelloAsWing() {
AsWingManager.initAsStandard(this);

myButton = new JButton("Click Me");
myButton.addActionListener(__buttonClicked);

myFrame = new JFrame(this, "My Frame");
myFrame.getContentPane().setLayout(new FlowLayout());
myFrame.getContentPane().append(myButton);

myFrame.setSizeWH(300, 200);
myFrame.show();
}

private function __buttonClicked(e:AWEvent):void {
JOptionPane.showMessageDialog("Hello", "Hello, World!");
}
}
}

如果是用Flash CS3Q可以先新徏一个ActionScript文gQ输入代码后Q保存ؓHelloAsWing.asQ然后新Z个Flash (ActionScript3.0)文gQ将该fla文g保存在与HelloAsWing.as的同一U目录中Q然后将fla的文类讄? HelloAsWing?/p>

q行后可以看到类DL界面Q你可以试着对该H口q行各种操作Q?code>

点击 Click Me 按钮后,会弹Z个提C窗口,如下图:

 

q就是用AsWing创徏UIlg的一个非常简单的实例E序Q下面我们简单分析一下该E序的代码?code>

实例详细分析

使用AsWingQ主E序不需要基于Q何应用程序框ӞAsWing的UIlg都从flash原生的Sprite扩展而来Q所以几乎每一个AsWinglg都能被单独放到DisplayObjectContainer中ƈ能正怋用?br /> 我们的主E序仅需l承Sprite卛_Q下面分析一下构造函C的代码?/p>

AsWingManager.initAsStandard(this);

在用AsWingE序之前先调用这个方法,该方法封装了一些常用功能,调用?code>AsWingManager的setRootҎ(gu)Q用于设|容UAsWinglg的容器,q里的this׃表了当前AsWinglg的root。另外还会设|一些系l参敎ͼ?alignQscaleMode{?/p>

myButton = new JButton("Click Me");
myButton.addActionListener(__buttonClicked);

JButton 是AsWing中基本的按钮lgQ这里新Z一个JButton实例Qƈ讄按钮的LabelQ第二句代码l按钮添加一个事件监听,当点L钮后׃触发Q这里的addActionListener是AsWing设计成简化了事g监听的写法,当然也可以写成这?myButton.addEventListener(AWEvent.ACT, __buttonClicked);?br /> AwEvent是AsWing中最基本的事件类QACT事gcd表示一些基本组件的触发事gcdQ如JButton的鼠标点MӞJTextField的回车事件等。这里按钮点d׃执行 __buttonClicked 事g处理函数Q函C代码E后讨论?/p>

myFrame = new JFrame(this, "My Frame");
myFrame.getContentPane().setLayout(new FlowLayout());
myFrame.getContentPane().append(myButton);

JFrame是常用的H口lgQ有cM操作pȝH口的基本特性,如最?大化Q关闭,~放Q拖动能功能。JFrame的第一个参数指CH口所在的容器Q第二个参数讄H口头部的labelQ即titleQ?br /> getContentPane()Ҏ(gu)获取JFrame容纳其他lg的容器,向JFrame中添加组件记得不要直接调?code>JFrame?code>appendҎ(gu)QJFrame 真正容纳其他lg的不是本w,而是其内部的一个容器,?code>getContentPane()Ҏ(gu)获取?br /> 每个容器排列lg的方式都由Layout控制QsetLayout是讄容器的布局方式Q关于布局请参考《AsWing布局理入门》?br /> 然后是调用容器的appendҎ(gu)刚才的按钮加入到JFrame的容器中?/p>

myFrame.setSizeWH(300, 200);
myFrame.show();

q两句代码就比较单了Q设|JFrame的尺寸,q让JFrame昄出来。可能你发现没有使用addChildҎ(gu)Q没关系QJFramel承 JPopupQ所有基于JPopup的组ӞAsWing都会自动替你d到DisplayList中,调用show() Ҏ(gu)可以设|ؓ可见?/p>

下面看下很简单的事g处理函数

private function __buttonClicked(e:AWEvent):void {
JOptionPane.showMessageDialog("Hello", "Hello, World!");
}

JOptionPane是一个类似Alert的组ӞshowMessageDialog() Ҏ(gu)xCZ个消息框Q第一个参Cؓ消息框的titleQ第二个参数讄消息内容的字W?/p>

l束?/h2>

如今Zflashplayer的RIA技术非常流行,要开发这L应用E序免不了会用C用户交互的UIlgQAsWing正是q样一套强大的 lg 库,提供了常用的基本lgQ开发者也可能很容易扩展出自己特制的组件。AsWing的灵zM得开发者不会被特定的条件约束,你可以在整个目中完全? AsWing作ؓGUI交换lgQ也可以仅把AsWing的某一个组件用在你的项目中Q帮助你快速的得到所需的UI界面?br /> AsWing的开发者还在不断的改进AsWingQ其更强大Q易用?br /> 本文仅介l了最基本的AsWing使用Q其更多强大的性能正等着你来发掘Q请参考其他AsWing相关教程?/p>

下蝲资源

参考资?/h2>

gembin 2008-08-11 18:36 发表评论
]]>AsWing ?Java 之间的交?/title><link>http://www.aygfsteel.com/gembin/archive/2008/08/11/221358.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Mon, 11 Aug 2008 10:35:00 GMT</pubDate><guid>http://www.aygfsteel.com/gembin/archive/2008/08/11/221358.html</guid><wfw:comment>http://www.aygfsteel.com/gembin/comments/221358.html</wfw:comment><comments>http://www.aygfsteel.com/gembin/archive/2008/08/11/221358.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/gembin/comments/commentRss/221358.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/gembin/services/trackbacks/221358.html</trackback:ping><description><![CDATA[     摘要:   <a href='http://www.aygfsteel.com/gembin/archive/2008/08/11/221358.html'>阅读全文</a><img src ="http://www.aygfsteel.com/gembin/aggbug/221358.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/gembin/" target="_blank">gembin</a> 2008-08-11 18:35 <a href="http://www.aygfsteel.com/gembin/archive/2008/08/11/221358.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ƺ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank">̫</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ϫ</a>| <a href="http://" target="_blank">ƺ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ϫ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ǿ</a>| <a href="http://" target="_blank">ɽʡ</a>| <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">۶</a>| <a href="http://" target="_blank">˳</a>| <a href="http://" target="_blank">¸</a>| <a href="http://" target="_blank">ϳ</a>| <a href="http://" target="_blank">̨ʡ</a>| <a href="http://" target="_blank">綫</a>| <a href="http://" target="_blank">¯</a>| <a href="http://" target="_blank">ƺ</a>| <a href="http://" target="_blank">Ƶ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>