3 Replies Latest reply on Feb 15, 2016 6:23 AM by Colin Holgate

    AS3 vs JS, Please clarify?

    Pete47

      Ok, I've not coded anything in Flash for at least 4 years. Now, I'm back trying to use Adobe Animate CC because I need to produce interactive content that doesn't rely on the Flash plugin. I didn't know that javascript was available within Flash before Animate was released. I only got back into Flash/Animate because they've pulled the plug on Edge Animate.

       

      So, to produce an OAM package that contains an interactive movie, must everything be programmed in javascript?

       

      I've started a few test projects with Animate CC and selected the HTML5 Canvas output type. Then I've been using the code snippets under the HTML5 Canvas category within the Code Snippets window. Everything works fine when I test the output in a browser, from within Animate. But it fails when I try to publish to an OAM package.

       

      Guess I was thinking that anything I used from that set of snippets would be translated to the appropriate javascript upon publishing. I am starting to doubt that line of thinking because as soon as I do anything with those code snippets, I can't publish the project to an OAM package because I get a series of compile errors.

       

      "1061: Call to a possibly undefined method bind through a reference with static type Function."

       

      Can anyone help clarify how to code interactivity in an Animate movie for publishing to an OAM package?

        • 1. Re: AS3 vs JS, Please clarify?
          Colin Holgate MVP & Adobe Community Professional

          I have seen similar reports elsewhere, but didn't look into it yet. Your message gave me an idea though.

           

          The code snippets in Animate do seem to use 'bind', which I hadn't seen before looking at the code snippets. With Javascript the value 'this' depends on where you are, and I think that 'bind' is used to carry 'this' into other functions. But, it's possible that it's not OAM compatible.

           

          The way I usually work is like this:

           

          var self = this;

           

          function whatever(){

          self.dosomething();

          }

           

          The 'this' of the current object is used, instead of the 'this' of function whatever. If I'm right, if you use the approach I do then maybe OAM will be happy.

          • 2. Re: AS3 vs JS, Please clarify?
            Pete47 Level 1

            Hello Colin and think for you for the work around!

             

            My code in the test animation now looks like this:

             

            var globalThis = this;

             

            globalThis.StopPlanet.addEventListener("click", fl_MouseClickHandler);

            function fl_MouseClickHandler()

            {

              globalThis.Planet10.stop();

            }

             

            globalThis.PlayPlanet.addEventListener("click", fl_MouseClickHandler_2);

            function fl_MouseClickHandler_2()

            {

              globalThis.Planet10.play();

            }

             

            globalThis.PlayMoon.addEventListener("click", fl_MouseClickHandler_3);

            function fl_MouseClickHandler_3()

            {

              globalThis.Planet10.MovingBlackPlanet.OrbitingRedMoon.play();

            }

             

            globalThis.StopMoon.addEventListener("click", fl_MouseClickHandler_4);

            function fl_MouseClickHandler_4()

            {

              globalThis.Planet10.MovingBlackPlanet.OrbitingRedMoon.stop();

            }

             

             

            Not being a hard-core javascript programmer (yet) I jumped over to EaselJS v0.8.2 API Documentation : EaselJS and found an example of the javascript equivalent and made some edits. Oddly (for me) it worked on the first try. :-)

             

            My goal was to develop a work flow to produce an interactive animation for use with Captivate 9. That means the output must be an OAM file. With your help I've been successful! I've noticed a few oddities with the publish process that I will post on the other thread I started.

             

            Meanwhile, I have marked this posting answered correctly with your help. :-)

             

            Pete

            • 3. Re: AS3 vs JS, Please clarify?
              Colin Holgate MVP & Adobe Community Professional

              Thanks for reporting back. Here's a discussion on getting a transparent background, in case you hit that problem:

               

              Re: transparent background in adobe animate cc for oam file