4 Replies Latest reply on Oct 12, 2015 8:24 AM by darrenings

    Flash actionscript to Javascript for HTML5 Banners help

    darrenings

      HI

       

      I have been creating flash banners for the internet using Flash CS6 and Actionscript2. Today I have been told I need to supply it for HTML5.

       

      Obviously I know Actionscript does not work with HTML5 its all about Javascript.

       

      I am having problems adding javascript for specific functions.

       

      For instance I need the advert to stop on the last frame unless the page is refreshed. In as2 you could use the stop(); motion. I have found some JS that is supposed to work

      /* JS

      this.stop();

      */

       

      This does not appear to stop my animation from looping when I test it. Am I putting this in the wrong area? At the moment I am writing this in the actions panel on the selected keyframe I want the animation to stop. Is this correct?

       

      Any help would be greatly appreciated

       

      Thank you

        • 1. Re: Flash actionscript to Javascript for HTML5 Banners help
          Colin Holgate MVP & Adobe Community Professional

          I assume you're using the Toolkit add on to CS6, and not a more recent version of Flash Pro. Could be worth reading this article, in case there's something you've done differently:

           

          Using the Flash Professional Toolkit for CreateJS | Adobe Developer Connection

           

          At the very least, you're using /* JS, whereas Grant is using /* js. Don't know if it's case sensitive.

           

          In your browser, look at the Javascript error console, to see if there are errors happening.

          • 2. Re: Flash actionscript to Javascript for HTML5 Banners help
            darrenings Level 1

            Hi Colin

             

            I was using CS6 as I needed it for AS2. For this I have moved over to CC so am using the HTML5 Canvas option to create the banner.

             

            From there I used the Code snippets section and found it on there and this is the JS code it gave

             

             

             

            /* Stop at This Frame

            The  timeline will stop/pause at the frame where you insert this code.

            Can also be used to stop/pause the timeline of movieclips.

            */

             

             

            this.stop();

             

            I think this has worked it seems to be and I've also managed to sort out the click tag JS as well so hopefully all is good. I'm just sending it off to get tested to see if I have done it right.

             

            Thanks for your reply

            • 3. Re: Flash actionscript to Javascript for HTML5 Banners help
              Colin Holgate MVP & Adobe Community Professional

              I could have covered the other case in the same message! With the later versions of Flash Pro you no longer have to include the /* js */ part.

              • 4. Re: Flash actionscript to Javascript for HTML5 Banners help
                darrenings Level 1

                Hi Colin

                 

                Hoping you may be able to help me again. I am having problems sorting the clickTag on my HTML5 Canvas on Flash CC. For some reason I am having problems inserting it onto my banner and the media company are sending it back saying there is no clicktag on the banner. The media agency told me what I need to do with the HTML file after but I would imagine there is a way to get this to work going through Flash.

                 

                Below are some screenshots of the code I have in flash

                Screen Shot 2015-10-12 at 16.17.44.png

                Screen Shot 2015-10-12 at 16.17.34.png

                Screen Shot 2015-10-12 at 16.16.47.png

                 

                I'm not really sure What I'm doing wrong. The agency have said

                 

                The creative didn’t work correctly so we tried to make a couple of changes which included adding two lines of code into the html file in the creative:

                 

                <script>var clickTag="https://www.google.com/";</script>
                <a href="javascript: window.open(clickTag)" >

                 

                The http coding also had to be made https to ensure ssl compliance.



                This is the HTML part of the document they altered with the above text in it


                Screen Shot 2015-10-12 at 16.24.50.png


                I'm really not sure what needs to be done to sort this.


                Thank you