Hi all,
After Away3d changed Plane to Mesh with PlaneGeometry.
Then it can not update the width and height in run time.
this is the way I found for change the width
PlaneGeometry(plane.geometry).width = 123;
below is my example:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
pageTitle="Plane Resize Testing"
minWidth="955" minHeight="600"
backgroundAlpha="0">
<s:layout>
<s:VerticalLayout />
</s:layout>
<fx:Script>
<![CDATA[
import away3d.cameras.Camera3D;
import away3d.containers.Scene3D;
import away3d.containers.View3D;
import away3d.controllers.HoverController;
import away3d.entities.Mesh;
import away3d.materials.ColorMaterial;
import away3d.primitives.PlaneGeometry;
private var plane:Mesh;
private var scene:Scene3D;
private var camera:Camera3D;
private var view:View3D;
private var cameraController:HoverController;
private function onWidthChanged(event:Event):void{
if(plane != null){
PlaneGeometry(plane.geometry).width = widthSlider.value;
}
}
private function onHeightChanged(event:Event):void{
if(plane != null){
PlaneGeometry(plane.geometry).height = heightSlider.value;
}
}
private function onXChanged(event:Event):void{
if(plane != null){
plane.x = xSlider.value;
}
}
private function onYChanged(event:Event):void{
if(plane != null){
plane.y = ySlider.value;
}
}
private function onZChanged(event:Event):void{
if(plane != null){
plane.z = zSlider.value;
}
}
private function onCreated():void{
scene = new Scene3D();
camera = new Camera3D();
view = new View3D(scene, camera);
cameraController = new HoverController(camera, null, 45, 10, 1000, 10, 45);
plane = new Mesh(new PlaneGeometry(widthSlider.value, heightSlider.value), new ColorMaterial(0x00FFFF));
scene.addChild(plane);
mainView.addChild(view);
mainView.addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(event:Event):void{
view.render();
}
]]>
</fx:Script>
<s:Form>
<s:layout>
<s:HorizontalLayout />
</s:layout>
<s:FormItem label="Width">
<s:HSlider id="widthSlider" minimum="0" maximum="200" value="100" change="onWidthChanged(event)" />
</s:FormItem>
<s:FormItem label="Height">
<s:HSlider id="heightSlider" minimum="0" maximum="200" value="100" change="onHeightChanged(event)" />
</s:FormItem>
<s:FormItem label="X">
<s:HSlider id="xSlider" minimum="-100" maximum="100" value="0" change="onXChanged(event)" />
</s:FormItem>
<s:FormItem label="Y">
<s:HSlider id="ySlider" minimum="-100" maximum="100" value="0" change="onYChanged(event)" />
</s:FormItem>
<s:FormItem label="Z">
<s:HSlider id="zSlider" minimum="-100" maximum="100" value="0" change="onZChanged(event)" />
</s:FormItem>
</s:Form>
<mx:UIComponent id="mainView" width="100%" height="100%" creationComplete="onCreated()" />
</s:Application>