Away3D 3.6: Sprite2D now inherited from Elements not from Object3D

39 views
Skip to first unread message

rderimay

unread,
Sep 28, 2010, 3:19:20 AM9/28/10
to Away3D.dev
In Away3D, Sprite2D (DirectionalSprite now) ist not inherited from
Object3D anymore.
I used to use these functions:
.useHandCursor = true;
.addOnMouseDown( );
.addOnMouseUp( );

to track user interactivity which now does not work anymore.

Is there any way to get around this problem? Maybe Sprite2D has been
split in 2 classes, one being DirectionalSprite without user
interactivity and the second one being something else which I miss?

Many thanks, I am stuck!

Régis

rderimay

unread,
Sep 29, 2010, 11:50:34 AM9/29/10
to Away3D.dev
Anyone to help on how to make a Sprite3D respond to mouse events??

Rob Bateman

unread,
Oct 4, 2010, 10:05:25 AM10/4/10
to away3...@googlegroups.com
yes, just listen for 3d mouse events on the container or scene of the sprite3d objects, and then separate out the various events by using the 'elementVO' property of the returned event, which is a valueobject representing either a face, sprite or segment element. You can easily detect which is which by doing something like

if (event.elementVO is SpriteVO) {
  var mySprite:Sprite3D = (event.elementVO as SpriteVO).sprite;
} else if (event.elementVO is SegmentVO) {
  var mySegment:Segment = (event.elementVO as SegmentVO).segment;
} else if (event.elementVO is FaceVO) {
  var myFace:Face = (event.faceVO as FaceVO).face;
}

hth!

Rob
--
Rob Bateman
Flash Development & Consultancy

rob.b...@gmail.com
www.infiniteturtles.co.uk
www.away3d.com

Darcey Lloyd

unread,
Oct 4, 2010, 9:52:40 PM10/4/10
to away3...@googlegroups.com
Quick cookeup of Sprite3D with Away3D 3.6 using the HandCursor.

URL:
http://www.allforthecode.co.uk/aftc/forum/user/modules/forum/article.php?index=4&subindex=14&aid=163

Features:
  • Click drag to move scene around (HoverCamera3D)
  • 10 PNG assets used for 10 Sprite3D (MovieClipSprite)
  • Each sprite has UseHandCursor = true & ButtoneMode = true applied via movieclip
  • I've placed a cube in the center (untextured to give perspective of elements in the scene)
Happy coding.

Darcey

rderimay

unread,
Oct 8, 2010, 9:13:15 AM10/8/10
to Away3D.dev
Many thanks to both of you!

I am now constructing the Spite2D and then integrating it inside of an
objectContainer3D object:

var bitmap:Bitmap = new ObjIcon();
var material:BitmapMaterial = new
BitmapMaterial(bitmap.bitmapData);
material.smooth = true;
var labelIcon:DirectionalSprite = new DirectionalSprite(material);
labelIcon.scaling = 12;
labelIcon.x = iQ3d.SCALE * meta.x;
labelIcon.z = iQ3d.SCALE * meta.y;
labelIcon.y = iQ3d.SCALE * meta.z + iQ3d.SCALE * 0.036;
objs3D = new ObjectContainer3D(labelIcon);

view.scene.addChild(obj3D);

It compiles, but nothing get displayed... Any idea?

On Oct 5, 3:52 am, Darcey Lloyd <darcey.ll...@gmail.com> wrote:
> Quick cookeup of Sprite3D with Away3D 3.6 using the HandCursor.
>
> URL:http://www.allforthecode.co.uk/aftc/forum/user/modules/forum/article....
>
> Features:
>
>    - Click drag to move scene around (HoverCamera3D)
>    - 10 PNG assets used for 10 Sprite3D (MovieClipSprite)
>    - Each sprite has UseHandCursor = true & ButtoneMode = true applied via
>    movieclip
>    - I've placed a cube in the center (untextured to give perspective of
>    elements in the scene)
>
> Happy coding.
>
> Darcey
>
> > rob.bate...@gmail.com
> >www.infiniteturtles.co.uk
> >www.away3d.com

rderimay

unread,
Oct 8, 2010, 9:29:23 AM10/8/10
to Away3D.dev
And when I use this:

var bitmap:Bitmap = new ObjIcon();
var material:BitmapMaterial = new
BitmapMaterial(bitmap.bitmapData);
material.smooth = true;
var labelIcon:DirectionalSprite = new DirectionalSprite(material);
labelIcon.scaling = 12;
labelIcon.x = iQ3d.SCALE * meta.x;
labelIcon.z = iQ3d.SCALE * meta.y;
labelIcon.y = iQ3d.SCALE * meta.z + iQ3d.SCALE * 0.036;
objs3D = new ObjectContainer3D();
objs3D.addSprite(labelIcon);

it is displayed on the scene, but not clickable...
> rob.bate...@gmail.comwww.infiniteturtles.co.ukwww.away3d.com

Darcey Lloyd

unread,
Oct 8, 2010, 10:33:02 AM10/8/10
to away3...@googlegroups.com
add the sprite to the container.

objs3D.addChild(labellcon);

rderimay

unread,
Oct 8, 2010, 11:48:35 AM10/8/10
to Away3D.dev
Well the problem is, that you can not use addChild to add the sprite.
This was possible in 4.5 but not in 4.6 anymore. Sprite3D is not
inherited from Object3D anymore.

manicmilkman

unread,
Oct 8, 2010, 5:14:26 PM10/8/10
to Away3D.dev
addSprite() instead of addChild().

rderimay

unread,
Oct 9, 2010, 2:42:42 AM10/9/10
to Away3D.dev
We you use addSprite, you loose the clickability in 4.6...

anton...@gmail.com

unread,
Oct 9, 2010, 5:08:32 AM10/9/10
to Away3D.dev
>When you use addSprite, you loose the clickability in 4.6...

The same problem

Darcey Lloyd

unread,
Oct 11, 2010, 4:28:17 AM10/11/10
to away3...@googlegroups.com
This may help:
I didn't use ObjectContainer3D but addSprite to view.scene with MovieClipSprite (see CustomSprite.as).



D

Justin Schrader

unread,
Oct 21, 2010, 11:29:06 AM10/21/10
to Away3D.dev
I'm having this problem as well. MovieClipSprite works ok, but the
second I turn it on I go from 30fps to 20fps :( is MovieClipSprite
really that CPU taxing?

On Oct 11, 4:28 am, Darcey Lloyd <darcey.ll...@gmail.com> wrote:
> This may help:
> I didn't use ObjectContainer3D but addSprite to view.scene with
> MovieClipSprite (see CustomSprite.as).
>
> http://www.allforthecode.co.uk/aftc/forum/user/modules/forum/article....
>
> D
Reply all
Reply to author
Forward
0 new messages