Hi all,
I’m trying to build a simple object loader with away3D and FDT, but no matter how I change the code I always get a message saying Context3D is not available.
Here’s my code:
package br.com.vieirawebstudio{
import flash.net.URLRequest;
import away3d.events.LoaderEvent;
import away3d.loaders.Loader3D;
import away3d.loaders.parsers.Parsers;
import flash.events.Event;
import away3d.containers.View3D;
import flash.display.Sprite;
public class HelloAway3D extends Sprite {
private var _view:View3D;
private var _loader:Loader3D;
public function HelloAway3D()
{
trace('Hello Away 3D');
_view = new View3D();
_view.backgroundColor = 0x666666;
_view.antiAlias = 4;
this.addChild(_view);
this.addEventListener(Event.ENTER_FRAME, onEnterFrame);
Parsers.enableAllBundled();
_loader = new Loader3D();
_loader.addEventListener(LoaderEvent.RESOURCE_COMPLETE, onResourceComplete);
_loader.addEventListener(LoaderEvent.LOAD_ERROR, onLoadError);
_loader.load( new URLRequest('PolarBear.awd') );
}
private function onEnterFrame(ev: Event):void
{
_view.render();
}
private function onResourceComplete(ev: LoaderEvent):void
{
_loader.removeEventListener(LoaderEvent.RESOURCE_COMPLETE, onResourceComplete);
_loader.removeEventListener(LoaderEvent.LOAD_ERROR, onLoadError);
_view.scene.addChild(_loader);
trace('Complete loaded');
}
private function onLoadError(ev: LoaderEvent):void
{
trace('Could not find', ev.url);
_loader.removeEventListener(LoaderEvent.RESOURCE_COMPLETE, onResourceComplete);
_loader.removeEventListener(LoaderEvent.LOAD_ERROR, onLoadError);
_loader = null;
}
}
}
and here’s my compiler options:
-static-link-runtime-shared-libraries=true
-target-player={playerVersion}
-library-path+="{flexSDK}/frameworks/locale/en_US"
-default-size=550,400
-swf-version=13
I’m using FDT 5 to code and Flash 11.4. The version of Away3D 4 is 4.0.9 (I’m using the swc file from the Downloads page) and Flex is 4.6 (Yes, I tried to convert to a Air file and changed several times the renderMode, but so far, no success)
The trace output always says
Hello Away 3D
Complete Loaded
But no object is rendered. What am I possibly doing wrong? Thanks in advance