0 Replies Latest reply on Jan 7, 2011 5:21 AM by sankar_bhatta

    bitmapfilematerial image as external URL

    sankar_bhatta
      1. i am using the below code in flex 3 when i execute the swf file i am not able to see the image in plane. the image URL is correct. you can check it by pasting the URL in IE. is there anyhting i am missing here.
      2. <?xml version="1.0" encoding="utf-8"?>

        <mx:Application

        xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" applicationComplete="init();" backgroundGradientColors="[#AEE8F4, #131617]" backgroundGradientAlphas="[1.0, 1.0]">

        <mx:Script>

        <![CDATA[

        //Import Papervision Classes

         

        import org.papervision3d.core.proto.MaterialObject3D;

         

        import mx.controls.Image;

         

        import org.papervision3d.scenes.*;

         

        import org.papervision3d.cameras.*;

         

        import org.papervision3d.objects.*;

         

        import org.papervision3d.objects.primitives.*;

         

        import org.papervision3d.materials.*;

         

        import org.papervision3d.materials.shadematerials.*;

         

        import org.papervision3d.materials.utils.MaterialsList;

         

        import org.papervision3d.lights.*;

         

        import org.papervision3d.render.*;

         

        import org.papervision3d.view.*;

         

        import org.papervision3d.events.*;

         

        import org.papervision3d.core.material.*;

         

        import org.papervision3d.lights.PointLight3D;

         

        import flash.filters.DropShadowFilter;

         

        import caurina.transitions.*;

         

         

        private var numOfItems:int = 10;

         

        private var radius:Number = 600;

         

        private var anglePer:Number = (Math.PI*2) / numOfItems;

         

        public var angleX:Number = anglePer;

         

        public var dest:Number = 1;

         

        private var theLight:PointLight3D;

         

         

         

        private var viewport:Viewport3D;

         

        private var scene:Scene3D;

         

        private var camera:Camera3D;

         

        private var renderer:BasicRenderEngine;

         

         

        private var planeArray:Array = new Array();

        [

        Bindable]

         

        public var object:Object;

         

         

        private var arrayPlane:Object;

         

         

         

        //Initiation function

         

         

        private function init():void

        {

         

        viewport =

        new Viewport3D(pv3dCanvas.width, pv3dCanvas.height, false, true);

        pv3dCanvas.rawChildren.addChild(viewport);

        viewport.buttonMode=

        true;

         

        renderer =

        new BasicRenderEngine();

        scene =

        new Scene3D();

        camera =

        new Camera3D();

        camera.zoom = 2;

         

        createObjects();

        addEventListeners();

         

        }

         

         

         

        private function createObjects():void

        {

         

        BitmapFileMaterial.LOADING_COLOR = 0x0000FF;

        BitmapFileMaterial.ERROR_COLOR = 0xFF0000;

         

        var material:BitmapFileMaterial = new BitmapFileMaterial("http://blog.flashmech.net/wp-content/uploads/2008/07/flashmech-rss.gif");

        material.doubleSided =

        true;

        var

        plane :Plane = new Plane( material, 300, 100, 10, 10 );

        scene.addChild( plane );

        }

        private

        function addEventListeners():void{

         

        this.addEventListener(Event.ENTER_FRAME, render);

         

        }

         

        //Enter Frame Listener function

         

        private

        function render(e:Event):void{

         

        renderer.renderScene(scene, camera, viewport);

         

        camera.x = Math.cos(angleX) * 800;

        camera.z = Math.sin(angleX) * 800;

         

        }

        ]]>

         

        </mx:Script>

         

         

        <mx:Canvas id="pv3dCanvas" x="503" y="20" width="400" height="204" borderColor="#110101" backgroundColor="#841414" alpha="1.0" backgroundAlpha="0.57">

         

        </mx:Canvas>

         

         

        </mx:Application>