Flex and away 3d

3 views
Skip to first unread message

Exalto

unread,
Jul 9, 2007, 6:37:17 AM7/9/07
to away3d.dev
Hi.

Can somebody give me a source how would I get Away3d work in Flex? I
didn't manage to get it work myself.

Thanks

BJ

unread,
Jul 9, 2007, 7:19:31 AM7/9/07
to away3d.dev
U can build an *.swc file with the away3d sources and then add it to
your project properties in Flex.

To build this *.swc u need to start a new "Flex library project".
For more infos on *.swc just take a look at your Flex manual.

Exalto

unread,
Jul 9, 2007, 8:18:27 AM7/9/07
to away3d.dev
Does it make difference do I use swc or do I just make project to
away3d directory?

I need to know how can I add Away3d View3d to flex application.

I tried like this but it doesn't work:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[

import flash.display.*;
import flash.events.*;
import flash.utils.*;

import away3d.objects.*;
import away3d.core.material.*;
import away3d.core.proto.*;

[SWF(backgroundColor="#222266", frameRate="60", width="600",
height="400")]

public var view:View3D;
public var sphere:Sphere;

public function HelloAway3D()
{
view = new View3D();
view.x = 300;
view.y = 200;
this.addChild(view);

sphere = new Sphere(new WireColorMaterial(0xFF7700,
0xCC4400), {radius:250, segmentsW:12, segmentsH:9, y:50});

view.scene.addChild(sphere);
view.camera.lookAt(sphere);

addEventListener(Event.ENTER_FRAME, onEnterFrame);
}

private function onEnterFrame(event:Event):void
{
view.render();
sphere.rotationY = getTimer() / 100;
}

]]>
</mx:Script>


</mx:Application>

velisu...@gmail.com

unread,
Jul 10, 2007, 1:42:07 AM7/10/07
to away3d.dev
Ahh! Flex and normal DisplayObjects cannot communicate that easily.
You need to extend the Flex Canvas and use a UIComponent instance to
store your Sprite Objects. Papervision3D's Ralph Hauwert had created a
sample for PV3D, you can apply the same principles for Away3D.

I uploaded Ralph's example source files to the list. I created Away3D
version of it but my code is ugly at the moment. Luckily, It works as
expected. Let me know if you have any problems.

Reply all
Reply to author
Forward
0 new messages