Wmode Requirements

You have to remember that in order to enable Stage 3D and GPU acceleration you have to use wmode=direct as the embed mode in the page. If you do not specify any value or choose a value other than “direct” (e.g., “transparent,” “opaque,” or “window”), Stage 3D will not be available. Instead, you will get a runtime exception informing you that the creation of the Context3D object failed, when requestContext3D on Stage3D is called. The runtime exception dialog box is shown in Figure 1-10.

Runtime exception, when Context3D is not available

Figure 1-10. Runtime exception, when Context3D is not available

It is important to handle this situation if your application is embedded using the wrong wmode. You need to react appropriately by displaying a message explaining the issue. Fortunately, Starling handles this automatically, and will display the message shown in Figure 1-11. Feel free to modify the Starling source code to modify this message and even customize the look and feel.

Warning message when the application is not correctly embedded

Figure 1-11. Warning message when the application is not correctly embedded

Get Introducing Starling 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.