If it comes in handy:
________________ (thanks ASV6:)

package {
   import away3d.core.math.*;
   import away3d.core.base.*;
   import away3d.containers.*;
   import away3d.core.render.*;
   import away3d.primitives.data.*;
   import flash.display.*;
   import away3d.materials.*;
   import flash.utils.*;
   import away3d.cameras.*;
   import flash.events.*;
   import away3d.primitives.*;

   public class NewCubeTest extends Sprite {

       private var lastPanAngle:Number;
       private var cameradistance:Number;// = 4000
       private var lastTiltAngle:Number;
       private var camera:HoverCamera3D;
       private var cubedata:CubeMaterialsData;
       private var lastMouseY:Number;
       private var lastMouseX:Number;
       private var cube2:Cube;
       public var scene:Scene3D;
       private var zero:Number3D;
       public var view:View3D;
       private var cube3:Cube;
       private var sign:Sprite;
       private var cube1:Cube;
       private var move:Boolean;// = false
       private var sinwave:Number;// = 0

       public function NewCubeTest(){
           cameradistance = 4000;
           move = false;
           sinwave = 0;
           super();
           addEventListener(Event.ADDED_TO_STAGE, populate);
       }
       public function stop():void{
           if (this.hasEventListener(Event.ENTER_FRAME)){
               removeEventListener(Event.ENTER_FRAME, this.refreshScreen);
           };
       }
       public function refreshScreen(_arg1:Event=null):void{
           var event = _arg1;
           try {
               if (move){
camera.targetpanangle = ((0.5 * (stage.mouseX - lastMouseX)) + lastPanAngle); camera.targettiltangle = ((0.5 * (stage.mouseY - lastMouseY)) + lastTiltAngle);
               };
               this.camera.hover();
               view.render();
               sinwave = (sinwave + 0.02);
               changecubeSizes(sinwave);
           } catch(e:Error) {
               trace(("render error: " + e.message));
           };
       }
       private function showSignature():void{
           this.sign = new signature();
           this.addChild(sign);
           this.sign.y = (stage.stageHeight - sign.height);
       }
       public function start():void{
           if (!this.hasEventListener(Event.ENTER_FRAME)){
               addEventListener(Event.ENTER_FRAME, this.refreshScreen);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseIsDown);
               stage.addEventListener(MouseEvent.MOUSE_UP, onMouseIsUp);
           };
       }
       private function generateFromLib(_arg1:String):BitmapData{
           var _local2:Class;
           var _local3:Sprite;
           var _local4:BitmapData;
           _local2 = (getDefinitionByName(_arg1) as Class);
           _local3 = new (_local2);
_local4 = new BitmapData(_local3.width, _local3.height, true, 0xFFFFFF);
           _local4.draw(_local3, null, null, null, _local4.rect, true);
           return (_local4);
       }
       private function onResize(_arg1:Event):void{
           this.view.x = (stage.stageWidth * 0.5);
           this.view.y = (stage.stageHeight * 0.5);
           this.sign.y = (stage.stageHeight - sign.height);
       }
       private function generateCube():void{
           var _local1:IMaterial;
           var _local2:BitmapMaterial;
           var _local3:BitmapMaterial;
           var _local4:BitmapMaterial;
           var _local5:BitmapMaterial;
           var _local6:BitmapMaterial;
           var _local7:BitmapMaterial;
           var _local8:IMaterial;
_local1 = new BitmapMaterial(generateFromLib("singlemat"), {debug:false, showNormals:true}); cube1 = new Cube({flip:false, width:500, height:1000, depth:2000, material:_local1, segmentsH:2, segmentsW:2});
           cube1.x = (cube1.x - 1300);
           this.scene.addChild(cube1);
_local2 = new BitmapMaterial(generateFromLib("topMC"), {debug:false, showNormals:true}); _local3 = new BitmapMaterial(generateFromLib("bottomMC"), {debug:false, showNormals:true}); _local4 = new BitmapMaterial(generateFromLib("frontMC"), {debug:false, showNormals:true}); _local5 = new BitmapMaterial(generateFromLib("backMC"), {debug:false, showNormals:true}); _local6 = new BitmapMaterial(generateFromLib("leftMC"), {debug:false, showNormals:true}); _local7 = new BitmapMaterial(generateFromLib("rightMC"), {debug:false, showNormals:true}); cubedata = new CubeMaterialsData({top:_local2, bottom:_local3, front:_local4, back:_local5, left:_local6, right:_local7}); cube2 = new Cube({flip:false, width:500, height:1000, depth:2000, faces:cubedata, segmentsH:2, segmentsW:2});
           cube2.x = (cube2.x + 1300);
           this.scene.addChild(cube2);
_local8 = new BitmapMaterial(generateFromLib("qtvr"), {debug:false}); cube3 = new Cube({map6:true, flip:true, width:500, height:1000, depth:2000, material:_local8, segmentsH:2, segmentsW:2});
           (cube3 as Mesh).pushfront = true;
           this.scene.addChild(cube3);
       }
       private function onMouseIsDown(_arg1:MouseEvent):void{
           lastPanAngle = camera.targetpanangle;
           lastTiltAngle = camera.targettiltangle;
           lastMouseX = stage.mouseX;
           lastMouseY = stage.mouseY;
           move = true;
           stage.addEventListener(Event.MOUSE_LEAVE, onStageMouseLeave);
       }
       private function onMouseIsUp(_arg1:MouseEvent):void{
           move = false;
           stage.removeEventListener(Event.MOUSE_LEAVE, onStageMouseLeave);
       }
       private function initSWFEnvironement():void{
           stage.align = StageAlign.TOP_LEFT;
           stage.scaleMode = StageScaleMode.NO_SCALE;
           stage.showDefaultContextMenu = true;
           stage.stageFocusRect = false;
           stage.addEventListener(Event.RESIZE, this.onResize);
           stage.quality = "medium";
       }
       private function changecubeSizes(_arg1:Number):void{
           var _local2:Number;
           _local2 = Math.sin(_arg1);
           cube1.width = (600 + (_local2 * 400));
           cube1.height = (500 + (_local2 * 200));
           cube1.depth = (500 + (-(_local2) * 120));
           cube2.width = (200 + (_local2 * 300));
           cube2.height = (300 + (_local2 * 400));
           cube2.depth = (500 + (_local2 * 200));
           cube3.width = (700 + (_local2 * 450));
           cube3.height = (200 + (_local2 * 300));
           cube3.depth = (500 + (-(_local2) * 400));
       }
       private function prepareWorld():void{
           this.scene = new Scene3D();
           this.camera = new HoverCamera3D();
this.view = new View3D({scene:this.scene, camera:this.camera, renderer:Renderer.BASIC});
           this.view.x = (stage.stageWidth * 0.5);
           this.view.y = (stage.stageHeight * 0.5);
           this.addChild(this.view);
           camera.distance = this.cameradistance;
           camera.mintiltangle = -90;
           camera.maxtiltangle = 90;
           camera.yfactor = 1;
           camera.targetpanangle = (camera.panangle = 0);
           camera.targettiltangle = (camera.tiltangle = 20);
           this.view.camera.x = 0;
           this.view.camera.y = 6000;
           this.view.camera.z = 3000;
           zero = new Number3D(0, 0, 0);
           this.view.camera.lookAt(zero);
           this.scene.addChild(new Trident(500, true));
       }
       private function onStageMouseLeave(_arg1:Event):void{
           move = false;
           stage.removeEventListener(Event.MOUSE_LEAVE, onStageMouseLeave);
       }
       private function populate(_arg1:Event):void{
           this.prepareWorld();
           this.generateCube();
           this.start();
           this.showSignature();
           this.initSWFEnvironement();
       }

   }
}


Darcey Lloyd wrote:
Hi,

I was wondering would it be possible to get the source code behind -http://www.closier.nl/playground/cubeprops.swf

Thanks

D





2009/2/13 Anton Kulaga <[email protected] <mailto:[email protected]>>


    Thanks

    2009/2/13 Fabrice <[email protected] <mailto:[email protected]>>:
    > Fixed!
    > http://www.closier.nl/playground/cubeprops.swf
    > Fabrice
    > On Feb 13, 2009, at 11:40 AM, Anton Kulaga wrote:
    >
    > see if things have been fixed
    >
    > Unfortunately, some new bugs have arrived.
    > For instance, I still cannot change the width and height of the
    cube.
    > I have mentioned about this bug earlier (when it firstly appeared in
    > trunk, see
    >
    
http://groups.google.com/group/away3d-dev/browse_thread/thread/8e1e566e9ac2a5f1),
    > but it is still UNFIXED!
    >
    >
    >
    > 2009/2/13 Rob Bateman <[email protected]
    <mailto:[email protected]>>:
    >
    > Hi all
    >
    > If you've been wondering why we may seem to have been holding
    off a bit
    >
    > these last few days with your problems and bugfixes - it's
    because the new
    >
    > release was being made ready for launch. Well, wait no more
    because the new
    >
    > version has arrived!
    >
    > downloads already exist in the usual places at
    >
    > http://www.away3d.com/downloads and
    >
    > http://code.google.com/p/away3d/source/checkout.
    >
    > This release has been about two things, consolidating the existing
    >
    > framework, and adding new features. To those of you who have
    been having
    >
    > problems with 2.2, i urge you to check out 2.3 to see if things
    have been
    >
    > fixed! during this last development cycle we passed the 1000th
    revision mark
    >
    > on the Away3D codebase, so congrats to all team members on a job
    well done!
    >
    > aside from all the fixes and patches, here's some of what you
    can expect to
    >
    > see in the new version:
    >
    > Frustum and nearfield clipping
    >
    > Object culling (using frustum calculations)
    >
    > Interchangeable camera lenses to allow for different types of
    projection
    >
    > All values allowed for stage properties "align" and "scaleMode"
    >
    > Advanced normalmap tools
    >
    > Bezierpatch tool for creating smooth surfaces
    >
    > Improved memory management
    >
    > Improved extrusion tools
    >
    > ROLL_OVER/ROLL_OUT events added to MouseEvent3D
    >
    > Billboard mesh objects
    >
    > Head over to away3d.com <http://away3d.com> for a brand new demo
    with source code for frustum
    >
    > clipping! As you will see, it is a doddle to use and a very
    useful addition.
    >
    > More sources on some of the other features mentioned will be
    released as
    >
    > soon as possible. And finally, an update to the Flash10 branch
    will be
    >
    > occuring in the new few days, to move in line with these most recent
    >
    > updates.
    >
    >
    > enjoy the new release!
    >
    >
    > The Away3D Team
    >
    >
    >
    > --
    >
    > Rob Bateman
    >
    > Flash Development & Consultancy
    >
    > [email protected] <mailto:[email protected]>
    >
    > www.infiniteturtles.co.uk <http://www.infiniteturtles.co.uk>
    >
    > www.away3d.com <http://www.away3d.com>
    >
    >
    >



Reply via email to