Reputation: 7243
I've got Flash CS5.5, and I wanted to fiddle around with some 3D, so I downloaded Away3D from the website, and don't really know how to get it 'working' with CS5.5?
Can I just place the folder with my .fla files? Or do I have to setup a actionscript path of some sort?
Also can someone give me a snippet to verify away3d works, as i've tried the following code:
package
{
import away3d.containers.View3D;
import away3d.primitives.Sphere;
import flash.display.Sprite;
[SWF(width="500", height="400", frameRate="60", backgroundColor="#FFFFFF")]
public class physicas extends Sprite
{
public function physicas()
{
// create a viewport
var View:View3D = new View3D({x:250,y:200});
addChild(View);
// create a sphere and put it on the 3D stage
var sphere:Sphere = new Sphere();
View.scene.addChild(sphere);
// render the view
View.render();
}
}
}
And I keep getting the output error message:
1118: Implicit coercion of a value with static type Object to a possibly unrelated type away3d.containers:Scene3D.
What does this mean?
Thanks alot.
Upvotes: 2
Views: 1953
Reputation: 767
We just need to import the class to our fla files using the code
import [foldername]/.../[className];
... to make our flash file optimize, import only the class needed.
Upvotes: 0
Reputation: 331
Here's a short tutorial on the topic of creating a Away3D scene: http://www.adobe.com/devnet/flashplayer/articles/creating-games-away3d.html
It's on Flash Builder but the code is he same both for flash and flash-builder the difference is just where you put your imports. If you don't know about that just edit the publish preferences under the actionscript settings.
Cheers!
Upvotes: 1
Reputation: 22105
The constructor for the View3D class takes a Scene3D object. Change
var View:View3D = new View3D({x:250,y:200});
to
var scene1:Scene3D = new Scene3D();
var View:View3D = new View3D(scene1);
You also need to import the Scene3D class.
import away3d.containers.Scene3D;
You can find the docs here.
Upvotes: 4