3DSprite with transparent background

Software: Away3D 4.x

Avatar
TrueSign, Member
Posted: 14 August 2012 09:03 AM   Total Posts: 57

Hi,

I need a pop up scores appearing in 3d space. How can I create a points in 3d space in Away3d 4 ? I don’t want to create 3D object for every number.
Right now I’m using Sprite from flash library:

_pointsMc.pointsTxt.text point//_pointsMc is flash library symbol
var _bitmapData:BitmapData = new BitmapData(3232true);
_bitmapData.draw(_pointsMcnullnullnullnulltrue);
var 
bitmapPointsTexture:BitmapTexture = new BitmapTexture(_bitmapData);
_pointsMaterial = new TextureMaterial(bitmapPointsTexture);
   
_points = new Sprite3D(_pointsMaterial1010);
_view.scene.addChild(_points); 

but I can’t make it transparent. Background is always there. Is there an easier way to put pop up scores on stage? Any ideas how can I do that?
You can see my project here:
http://www.truesign.ie/sheeping/

Thanks

   

Avatar
Cheng Liao, Administrator
Posted: 14 August 2012 09:55 AM   Total Posts: 116   [ # 1 ]

Hi
you can use the alphaThreshold property like this:

_pointsMc.pointsTxt.text point//_pointsMc is flash library symbol
var _bitmapData:BitmapData = new BitmapData(3232true,0x00000000);
_bitmapData.draw(_pointsMcnullnullnullnulltrue);
var 
bitmapPointsTexture:BitmapTexture = new BitmapTexture(_bitmapData);
_pointsMaterial = new TextureMaterial(bitmapPointsTexture);
_pointsMaterial.alphaThreshold 0.5;
_points = new Sprite3D(_pointsMaterial1010);
_view.scene.addChild(_points); 
   

Avatar
loth, Sr. Member
Posted: 14 August 2012 11:08 AM   Total Posts: 236   [ # 2 ]

or just _pointsMaterial.alphaBlending = true;

   

Avatar
TrueSign, Member
Posted: 14 August 2012 03:35 PM   Total Posts: 57   [ # 3 ]

Thanks ! Both solutions working fine.
I have tried alphaBlending set to true before but I haven’t set argb in bitmap data:
_bitmapData:BitmapData = new BitmapData(32, 32, true,0x00000000);

Working just fine now. Thank again.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X