Reputation: 8385
I am developing a flash application required me to have a rotational sprite object cycling around the 3D space. I saw a MovieClip has a z-index that can be used as z coordinates in 3d space but couldn't find it in sprite object.
How to I get around with that.
Upvotes: 1
Views: 1090
Reputation: 1575
When you say "but couldn't find it in sprite object." what do you mean? Adobe's documentation of the Sprite class lists the z property in it's property list (http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/Sprite.html). Perhaps you need to click "Show Inherited Public Properties" to see it? Anyway, the following pseudo-code might be helpful:
var sprite:Sprite = new Sprite();
addChild(sprite);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
protected function onEnterFrame(e:Event):void
{
sprite.z += (mouseX - sprite.z) * 0.2;
}
Good luck!
Upvotes: 1
Reputation: 11029
Here is some sample code on how to create a 3D scene in Flash with sprites:
http://memo.tv/starry_trails_3d_particle_system_actionscript_3_source_code
3D can get very complicated so it is best to play with an example.
Upvotes: 1