Posted by Sankar.G | Posted in papervision | Posted on 5:15 PM
copy this below code and save it as a "four.as" and give link to the file from flash and dont forget
the download the papervision.zip file from the previous Blog and kept org & com & fl & this as file and
fla file in the same folder and run the file it will work
package
{
import flash.display.ActionScriptVersion;
import flash.display.Scene;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.MouseEvent;
import org.papervision3d.cameras.Camera3D;
import org.papervision3d.lights.PointLight3D;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.render.BasicRenderEngine;
import org.papervision3d.scenes.Scene3D;
import org.papervision3d.view.Viewport3D;
import org.papervision3d.core.utils.InteractiveSceneManager;
import org.papervision3d.events.FileLoadEvent;
import org.papervision3d.materials.BitmapFileMaterial;
import org.papervision3d.objects.primitives.Plane;
public class four extends Sprite
{
private var view:Viewport3D;
private var camera:Camera3D;
private var light:PointLight3D;
private var plane:Plane;
private var render:BasicRenderEngine;
private var scene:Scene3D;
private var man:InteractiveSceneManager;
private var universe:DisplayObject3D;
private var mat:BitmapFileMaterial;
public function four():void
{
init();
}
private function init():void
{
view = new Viewport3D(0, 0, true);
view.opaqueBackground = 0x000000;
addChild(view);
man = new InteractiveSceneManager(view);
camera = new Camera3D();
camera.z = -2000;
camera.zoom = 2;
light = new PointLight3D(false);
scene = new Scene3D();
render = new BasicRenderEngine();
universe = new DisplayObject3D();
mat = new BitmapFileMaterial();
mat.texture ="http://www.flowerstodubai.com/images/Mixed%20Flowers%20and%20a%20Bear.jpg"
mat.interactive = true;
mat.smooth = true;
mat.tiled = true;
mat.addEventListener(FileLoadEvent.LOAD_COMPLETE, call);
function call(event:FileLoadEvent):void
{
plane = new Plane(mat, 3000, 3000, 8);
universe.addChild(plane);
scene.addChild(universe);
addEventListener(Event.ENTER_FRAME, fun);
man.container.addEventListener(MouseEvent.CLICK, click);
}
}
private function click(event:MouseEvent):void
{
plane.rotationZ += 10;
}
private function fun(event:Event):void
{
render.renderScene(scene, camera, view);
}
}
}
the download the papervision.zip file from the previous Blog and kept org & com & fl & this as file and
fla file in the same folder and run the file it will work
package
{
import flash.display.ActionScriptVersion;
import flash.display.Scene;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.MouseEvent;
import org.papervision3d.cameras.Camera3D;
import org.papervision3d.lights.PointLight3D;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.render.BasicRenderEngine;
import org.papervision3d.scenes.Scene3D;
import org.papervision3d.view.Viewport3D;
import org.papervision3d.core.utils.InteractiveSceneManager;
import org.papervision3d.events.FileLoadEvent;
import org.papervision3d.materials.BitmapFileMaterial;
import org.papervision3d.objects.primitives.Plane;
public class four extends Sprite
{
private var view:Viewport3D;
private var camera:Camera3D;
private var light:PointLight3D;
private var plane:Plane;
private var render:BasicRenderEngine;
private var scene:Scene3D;
private var man:InteractiveSceneManager;
private var universe:DisplayObject3D;
private var mat:BitmapFileMaterial;
public function four():void
{
init();
}
private function init():void
{
view = new Viewport3D(0, 0, true);
view.opaqueBackground = 0x000000;
addChild(view);
man = new InteractiveSceneManager(view);
camera = new Camera3D();
camera.z = -2000;
camera.zoom = 2;
light = new PointLight3D(false);
scene = new Scene3D();
render = new BasicRenderEngine();
universe = new DisplayObject3D();
mat = new BitmapFileMaterial();
mat.texture ="http://www.flowerstodubai.com/images/Mixed%20Flowers%20and%20a%20Bear.jpg"
mat.interactive = true;
mat.smooth = true;
mat.tiled = true;
mat.addEventListener(FileLoadEvent.LOAD_COMPLETE, call);
function call(event:FileLoadEvent):void
{
plane = new Plane(mat, 3000, 3000, 8);
universe.addChild(plane);
scene.addChild(universe);
addEventListener(Event.ENTER_FRAME, fun);
man.container.addEventListener(MouseEvent.CLICK, click);
}
}
private function click(event:MouseEvent):void
{
plane.rotationZ += 10;
}
private function fun(event:Event):void
{
render.renderScene(scene, camera, view);
}
}
}
I like your blog.
Thank you