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 );

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);
var mat = new FlatShadeMaterial(_light, Conf.LIGHT_COLOR, Conf.AMBIENT_COLOR, 20, THREE_D_OBJ_ALHPA);

將兩個 material 合埋使用,

因為立體有了自身的顏身再上 flatShade 咁就靚曬啦!

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.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)

用黎 load 一個 swf,拎佢 library 裡面d 野出黎