Control ObjectsDownload Example

// Class Main.as
package  
{
	import flare.basic.*
	import flare.core.*
	import flare.utils.*
	import flash.display.*
	import flash.events.*
	
	public class Main extends Sprite
	{
		private var scene:Scene3D
		private var cylinder:Pivot3D
		private var pyramid:Pivot3D
		private var sphere:Pivot3D
		
		public function Main() 
		{
			stage.quality = "medium"
			
			// creates the scene.
			scene = new Viewer3D( this, "scene.f3d" )
			
			// define progress and complete events.
			scene.addEventListener( Scene3D.PROGRESS_EVENT, progressEvent )			
			scene.addEventListener( Scene3D.COMPLETE_EVENT, completeEvent )			
		}
		
		private function progressEvent(e:Event):void 
		{
			// trace( scene.loadProgress )
		}
		
		private function completeEvent(e:Event):void 
		{
			// trace info about the scene.
			Pivot3DUtils.traceInfo( scene )
			
			// once completed, we can access to 3d objects.
			cylinder = scene.getChildByName( "cylinder" )
			pyramid  = scene.getChildByName( "pyramid" )
			sphere = scene.getChildByName( "sphere" )
			
			// we begin update the scene.
			scene.addEventListener( Scene3D.UPDATE_EVENT, updateEvent )
		}
		
		private function updateEvent(e:Event):void 
		{
			// update objects.
			cylinder.rotateZ( 2 )
			pyramid.rotateY( 2 )			
			sphere.setScale( 0.25, 0.25, 0.25 )
		}
	}
}