Hello,
I'm completely new to Away3D and I am trying to set up some of the examples
I have found, but none seems to work so far.
The closest I got to it was with this code:
package {
import flash.display.*;
import flash.events.*;
import away3d.core.base.*;
import away3d.core.math.*;
import away3d.containers.*;
import away3d.primitives.*;
import away3d.cameras.*;
import away3d.core.render.*;
import away3d.materials.*;
import away3d.core.utils.*;
public class HelloAway3D extends Sprite {
public var view:View3D;
public var sphereA:Sphere;
function HelloAway3D() {
stage.frameRate=60;
away3dcreate();
addEventListener(Event.ENTER_FRAME, away3dloop);
}
public function away3dcreate():void {
addChild(view=new View3D({x:stage.stageWidth/2,
y:stage.stageHeight/2}));
sphereA=new Sphere({material:new WireColorMaterial()});
view.scene.addChild(sphereA);
}
public function away3dloop(event:Event):void {
view.camera.moveTo(sphereA.x,sphereA.y,sphereA.z);
view.camera.rotationY=mouseX/2;
view.camera.rotationX=mouseY/2;
view.camera.moveBackward(500);
sphereA.rotationY+=1;
view.render();
}
}
}
(I know I'm importing some extra libraries there, but that's ok)
Then I have an mxml with this content:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"xmlns:myFirstGame="*" width="100%"
height="100%" >
<myFirstGame:HelloAway3D />
</mx:Application>
I compile it and embedded it to an html like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta HTTP-EQUIV=”Pragma” CONTENT=”no-cache”>
<meta HTTP-EQUIV=”Expires” CONTENT=”-1″>
<title>HelloAway3D</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<script type="text/javascript"
src="{{MEDIA_URL}}flash/src/swfobject/swfobject.js" ></script>
<script type="text/javascript">
var flashvars = {media: "{{MEDIA_URL}}"};
swfobject.embedSWF("{{MEDIA_URL}}flash/src/mainmx.swf",
"myContent",
"100%",
"100%",
"9",
"expressInstall.swf",
flashvars,
{ bgcolor: '#FFFFFF', menu: 'false',
allowfullscreen: 'false' },
{id: 'myContent'});
</script>
</head>
<style type="text/css" media="screen">
html, body { height:100%; }
body { margin:0; padding:0; overflow:hidden; }
</style>
<body>
<div id="myContent">
<h1>Alternative content</h1>
<p><a href="http://www.adobe.com/go/getflashplayer"> Install
FlashPlayer<!-- <img src="
http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
alt="Get Adobe Flash player" /> --></a></p>
</div>
</body>
</html>
as you can see I'm providing all of my code here because I really have no
clue on what I might be doing wrong.
I'm using mxmlc Version 3.3.0 build 4852 to compile and when I load the html
I get this error:
Error de ActionScript:
TypeError: Error #1009: No se puede acceder a una propiedad o a un método de
una referencia a un objeto nulo.
at HelloAway3D()
at mainmx/_mainmx_HelloAway3D1_i()
at mainmx()
at _mainmx_mx_managers_SystemManager/create()
at mx.managers::SystemManager/initializeTopLevelWindow()
at mx.managers::SystemManager/
http://www.adobe.com/2006/flex/mx/internal::docFrameHandler()<http://www.adobe.com/2006/flex/mx/internal::docFrameHandler%28%29>
at mx.managers::SystemManager/docFrameListener()
It was very exciting when I found Away3D and what I could do exporting
blender files into flex, but right now I just don't know what else to try.
All help will be appreciated, as I'm sure I'm doing something wrong
somewhere...
Cheers,
Karla.
--
-------------------------
Karla Mª Stenger Sábat
[email protected]