2 Replies Latest reply on Apr 20, 2013 6:11 PM by pbholmen

    Moving Stage3D project from Flash Builder to Flash Professional

    pbholmen

      Hi

       

      I have been developing a Stage3D animation in Flash Builder 4.7 which basically grew out of this tutorial: http://www.adobe.com/devnet/flashplayer/articles/how-stage3d-works.html

       

      Now it has grown into something much more complex, with lots of classes. It is a pure Actionscript project, with none of the XML stuff I sometimes see in posts about Actionscript programming, which I have no clue about.

       

      Now that the 3D rendering and animation has been coded, I would like to use Flash Professional so I can use the timeline for more sequential authoring, and add a 2D simple user interface on top of it. Basically, I have a main class called Cube, which can be ordered to do a lot of stuff. I would like, from the timeline in Flash Professional to say things like:

       

      cube.turn( Cube.RIGHT, 5.0 );

      cube.doThis();

      cube.doThat();

       

      You get the idea, hopefully. I would like to continue developing the classes in Flash Builder, though. But also I have a main class which extends Sprite, whith the same name as the Flash Builder project, which contains the main rendering algorithm in Stage3D. This is how it is declared:

       

                [SWF(width="1200", height="800", frameRate="60", backgroundColor="#000000")]

        public class PHLereim extends Sprite

       

      It is a very simple class which sets up a Context3D, while most of the real rendering work is done in other classes.

       

      Naive me thought this would be easy. But all tutorials I find on how to exchange projects between the two programs, go the opposite way: They create the project first in Flash Professional, then move it over to Flash Builder, to edit dependent classes there. How would you proceed if you wanted to go the opposite way? Or would you recommend against it? Also, I have virtually no experience with Flash Professional, unfortunately.

        • 1. Re: Moving Stage3D project from Flash Builder to Flash Professional
          pbholmen Level 1

          I think I should also add what the constructor of the main class in the Flash Builder project looks like:

           

          public function PHLereim() {

           

            stage.stage3Ds[0].addEventListener( Event.CONTEXT3D_CREATE, initMolehill );

                                        stage.stage3Ds[0].requestContext3D();

           

                                        addEventListener(Event.ENTER_FRAME, onRender);

           

          }

           

          I have tried the super naive way of creating a new project in Flash Professional, adding the source folder from the Flash Builder project in Actionscript preferences, and then creating a new PHLereim in the timeline at frame 1, like this:

           

          var test:PHLereim = new PHLereim;

           

          I didn't really expect this to work, but in case you were interested, the problem I get is that stage, during construction of the object, is null. I thought perhaps it would be possible to just make a Flash Professional project, with access to all the classes in my Flash Builder project, and then, since the main class in my Flash Builder project is a Sprite, add it to the stage? But I have no knowledge of how stages, Sprites, DisplayObjects etc. relate to each other. My main Flash knowledge so far is Stage3D. Just mentioning this in case it might help someone answering my question.

          • 2. Re: Moving Stage3D project from Flash Builder to Flash Professional
            pbholmen Level 1

            Okay, sorry for replying to myself over an over again.

             

            Here is what I have doen so far:

            1) Created a new project in flash Professional.

            2) Under ActionScript settings, included the source path to the Flash Builder source files.

            3) In the same panel, set the Document class to the same class as the main class in the Flash Builder project.

            4) In the same window, under library path, included the AIR 3.4 SDK, with the same path as the Flash Builder project used.

            5) Went to config constants in the same window, updated to what I had in my Flash Builder project.

            6) In the main side panel, under Document Properties, clicked "Publish Settings....". Set "hardware Acceleration" to "Level 1 - direct".

             

            This seemed to work, until I tried to add actionscript code to the timeline. Then I got the error: 1180: Call to a possibly undefined method addFrameScript. I searched and found that this is because I set the document class to a Sprite. So I changed it to a MovieClip, and it works again, but now an alarm bell rings: All the above tweaks have been ways to handle various error messages that came up. I solve them one by one, and get a new error. My inner alarm bell tells me I might be going about this the wrong way, since each time I solve a problem I get a new one. Perhaps there is a better way? Perhaps I should import a fresh project into Flash Builder instead, and solve things from there, so at least I can make sure project settings are synchronized between Flash Builder and Flash Professional? I am leaving the thread open, so someone with experience may chime in.