06 Oct 2011, 08:06

Flash Stage 3D is out!

A couple of days ago, Adobe released to the masses a new version of their Flash Player, and an updated SDK. The biggest change (for me at least) is the inclusion of hardware-accelerated 3D, known as Stage3D. Here’s a quick tour of what I did to compile and run my first Stage3D program (Windows 7 PC but should be applicable everywhere). Useful because the Adobe site is not really clear about this.

  • Make sure you have a Java runtime installed, you need it for the Flash compiler.

  • Download Flash SDK 4.5.1 from http://opensource.adobe.com/wiki/display/flexsdk/Flex+SDK. Extract to a folder (I will assume flex_sdk_4.5.1).

  • Download the appropriate versions of the debug, standalone and plugin Flash Player 11 from http://www.adobe.com/support/flashplayer/downloads.html.

  • While you’re there, download the latest Flash Runtime library.

  • Inside the folder flex_sdk_4.5.1/frameworks/libs/player/ create a folder “11.0“. Copy the playerglobal11_0.swc you just downloaded inside that folder, and rename it to playerglobal.swc. Result:

    flex_sdk_4.5.1/frameworks/libs/player/11.0/playerglobal.swc.

  • Create your working folder, and copy the rotating cube example from the Adobe docs into a file called Context3DExample.as.

  • Delete line 59: this.stage.nativeWindow.activate(); //AIR only and also remove the third “false” parameter from the calls to assemble() from lines 70 and 71.

  • Download the Flash Platform SDK as a ZIP file. Extract the contents of “src” in your work folder. This should result in a folder called “com” side by side with the file “Context3DExample.as“.

  • Compile the sample: flex_sdk_4.5.1/bin/mxmlc -static-link-runtime-shared-libraries -swf-version=13 -target-player=11.0 Context3DExample.as. Note the swf-version and target-player parameters.

  • Run the resulting SWF file with the standalone player 11 you downloaded, or embed it inside a web page. Important: for Stage3D to work properly on hardware, you must add the parameter to the swf tag, and the attribute wmode=”direct” to the tag.

The result should be a spinning cube like this (only visible if you have the updated plugin):

[kml_flashembed publishmethod=”static” fversion=”11.0.0″ movie=”/Jare/files/Stage3D/Test3D.swf” width=”320″ height=”240″ targetclass=”flashmovie” wmode=”direct”]

Get Adobe Flash player

[/kml_flashembed]

Further reading and links:

Happy 3D’ing!