Saturday, December 11, 2010

Actionscript


Ahaaa , nice part we have here , actionscript part -_-" , first of all i'm really bad in actionscript but i try to get into it but it seems still not good yet , but there's some part i change and i test it , it's worked :) (the part that i change , i highlight it )

Initiation Script (External Script)

package {



import flash.display.Sprite;

[SWF(width="640", height="480", frameRate="30", backgroundColor="#FFFFFF")]
public class launchMultiMarker extends Sprite {



public function launchMultiMarker () {


this.addChild(new MultiMarkerMultiDae()); <--Main Class

}
}
}



This one for single marker that i've tested and compiled


public function Earth() {
addEventListener(Event.INIT, _onInit);
init('Data/camera_para.dat', 'Data/test16.pat'); <--this one for the marker
}

private function _onInit(e:Event):void {
_earth = new DAE();
_earth.load('model/jupiter.DAE')<--this one for the dae;
_earth.scale = 10;
_earth.rotationX = 90;
_markerNode.addChild(_earth);

addEventListener(Event.ENTER_FRAME, _update);
}

private function _update(e:Event):void {
_earth.rotationZ -= 0.5<--this one for the dae animation (rotation)
}
}
}




This one for changing the collada models.

// (this model has to be scaled and rotated to fit the marker; every model is different.)

var model1:DAE = new DAE(true, "model1", true);
model1.load("assets/model4.dae");<--dae model

model1.rotationX = 0;
model1.rotationY = 0; <--- animation on dae model
model1.rotationZ = 0;
model1.scale = 10;

// load the model.
// (this model has to be scaled and rotated to fit the marker; every model is different.)

var model2:DAE = new DAE(true, "model2", true);
model2.load("assets/model4.dae");
trace("model4 loaded");

model2.rotationX = 0;
model2.rotationY= 0;
model2.rotationZ = 0;
model2.scale = 10;

// load the model.
// (this model has to be scaled and rotated to fit the marker; every model is different.)

var model3:DAE = new DAE(true, "model3", true);
model3.load("assets/model4.dae");

model3.rotationX = 0;
model3.rotationY= 0;
model3.rotationZ = 0;
model3.scale = 10;




XML for the multiple marker


sorry i take this code by screenshot because there's a problem when i wrote this code on this blog.

No comments:

Post a Comment