Search code examples
actionscript-3flashviewportmxmlcstage3d

Stage3D in Flash Player 11 doesn't display


I'm trying to write a 3D game in ActionScript 3.0 using the Stage3D API. I've copied the playerglobal.swc in my frameworks/libs/player/11.0 directory, and modified the frameworks/flex-config.xml file by changing the target-player to 11.0.0 and the swf-version to 13.

When I compile my ActionScript 3.0 files using mxmlc I set the options -target-player=11.0.0 and -static-link-runtime-shared-libraries=true. Now, I don't get an error at compile time when importing com.adobe.utils.AGALMiniAssembler or flash.display.Stage3D so I assume that there's no problem with that.

I run the compiled SWF file in Opera, and I'm using the latest Flash Player (version 11.0.1.152) which was publicly released today (cheers ;D). There's seems to be no problem with the player because I can play Zombie Tycoon. However, when I play my SWF file the Stage3D doesn't display; but all the other display objects attached to the stage do display.

I believe that there's either some problem with my configuration or my code, but I can't pinpoint it. The code I'm using was simply copied from Labs @ Jam3. I believe that there was some problem with the viewport, so I simply replaced stage.stage3Ds[0].viewPort=new Rectangle(0, 0, 980, 570); with stage.stage3Ds[0].x=0; stage.stage3Ds[0].y=0;. Perhaps, that's the cause of the problem.

I have been searching for a solution all over the web, but I can't seem to locate it. Any help will be appreciated. Note however that I don't wish to use frameworks like Away3D because I wish to use the low-level functionality (I'm more into programming). If you want any more details, please ask.


Solution

  • @Miha - Thank you for answering my question. I set the wmode parameter to direct, and it worked like a charm. Apparently, the Stage3D API doesn't work in transparent, opaque, or window mode. If anyone is having similar problems, here's my HTML code which solved the problem:

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8"\>
        <title>Hello Stage3D!</title>
      </head>
      <body>
        <object width="800" height="600" data="HelloStage3D.swf">
          <param name="wmode" value="direct"/>
        </object>
      </body>
    </html>
    

    To use the Stage3D API, you have to set the wmode parameter to direct. Nothing else will work. Line 9 is necessary.