Step2: OPen new document: CTRL+N or file open new
Step3: Save files in PV3D_1_5\src folder
Step4: Paste code in first frame of action panel
// import the necessary files..
import org.papervision3d.scenes.*;
import org.papervision3d.cameras.*;
import org.papervision3d.objects.*;
import org.papervision3d.materials.*;
var container:Sprite=new Sprite();
container.x=stage.stageWidth*0.5;
container.y=stage.stageHeight*0.5;
addChild(container);
this.frameRate=40;
//creating scene basic for papervision; among multiple scenes Scene3D is basic one
var scene:Scene3D=new Scene3D(container);
//camera to see objects
var camera:Camera3D=new Camera3D();
//initial camera zoom is (0,0,0);
//to zoom object into scene..
camera.zoom=5;
//star making planes...
//create material-by attaching bitmap using BitmapAssetMaterial
var bam:BitmapAssetMaterial=new BitmapAssetMaterial("FlashIcon");
//by default material applied to one side of object(here plane);
bam.oneSide=false;
bam.smooth=true;
for (var i:int=0; i<50; i++) {
//new Plane(material,height, width,triangle num,triangle num)---triangle num to control quality
var p:Plane=new Plane(bam,250,150,2,2);
scene.addChild(p);
p.x=Math.random()*1000-500;//gives value from -500 to 500
p.y=Math.random()*1000-500;
p.z=Math.random()*1000-500;
p.rotationY=Math.random()*360;//rotate individual
}
this.addEventListener(Event.ENTER_FRAME,render);
function render(e:Event) {
camera.x+=stage.mouseX-(stage.stageWidth*0.5);
//p.rotationY+=2
camera.y+=stage.mouseY-(stage.stageHeight*0.5);
//to render camera.. to view scene
scene.renderCamera(camera);
}
Note: Code contains explanations..
Important please add an image in stage and give a linkage name for that here we used FlashIcon
SourceFile here
4 comments:
Getting this error:
Papervision3D Beta RC1.1 (18.06.07)
DisplayObject3D: null
DisplayObject3D: null
ReferenceError: Error #1065: Variable FlashIcon is not defined.
at global/flash.utils::getDefinitionByName()
at org.papervision3d.materials::BitmapAssetMaterial/createBitmap()
at org.papervision3d.materials::BitmapMaterial/set texture()
at org.papervision3d.materials::BitmapMaterial()
at org.papervision3d.materials::BitmapAssetMaterial()
at test_fla::MainTimeline/frame1()
HI,
Really sorry i forget to tell this
Important please add an image in stage and give a linkage name for that here we used FlashIcon , and delete the image in stage..
tell me if it works
I got the same error and tried your suggestion with no success. Any other suggestions?
HI,
I have updated the sample file for your reference..
The error is because of no image in library with linkage name we specified "FlashIcon"..
Regards
Saravanan
Post a Comment