Intro
When it comes to creating Second Life foliage in Flash 3D, Flash CS4 is far superior in ease of use, code required, and portability.
To see a demo and grab the source files click the links below:
Given that I like Papervision3D so much, you’ll find the following analysis very unbiased. But it surprised me, and made me think a little about the direction I’m headed. I’m not giving up Papervision3D, there are too many things that PV3D can do that CS4 can’t. But I’m definitely blending CS4 with Papervision3D whenever a savings like this can be found.
Ease of Use
The steps required to create the Second Life tree graphic for use in the 3D environment for CS4 and PV3D are given below. CS4 requires no programming and PV3D is programming intensive.
CS4, No Programming Required
To create the Second Life Tree in CS4 Flash follow these steps
- Import the front and side tree “png” images onto the Flash Stage.
- Turn them both into movie clips
- Rotate one 90 degrees with the 3D rotation tool and use the 3D translation tool to overlap them at their centers
- Turn both into a movie clip and check the linkage of that movie clip for export
PV3D, Programming Intensive
- Create a Tree Primitive (see the Post on Second Life Tree)
- Import the Tree Primitive into a BasicView wrapper program
- Instantiate two BitmapFileMaterials and load your images into them
- Create a MaterialList and load your Image materials into it
- Load your MaterialList into your Tree Method
Counting lines of code was the real eye opener, it really shows the advantage of having the native z component in Flash 10.
Code Required
All things considered CS4 beats Papervision3D hands down in the number of lines (fewer) required to code the same user experience: 23 to 243, a factor of 10.

Comparison of Lines of Code Required
Portability
Like Papervision3D, CS4 runs on Windows, Mac, and Linux. But with CS4 you can run your Second Life tree with Papervision3D, Away3D, Sandy3D, or any other 3D package running in the Flash 10 player.
The code for the CS4 Second Life Tree is given below:
CS4 Code
package {
import flash.display.Sprite;
import flash.display.*;
public class SLTreePackage extends Sprite
{
private var tree:SLTree= new SLTree();
public function SLTreePackage()
{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
addChild(tree);
tree.x=stage.stageWidth/2;
tree.y=stage.stageHeight/4;
//Start Tree Rotating
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(event:Event):void
{
tree.rotationY+=1;
}
}
}

Posted by Mike Lively