505
Chapter 15
Using 3D in Flex
by Charlie Schulze
In one chapter it would be impossible to learn everything about 3D in Flex, but this chapter gives you
enough knowledge to get started. There are several APIs at your disposal if you want to work with 3D in
Flex. The API covered in this chapter will be Papervision.
The goal of this chapter is not to teach you 3D but rather teach you how you can use the Papervision API
in your Flex projects. Getting started is a relatively painless process.
Before You Begin
First download the Papervision source or swc. For the examples in this chapter we will use the
Papervision3D_2.0.883.swc file (http://papervision3d.googlecode.com/files/Papervision3D_
2.0.883.swc).
In the following examples we will extend BasicView, which is included with Papervision3D. There is one
important difference between Papervision’s BasicView in Flex, and Flash. Since a Papervision BasicView
extends Sprite and not UIComponent, you cannot add it to your application with a simple addChild or
addElement. An easy way to get around this is to create a wrapper for adding it to the application, as you’ll
see shortly.

Get AdvancED Flex 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.