Tag: code
embed xml
[sourcecode language=”actionscript3″]
[Embed(source="info.xml", mimeType="application/octet-stream")]
protected var EmbeddedXML:Class;
var ba : ByteArray = (new EmbeddedXML()) as ByteArray;
var s : String = ba.readUTFBytes( ba.length );
xml = new XML( s );
[/sourcecode]
swf 是自己還是載入?
if(this.parent == stage);
(一日未 add child ,呢招都唔 work)
if (this.stage != null) {
}
but this work
load 入去個個,個 stage 會變左 null =.=
graffiti framework
得 Outline Material
3D Font, papervision
papervision, 關於上色
陰影很怪。
這個本應使用了 FlatShadeMaterial 去直接打光上去上色。
在 cube 上再加上一塊 bitmap mapping / movieClip mapping / colorMaterial
[sourcecode language=”actionscript3″]
material = new CompositeMaterial();
var mat = new ColorMaterial(ColorLibrary.YELLOW_COLOR, THREE_D_OBJ_ALHPA);
material.addMaterial(mat);
var mat = new FlatShadeMaterial(_light, Conf.LIGHT_COLOR, Conf.AMBIENT_COLOR, 20, THREE_D_OBJ_ALHPA);
material.addMaterial(mat);[/sourcecode]
將兩個 material 合埋使用,
因為立體有了自身的顏身再上 flatShade 咁就靚曬啦!
papervision,將 TriangleMesh3D 一開二
getDefinitionNames,成個 swf 既 library 抽出黎
up 俄文既 as3 library
最出名係 getDefinitionNames
成個 swf 既 library 抽出黎既 Class
SWF Explorer, 佢既應用
http://www.bytearray.org/?p=175
external assets swf (getDefinition)
[sourcecode language=”actionscript3″]
package {
/*
the main swf that loads everything, starting with assets swf…
*/
import flash.display.*;
import flash.net.URLRequest;
import flash.utils.*;
import flash.events.Event;</code>
public class Requiem extends MovieClip {
private var AssetLoader:Loader;
private var Request:URLRequest;
private var AssetsURL:String = "RequiemAssets.swf"
public function Requiem (){
var Request = new URLRequest(AssetsURL)
var AssetLoader = new Loader()
AssetLoader.load(Request)
AssetLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete)
}
private function onComplete(e:Event):void{
trace ("Load Complete")
var ldrInfo = e.currentTarget as LoaderInfo;
ldrInfo.removeListener (Event.COMPLETE, onComplete)
var assets:MovieClip = e.currentTarget as MovieClip;
var Home:Class = assets.loaderInfo.applicationDomain.getDefinition("home")
var home:MovieClip = new Home()
addChild (home)
}
}
}
[/sourcecode]
用黎 load 一個 swf,拎佢 library 裡面d 野出黎