ActionScript Reference

 

Properties

 

Methods

 

Events

 

 

 

Properties

 

camX

Availability

Flash Player 7

Usage

3DEnvironment.camX

Description

Number. Sets the x position of camera.

Example

my3DEnvironment.camX = 100;
trace(my3DEnvironment.camX);

 

 

camY

Availability

Flash Player 7

Usage

3DEnvironment.camY

Description

Number. Sets the y position of camera.

Example

my3DEnvironment.camY = 100;
trace(my3DEnvironment.camY);

 

 

camZ

Availability

Flash Player 7

Usage

3DEnvironment.camZ

Description

Number. Sets the z position of camera.

Example

my3DEnvironment.camZ = 100;
trace(my3DEnvironment.camZ);

 

 

degX

Availability

Flash Player 7

Usage

3DEnvironment.degX

Description

Number. Sets the x angle of the environment.

Example

my3DEnvironment.degX = 45;
trace(my3DEnvironment.degX);

 

 

degY

Availability

Flash Player 7

Usage

3DEnvironment.degY

Description

Number. Sets the y angle of the environment.

Example

my3DEnvironment.degY = 45;
trace(my3DEnvironment.degY);

 

 

degZ

Availability

Flash Player 7

Usage

3DEnvironment.degZ

Description

Number. Sets the z angle of the environment.

Example

my3DEnvironment.degZ = 45;
trace(my3DEnvironment.degZ);

 

 

viewLength

Availability

Flash Player 7

Usage

3DEnvironment.viewLength

Description

Number. Sets the depth of the camera field.

Example

my3DEnvironment.viewLength = 5000;
trace(my3DEnvironment.viewLength);

 

 

 

Methods

 

addObj

Availability

Flash Player 7

Usage

3DEnvironment.addObj(obj:Object)

Parameters

obj:Object. object containing x, y, z, linkageId and regName attributes.

Description

Add an object to the 3D environment.

Example

// example 1
my3DEnvironment.addObj({x:0, y:0, z:0, linkageId:"obj mc", regName:"object1"});

// example 2
my3DEnvironment.addObj({x:0, y:0, z:0, regName:"object2", url:"img.jpg"});

 

 

getObj

Availability

Flash Player 7

Usage

3DEnvironment.getObj(regName:String)

Parameters

regName:String. The name of the object when added to the 3D environment.

Description

Returns an object that contains the x, y, z, linkageId and regName of a 3D object.

Example

var myObject:Object = my3DEnvironment.getObj("object1");
for(var i:String in myObject){
trace(i + " : " + myObject[i]);
}

 

 

getObjClip

Availability

Flash Player 7

Usage

3DEnvironment.getObjClip(regName:String)

Parameters

regName:String. The name of the object when added to the 3D environment.

Description

Returns a MovieClip reference of an object in the 3D environment.

Example

var myClip:MovieClip = my3DEnvironment.getObjClip("object1");


loadXML

Availability

Flash Player 7

Usage

3DEnvironment.loadXML(url:String)

Parameters

url:String. The URL/filename of the XML file to load.

Description

Loads an XML file containing the data for the 3DEnvironment.

Example

my3DEnvironment.loadXML("3dfile.xml");

 

 

motionCam

Availability

Flash Player 7

Usage

3DEnvironment.motionCam(pos:Object, fra:Number)

Parameters

pos:Object. Object containing x, y and z coordinates.
fra:Number. Duration of tween in frames.

Description

Tweens the camera to the specific position.

Example

var pos:Object = {x:100, y:100, z:100};
var fra:Number = 10;
my3DEnvironment.motionCam(pos, fra);

 

 

motionObj

Availability

Flash Player 7

Usage

3DEnvironment.motionObj(regName:String, pos:Object, fra:Number)

Parameters

regName:String. The name of the object when added to the 3D environment.
pos:Object. Object containing x, y and z coordinates.
fra:Number. Duration of tween in frames.

Description

Tweens the 3D object to a specific position.

Example

var pos:Object = {x:100, y:100, z:100};
var fra:Number = 10;
my3DEnvironment.motionObj("object1", pos, fra);

 

 

moveCam

Availability

Flash Player 7

Usage

3DEnvironment.moveCam(x:Number, y:Number, z:Number)

Parameters

x:Number. x target position.
y:Number. y target position.
z:Number. z target position.

Description

Moves the camera to a specific position.

Example

my3DEnvironment.moveCam(100, 100, 100);

 

 

moveObj

Availability

Flash Player 7

Usage

3DEnvironment.moveObj(regName:String, pos:Object)

Parameters

regName:String. The name of the object when added to the 3D environment.
pos:Object. Object containing x, y and z coordinates.

Description

Moves the camera to a specific position.

Example

var pos:Object = {x:100, y:100, z:100};
my3DEnvironment.moveObj("object1", pos);

 

 

removeAll

Availability

Flash Player 7

Usage

3DEnvironment.removeAll()

Description

Removes all objects from the 3DEnvironment.

Example

my3DEnvironment.removeAll();

removeObj

Availability

Flash Player 7

Description

Removes a single object from the 3D environment.

Example

3DEnvironment.removeObj("object regName");

 

 

rotateX

Availability

Flash Player 7

Usage

3DEnvironment.rotateX(ang:Number, fra:Number)

Parameters

ang:Number. Target angle.
fra:Number. Duration of movement.

Description

Tween the 3D environment around the x axis.

Example

my3DEnvironment.rotateX(180, 10);

 

 

rotateY

Availability

Flash Player 7

Usage

3DEnvironment.rotateY(ang:Number, fra:Number)

Parameters

ang:Number. Target angle.
fra:Number. Duration of movement.

Description

Tween the 3D environment around the y axis.

Example

my3DEnvironment.rotateY(180, 10);

 

 

rotateZ

Availability

Flash Player 7

Usage

3DEnvironment.rotateZ(ang:Number, fra:Number)

Parameters

ang:Number. Target angle.
fra:Number. Duration of movement.

Description

Tween the 3D environment around the z axis.

Example

my3DEnvironment.rotateZ(180, 10);

 

 

setLoaderSize

Availability

Flash Player 7

Usage

3DEnvironment.setLoaderSize(w:Number, h:Number)

Description

Sets the loader size.

Example

my3DEnvironment.setLoaderSize(300, 400);

 

 

setSize

Availability

Flash Player 7

Usage

3DEnvironment.setSize(w:Number, h:Number)

Description

Sets the width and height of the 3DEnvironment component.

Example

my3DEnvironment.setSize(300, 400);

 

 

stepCam

Availability

Flash Player 7

Usage

3DEnvironment.stepCam(pos:Object, fra:Number)

Description

Tweens camera relative to its current position.

Example

var pos:Object = {x:100, y:100, z:100};
my3DEnvironment.stepCam(pos, 10);

 

 

stepObj

Availability

Flash Player 7

Usage

3DEnvironment.stepObj(regName:String, pos:Object, fra:Number)

Description

Tweens 3D object relative to its current position.

Example

var pos:Object = {x:100, y:100, z:100};
my3DEnvironment.stepObj("object1", pos, 10);

 

 

 

 

Events

 

addEventListener

Description

Refer to Flash's built-in help files.

 

 

onCameraMotionComplete

Availability

Flash Player 7

Usage

3DEnvironment.onCameraMotionComplete = function()

Description

Event broadcast when the camera motion has stopped.

Example

var lis={};
lis.onCameraMotionComplete=function(evt){

//event type
var type=evt.type;

//source of event
var target=evt.target;

}
world.addEventListener("onCameraMotionComplete",lis);

 

 

onObjectMotionComplete

Availability

Flash Player 7

Usage

3DEnvironment.onObjectMotionComplete = function()

Description

Event broadcast when the object motion has stopped.

Example

var lis={};
lis.onObjectMotionComplete=function(evt){

//event type
var type=evt.type;

//source of event
var target=evt.target;

//object that triggle the event
var obj=evt.obj;

//regName of the object
var regName=evt.regName;
}
world.addEventListener("onObjectMotionComplete",lis);

 

 

onLoadXML

Availability

Flash Player 7

Usage

3DEnvironment.onLoadXML = function()

Description

Event broadcast when XML has finished loading.

Example

var lis={};
lis.onLoadXML=function(evt){

//event type
var type=evt.type;

//source of event
var target=evt.target;

}
world.addEventListener("onLoadXML",lis);

 

onLoadXMLFailed

Availability

Flash Player 7

Usage

3DEnvironment.onLoadXMLFailed = function()

Description

Event broadcast when XML loading fails.

Example

var lis={};
lis.onLoadXMLFailed=function(evt){

//event type
var type=evt.type;

//source of event
var target=evt.target;

}
world.addEventListener("onLoadXMLFailed",lis);

 

onReleaseObject

Availability

Flash Player 7

Usage

3DEnvironment.onReleaseObject = function()

Description

Event broadcast when the mouse is released over an object.

Example

var lis:Object = new Object();
lis.onReleaseObject = function(evt){ 
	trace("type: " + evt.type + " target: " + evt.target + " regName: " + evt.regName + " mc: " + evt.mc);
}
world.addEventListener("onReleaseObject",lis);

 

 

onWorldInit

Availability

Flash Player 7

Usage

3DEnvironment.onWorldInit = function()

Description

Event broadcast when the environment is initialized or after the object movie clip is attached to the stage.

Example

var lis:Object = new Object();
lis.onWorldInit = function(){ 
	trace("Environment initialized");
}
world.addEventListener("onWorldInit",lis);

 

 

removeEventListener

Description

Please refer to the Flash built-in help files.