I have an example of sprite 3d smoke
//http://swf-flash.blogspot.com/2013/05/smoke-sprite3d-away3d-4.html
package
{
import away3d.cameras.lenses.*; import away3d.core.base.*;
import away3d.core.math.*;import away3d.core.partition.*;
import away3d.library.assets.*;import away3d.debug.*;
import away3d.cameras.*;import away3d.containers.*;import away3d.entities.*;
import away3d.lights.*;import away3d.materials.*;import away3d.materials.lightpickers.*;
import away3d.materials.methods.*; import away3d.primitives.*; import away3d.textures.*;
import away3d.filters.*;
import flash.events.*;import flash.display.*;import flash.geom.*;
/**
* ...
* @author Lexcuk
*/
public class Sprite3dSmoke
{
public var spriteArr:Array = [];
public var speedZArr:Array = [];
public var speedYArr:Array = [];
public var spriteCount:int = 0;
public var length:int = 10;
public var speedY:Number = 20;
public var speedZ:Number = 5;
public var size:Number = 100;
public var color:uint;
public var alpha:Number = 0.5;
public var material:*;
public function Sprite3dSmoke(objectContainer3D:ObjectContainer3D, color:uint = 0xFF0000, alpha:Number = 0.5, size:Number = 100, length:int = 10, speedY:Number = 20, speedZ:Number = 5, material:* = null )
{
this.color = color;
this.size = size;
this.speedY = speedY;
this.speedZ = speedZ;
this.alpha = alpha;
this.length = length;
this.material = material;
var i:int;
var sprite3D:Sprite3D;
if (material == null) {
material = new TextureMaterial(new BitmapTexture(makeSmokePuffBmd()));
material.alphaBlending = true;
material.alpha = alpha;
}
for (i = 0; i < length; i++) {
objectContainer3D.addChild(sprite3D = new Sprite3D(material, size, size));
spriteArr.push(sprite3D);
speedZArr.push(-speedZ/2 + Math.random() * speedZ);
speedYArr.push(speedY/2 + Math.random() * speedY);
}
}
public function update(pos:Vector3D):void {
var i:int;
var s:Sprite3D;
for (i = 0; i < length; i++) {
s = spriteArr[i];
s.z += speedZArr[i];
s.y += speedYArr[i];
s.x = pos.x+i / length;
}
s = spriteArr[spriteCount];
speedZArr[spriteCount] = -speedZ / 2 + Math.random() * speedZ;
speedYArr[spriteCount] = speedY / 2 + Math.random() * speedY;
s.z += speedZArr[spriteCount];
s.y += speedYArr[spriteCount];
s.x = pos.x;
s.y = pos.y;
s.z = pos.z;
spriteCount++; if (spriteCount >= length) spriteCount = 0;
}
public function makeSmokePuffBmd():BitmapData {
var bitMap:BitmapData = new BitmapData(64, 64, true, 0x00000000);
var i:Number;var r:uint = color >> 16;var g:uint = color >> 8 & 0xFF;
var b:uint = color & 0xFF;
for (i = 0; i < 5000; i+=0.9) {
var xi:int = i % 64; var yi:int = i / 64;
var a:Number = Point.distance(new Point(32, 32), new Point(xi, yi));
if (a < 1) a = 1; if (a > 32) a = 0;
a = -a / 32 * 0xFF;
bitMap.setPixel32(xi, yi, a << 24 | r << 16 | g << 8 | b);
if (i / 64 > 64) break ;
}
return bitMap;
}
}
}
and you can add it’s on your container like as I do
whiteSprite3dSmoke =
new Sprite3dSmoke(container,0xFF00FF, 0.7, 100, 20, 10, 20);
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
....
private function enterFrameHandler(e:Event):void {
var pos:Vector3D = sceneMousePosition.clone();
pos.y += 50;
whiteSprite3dSmoke.update(pos);
view.render();
}