Posted in Examples on September 27th, 2008 by sHTiF
So Flash 10 is here yay, i know it was possible to develop astro content even before using nightly Flex builds but i didnt quite got to it. Anyway back to the topic i got my hands on the new Flash CS4 today and i was all curious about the 3D posibilites, and what i found out is both great and puzzling. Great because the 3D support is more that i was hoping for and puzzling because i am not quite sure how to implement some things in more direct way. Lets get to an example i coded in 5 minutes, its a typical carousel. Its a simple example of something that would be quite complicated to create an easy way, and here it is in few lines of code:
Example code: example source code
I am aware that there is a thing or two to optimize (loop creating the thumbs) but i just wanted to concentrate mainly on the new 3D.
The 3D is quite neat you can specify X,Y,Z translation as well as X,Y,Z rotation and scale. Yes thats nice but what about pivots, they are even more important now than they were in 2D so i got into experimenting. I found out that you cant set the pivot explicitly but its as before implicitly set to 0,0,0 and yes this means Z as well. As you can see in the example this way its easy to set 8 items with different X,Z offsets within an encapsulator and then simply rotating the encapsulator tadaaa yes its so simple. Great isnt it?
And whats puzzling you say? The problem is that even if we have Z translation its not affecting the depth sorting, so the items will sort by the index they were added to parent as usual. So we still need to calculate depth sorting explicitly. I tried to experiment with the new local3DToGlobal and globalToLocal3D methods but wasnt succesfull. If you have any luck share it ;)