6 Replies Latest reply on May 8, 2011 5:03 AM by Mike Blaustein

    MIAW scripts


      Hi all,


      I've just started to try to use MIAW's.  I'm running into a problem where I'm trying to instantiate an object in code.  I have something like:


      function startMovie()


        _player.alert("I am getting here");

        _global.myObject = new myScript();  // <-- throws an exception - myScript is not defined.



      In fact, myScript is defined.  I instantiate it in my main movie file.  Heck,  if I run the MIAW movie in Director it instantiates it just fine.  When I create the movie, however, it throws the above exception.





        • 1. Re: MIAW scripts
          James Newton, ACP Level 3



          Each window (the stage and every individual MIAW) has its own namespace for everything except globals. If myScript is not declared as a global in your MIAW, the your MIAW cannot access it. If myScript is a cast member, then you will have to link the MIAW to the same external castLib that holds the cast member. If the castLibs in the MIAW are not in the same order, then a global gMember may point to a different member in the same relative position.


          Does this help you to find the source of the problem?

          • 2. Re: MIAW scripts
            CAnuszczyk Level 1



            No, this doesn't help - but thanks.


            Scope I understand.

            I'm not sure what "gMember" is though and why it would be relevant here.  Can you explain?


            namespace? this is the first reference I've heard to anything in Director.  Sounds like a dotnet thing. no?


            Also - keep in mind that if I run the MIAW outside of the parent - just in Director all by itself, the movie plays fine and instantiates the object with no problem.


            myScript is a Javascript object type.  I'm trying to instantiate it.  It's definition is in a castlib that is linked to both the parent and the MIAW.  Could this be the problem?  The sharing of libraries between movies has never been a problem in the past, but I've never used MIAW's either.


            Thanks again!



            • 3. Re: MIAW scripts
              CAnuszczyk Level 1

              Confirmed - can't use the same castlib for some reason.  Probably has to open it exclusively or something like that.


              Anyway - I moved my script to a different, non-shared cast and it worked fine.  I'll just create a castlib that links in the same scripts but is not the same castlib.





              • 4. Re: MIAW scripts
                Sean_Wilson Adobe Community Professional

                Try making the shared library read-only

                • 5. Re: MIAW scripts
                  CAnuszczyk Level 1

                  Thanks Sean.  However, that didn't work.


                  I ended up with a common list of external scripts that I just link into two casts - one for the parent movie, one for the MIAW.


                  Seems kind of screwy and I'm not sure about the results yet.  MIAW's seem cool, but I'm having trouble with understanding who owns what.  For example, in a script object created in the "startmovie" event for the child movie, I reference member("amember").text and it fails - no properties which indicates, of course, that it can't find the cast member.  It's there, in the Internal cast for the child movie.  I'm guessing, at this point, that it only looks at the cast members of the parent movie?


                  Thanks again....

                  • 6. Re: MIAW scripts
                    Mike Blaustein Level 4

                    One thing that works well is communicatin between the primary movie (stage) and the MIAW.  You can do thing like:


                    on the MIAW timeline, call something like:








                    And vice versa where the stage can call out to the MIAW:





                    Therefore, what I tend to do is put almost no code into the MIAW score, apart from "local" stuff, which is only needed by the MIAW.  Then it can sort of act as a black box controlled by the stage.