Back to Content

Flash (.swf) Target

When creating Flash applications with CopperCube, it uses the new Stage 3D feature introduced by Adobe with Flash Player 11: Hardware accelerated 3D graphics, meaning flash applications are very fast when published with CopperCube.
Alternatively, there is a setting in CopperCube not to use this feature, and to rely on slow software based 3D rendering. If you use this setting 'Use Old Flash player rendering', there are several things to consider: The Flash platform (at least in its version 9 and 10) is not designed to do high speed 3D rendering, and although the CopperCube flash engine is designed to maximize the rendering speed, there are some limitations: Depending on your the target system, you can only use a very limited amount of polygons per scene. For average systems, this is usually a value at 300 - 500 polygons, but you are able to increase this value depending on the type of the scene, the materials and more.

Switching to Fullscreen and MousePointer lock

Since version 4.5, CopperCube supports switching your flash app to fullsceen, and optional also locking the mouse cursor, for nice 'First Person Shooter' cameras. For this, add a 'When a key is pressed do something' behavior or a 2D Overlay with a 'when clicked on this do something' behavior into your app, and add the 'Switch to Fullscreen' action to it. You can download this action from the Download Scripted Actions page from the CopperCube homepage.

You need to manually trigger switching to fullscreen in this way because Flash has a security limitation, which lets an app only switch to fullscreen if a user clicks with the mouse or presses a button.

Scripting with JavaScript

When the Flash target runs in a web browser, you can use JavaScript to make your CopperCube 3D flash scenes more interactive. Note: CopperCube generated Flash .swf files will only run JavaScript code when they are started from a webserver (even a local webserver works). Running it directly from the local disk might not work. You can change this behavior in the security settings of your Adobe Flash installation. Also, be sure that your 'embed' HTML tag for embedding the flash .swf needs a uniqe name set. Like <embed name="coppercube" ..., otherwise the JavaScript VM isn't able to reference the CopperCube player.

Scripting with Actionscript 3

Besides scripting using JavaScript, you can also use Actionscript 3 in the Flash target to make your CopperCube 3D flash scenes more interactive. There is a comprehensive AS3 scripting reference available in this documentation.

There is also a full example available: Movement with Actionscript 3.

Source Code

If you want to extend the Flash app with very specific Flash custom features, you can do this by compiling the Flash App yourself and programming your own additions. You can get the source code if you own the Professional Edition of CopperCube: In the editor, click Help -> About, and then the "Download Flash Source" button.
The code is a Flex Project witch can be compiled with Adobe Flex (or Apache Flex). A short documentation on how to build the package can be found in the root named documentation.txt.