i have a simple project, a ball rotating to be compiled from flash ide using air 3.1 engine…in my mac computer it works fine but my project should be compiled in a pc because i have to integrated with other resources…
on the pc i receive an error: Error #2044: Unhandled ErrorEvent:. text=Error #3702: Context3D not available….it export the swf and it works fine in fp11 but nothing in air…
here is my code:
import away3d.containers.View3D;
import away3d.events.LoaderEvent;
import away3d.loaders.Loader3D;
import away3d.loaders.parsers.Parsers;
import away3d.loaders.parsers.data.DefaultBitmapData;
import away3d.materials.BitmapFileMaterial;
import away3d.materials.ColorMaterial;
import away3d.primitives.Sphere;
import away3d.tools.MeshHelper;
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLRequest;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.display3D.textures.Texture
[SWF(width="1280", height="1024")]
var _view : View3D;
var _loader : Loader3D;
var mundo : Sphere;
var miMaterial : ColorMaterial;
var mapamundi : BitmapFileMaterial;
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
_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('hotel/cosa.obj') );
miMaterial = new ColorMaterial(0);
mapamundi = new BitmapFileMaterial('hotel/mapa.jpg');
mundo = new Sphere(mapamundi, 320, 60, 60);
MeshHelper.invertFaces(mundo);
function onResourceComplete(ev : LoaderEvent) : void
{
_loader.removeEventListener(LoaderEvent.RESOURCE_COMPLETE, onResourceComplete);
_loader.removeEventListener(LoaderEvent.LOAD_ERROR, onLoadError);
_view.scene.addChild(mundo);
}
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;
}
function onEnterFrame(ev : Event) : void
{
mundo.rotationY ++;
mundo.scaleY = 1.2;
mundo.y = 35;
_view.render();
}
when i run a test it says is compiling with air3.1 so that’s not the trouble:
import flash.display.Stage3D;
import flash.desktop.NativeApplication;
import flash.text.TextField;
function air3_test(){
var stage3d = new Stage3D();
var my_fmt:TextFormat = new TextFormat();
my_fmt.color = 0xFF0000;
my_fmt.size = 32;
my_fmt.bold = true;
my_fmt.font = "Arial";
var textF: TextField = new TextField;
textF.defaultTextFormat = my_fmt;
textF.autoSize = TextFieldAutoSize.LEFT;
textF.text = "Hello AIR Version No. " + NativeApplication.nativeApplication.runtimeVersion +"\n" + stage3d;
addChild(textF);
trace ( "+ Flash CS5.5.air3_test() - args: " + [stage3d,"AIR Version: " + NativeApplication.nativeApplication.runtimeVersion ] );
}
air3_test();
any idea on solving this?