6 Replies Latest reply on Mar 11, 2008 11:05 PM by pachash

    The state of JavaScript support in Director 11

    pachash Level 1
      Hi! I asked this question in several places without any meaningful feedback, maybe someone around here will shed some more light on this ;) Ok, here it goes:

      It looks that Lingo is the most natural choice for many Director developers. Even though I have nothing against Lingo, I prefer using JavaScript to it due to my personal reasons. And I wonder what's the state of JavaScript support in the new Director?

      To be honest, I've always had a feeling that JavaScript script was added into Director MX in the last minute just before the release ;) Awkward getPropRef(..), absence of some important methods available in
      Lingo(e.g member(0).model("foo")), fatal errors on the every tiny typo when working with 3d stuff, etc.

      Has anything changed in the new Director? And if no, does it really make sense to use JavaScript in Director at all?

      Can someone around tell me of any serious game(like Maid Marian) using JavaScript instead of Lingo? How fast JavaScript virtual machine compared to Lingo? I also have a very strong suspicion that JavaScript can be a cause of memory leaks when used improperly, especially in case of closures, any tips on this?

      Thanks in advance.
        • 1. Re: The state of JavaScript support in Director 11
          Level 7
          > I asked this question in several places without any meaningful feedback

          Actually, Mark provided you _very_ meaningful feedback, just not the
          answer you perhaps wanted.
          • 2. Re: The state of JavaScript support in Director 11
            pachash Level 1
            quote:

            Originally posted by: Newsgroup User
            > I asked this question in several places without any meaningful feedback

            Actually, Mark provided you _very_ meaningful feedback, just not the
            answer you perhaps wanted.



            Well, yes, he did(and I'm really grateful for that) but only for the first part of the post(and he admitted that himself). And the second part of my post is actually more important to me. Maybe I need to rephrase the original subject into something like "Should I really use JavaScript in Director" ?...

            • 3. Re: The state of JavaScript support in Director 11
              Chunick Level 3
              quote:

              Originally posted by: pachash
              To be honest, I've always had a feeling that JavaScript script was added into Director MX in the last minute just before the release ;) Awkward getPropRef(..), absence of some important methods available in
              Lingo(e.g member(0).model("foo")), fatal errors on the every tiny typo when working with 3d stuff, etc.

              Has anything changed in the new Director? And if no, does it really make sense to use JavaScript in Director at all?

              Can someone around tell me of any serious game(like Maid Marian) using JavaScript instead of Lingo? How fast JavaScript virtual machine compared to Lingo? I also have a very strong suspicion that JavaScript can be a cause of memory leaks when used improperly, especially in case of closures, any tips on this?

              Thanks in advance.

              If you have access to MX2004 already then you currently have experience with the state of Javascript as it stands. Director 11 is not out yet and anyone on this forum who has beta tested Director 11 is under an NDA (Non Disclosure Agreement) so they will not be able to discuss those particulars. I don't even know if the Director Evangelist, Allen Partridge, can go into much detail regarding Javascript but I would guess he would have the most leeway in discussing D11 features. So, although you really, really want to know, you will just have to wait for March 25th like everyone else to test drive it.


              • 4. Re: The state of JavaScript support in Director 11
                pachash Level 1
                quote:

                Originally posted by: Chunick
                So, although you really, really want to know, you will just have to wait for March 25th like everyone else to test drive it.


                Ok, I see, can't wait for 25th of March then ;) Thanks.

                • 5. Re: The state of JavaScript support in Director 11
                  Ex Malterra Level 1
                  I prefer JavaScript to Lingo as well, mainly because I learned scripting/programming in C++/Java/C#/ActionScript/JavaScript. I’ve been using JavaScript syntax exclusively since MX 2004, and while there are things you have to work around, like not being able to access models by name, I’ve had great success with it.

                  I prefer JavaScript syntax OOP in Director to Lingo Parent scripts. There are some buggy things to deal with; for instance I’ve had issues with “static” members mysteriously becoming undefined, but nothing I’ve not been able to work around. I use a getMemberByName(memberName, memberType, w3dMember) function to get around the “can’t get model/texture/shader etc. by name” issue. Try/catch has been a huge help. I’ve got nothing against Lingo, and hope future versions of Director continue to support it because so many long time users like it. However, as I said, I’ve not used it for years.

                  I was lucky enough to get a Director 11 Beta 1.0 CD-ROM because an associate recommended me for it to Adobe. I wasn’t a true Beta tester per se, and wasn’t asked to abide by any NDA. In fact, my inquiries into what my responsibilities/restrictions were to be went unanswered.

                  That being said, I’m afraid I can’t offer much to this discussion; I installed the Beta on my laptop (Vista) the day I got it but had vacation for two weeks a week after that. The Beta version was essentially a 30 day trial and while I told myself “I’ll check it out while on vacation” my wife had other ideas. I did see that there was a JavaScript dictionary that mirrored the Lingo dictionary in the script editor, but that there was no color hinting for JavaScript syntax. In fact that was pointed out in the documentation. I can’t say if this is still true in the final version. Everything I tried (author time and runtime) worked well in Vista, whereas I’ve had a few problems with MX 2004 and Vista.

                  I’m unaware of any tweaks to the SpiderMonkey engine or its implementation in Director, and don’t feel my limited use of the Beta qualifies me as a reliable source of info on the matter, especially since I wasn’t able to really run it through the ringer. I can say that during my limited experimentation I didn’t run into any issues and that everything ran smooth… no “a fatal error has occurred” messages like I too often get now.

                  On the whole I’m feeling very positive about not only this release but Director’s immediate future. I’m getting the durn thing the first week it’s out.
                  • 6. Re: The state of JavaScript support in Director 11
                    pachash Level 1
                    quote:

                    Originally posted by: Ex Malterra
                    I prefer JavaScript to Lingo as well, mainly because I learned scripting/programming in C++/Java/C#/ActionScript/JavaScript. I’ve been using JavaScript syntax exclusively since MX 2004, and while there are things you have to work around, like not being able to access models by name, I’ve had great success with it.



                    I'm also a big fan of JavaScript. Furthermore, in the pretty big Director based project I'm currently involved, we have a quite interesting scripts build process: ActionScript-alike code is converted into JavaScript and it's loaded into Director. This allows to use very convenient ActionScript language constructs which are missing in JavaScript, for example, the following code is possible:

                    quote:


                    import Bar.as
                    import foo.*.as

                    class Zoo extends Wow
                    {
                    ...
                    }



                    Once the project is done, I hope to release our build tools as a separate OpenSource project.

                    quote:


                    I prefer JavaScript syntax OOP in Director to Lingo Parent scripts. There are some buggy things to deal with; for instance I’ve had issues with “static” members mysteriously becoming undefined, but nothing I’ve not been able to work around. I use a getMemberByName(memberName, memberType, w3dMember) function to get around the “can’t get model/texture/shader etc. by name” issue.



                    We use the same trick, we also have a bunch of Lingo functions which provide access to the stuff not available for JavaScript.

                    quote:


                    I’m unaware of any tweaks to the SpiderMonkey engine or its implementation in Director, and don’t feel my limited use of the Beta qualifies me as a reliable source of info on the matter, especially since I wasn’t able to really run it through the ringer. I can say that during my limited experimentation I didn’t run into any issues and that everything ran smooth… no “a fatal error has occurred” messages like I too often get now.



                    That's good news, the notorious "a fatal error" message without any detailed explanation is really killing me at times. Let's hope all of this is resolved in D11...