0 Replies Latest reply on Jun 12, 2015 5:54 AM by saverman

    Event handler error after adding JavaScript

    saverman

      Hi,

       

      I just started out using Edge Animate and I tried adding the script below (found here How to make scale-to-fit compositions with Adobe Edge Animate - YouTube) to make my animation scale in a responsive design. However, when I add the code the console prompts "Javascript error in event handler! Event Type = element" as soon long as the bottom resize and ready functions are included. If I remove them and replace them with a line just calling the scaleStage function the error message is removed but it still doesn't resize the stage.

       

      Any idea what might be wrong?

       

      var stageHeight = sym.$("Stage").height();

       

      sym.$("Stage").css({

        "-moz-transform-origin": "0 0",

        "-ms-transform-origin": "0 0",

        "-webkit-transform-origin": "0 0",

        "transform-origin": "0 0"

      });

       

      function scaleStage() {

        var stage = sym.$("Stage");

        var parent = sym.$("Stage").parent();

        var parentWidth = stage.parent().width();

        var stageWidth = stage.width();

        var desiredWidth = Math.round(parentWidth * 1);

        var rescale = (desiredWidth / stageWidth);

       

        stage.css('-moz-transform', 'scale(' + rescale + ')');

        stage.css('-ms-transform', 'scale(' + rescale + ')');

        stage.css('-webkit-transform', 'scale(' + rescale + ')');

        stage.css('transform', 'scale(' + rescale + ')');

       

        parent.height(stageHeight * rescale);

      }

       

      $(window).on('resize', function (){

        scaleStage();

      });

       

      $(document).ready(function() {

        scaleStage();

      });