Hey!
I created a very simple app for android with Flex which uses the away3d library. But I find it to be very slow, both on desktop and android devices.
My code:
ViewPortView.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
title="Model laden test"
xmlns:mx="library://ns.adobe.com/flex/mx" creati>
<fx:Script source="renderer.as"/>
<fx:Script>
<![CDATA[
private function init():void {
startView(viewPort);
}
]]>
</fx:Script>
<mx:UIComponent id="viewPort" width="100%" height="100%"/>
</s:View>
renderer.as
import away3dlite.cameras.HoverCamera3D;
import away3dlite.containers.View3D;
import away3dlite.materials.WireframeMaterial;
import away3dlite.primitives.Plane;
import flash.events.Event;
import mx.core.UIComponent;
protected var view:View3D;
protected var camera:HoverCamera3D;
protected var plane:Plane;
protected function startView(viewPort:UIComponent):void {
//camera = new HoverCamera3D();
view = new View3D();
//view.camera = camera;
view.x = viewPort.width/2;
view.y = viewPort.height/2;
viewPort.addChild(view);
super.addEventListener(Event.ENTER_FRAME, onEnterFrame);
loadModel();
}
protected function loadModel():void {
plane = new Plane();
plane.segmentsH = 80;
plane.segmentsW = 80;
plane.material = new WireframeMaterial(0xFF0000);
plane.bothsides = true;
plane.yUp = false;
plane.width = 500;
plane.height = 500;
view.scene.addChild(plane);
}
protected function onEnterFrame(event:Event):void {
plane.rotationY +=5;
view.render();
}
I googled my ass off but without any result :( Does anybody know what the solution could be?
Bytheway: I’m using the latest Flex SDK, Away3DLite library and flash player
Thanks :D