Away3d and flex is very slow

Software: Away3D 4.x

Wessel, Newbie
Posted: 10 August 2012 12:57 PM   Total Posts: 3

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.viewPort.width/2;
 
view.viewPort.height/2;
  
 
viewPort.addChild(view);
 
 
super.addEventListener(Event.ENTER_FRAMEonEnterFrame);

 
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

   

Avatar
Fabrice Closier, Administrator
Posted: 10 August 2012 01:59 PM   Total Posts: 1265   [ # 1 ]

Why do you use away3dLite flash 10 and not Away3d 4.0 Flash 11?
Unless you must publish as flash 10 on desktop, this I can understand, but why use it for Android then?

   

Wessel, Newbie
Posted: 10 August 2012 02:07 PM   Total Posts: 3   [ # 2 ]

I thought away3dlite would be faster, and am I not using flash player 11 here then? (I’m kinda new so I thought i used flash player 11 :p)

   

Richard Olsson, Administrator
Posted: 10 August 2012 02:16 PM   Total Posts: 1192   [ # 3 ]

Away3D Lite does not use the Flash Player 11 APIs for GPU accelerated graphics called Stage3D. You have to use Away3D 4 instead if you want to get good performance, especially on mobile devices.

   

Wessel, Newbie
Posted: 10 August 2012 03:18 PM   Total Posts: 3   [ # 4 ]

ah I see.. I created another project with Away3D and flash player 11 and it worked! many thanks!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X