Set MaterialsDownload Example

// Class Main.as
package  
{
	import flare.basic.*
	import flare.core.*
	import flare.materials.*
	import flare.system.*
	import flare.utils.*
	import flash.display.*
	import flash.events.*
	
	public class Main extends Sprite
	{
		private var scene:Scene3D
		private var texture0:Texture3D
		private var texture1:Texture3D
		
		public function Main() 
		{
			stage.quality = "medium"
			
			// creates the scene.
			scene = new Viewer3D( this )
			
			// define complete event.
			scene.addEventListener( Scene3D.COMPLETE_EVENT, completeEvent )			
			
			// load the 3d scene.
			scene.addChildFromFile( "scene.f3d" )			
			
			// load some textures.
			texture0 = scene.addTextureFromFile( "texture.jpg" )
			texture1 = scene.addTextureFromFile( "reflection.jpg" )
			
			// some materials can change the uvs, this prevents to start rendering the scene.
			scene.pause()
		}
		
		private function completeEvent(e:Event):void 
		{
			// creates the MultiMaterial.
			var material:MultiMaterial = new MultiMaterial()
			
			// define the channels 0 and 1.
			material.setTextureChannel( 0, texture0 )
			material.setPlanarChannel( 1, texture1, 200 )
			
			// set the blendMode for the channels.
			material.setBlendMode( BlendMode.HARDLIGHT )
			
			// apply the material to entire scene.
			scene.setMaterial( material )
			
			// continue rendering the scene.
			scene.resume()
		}
	}
}