Quantcast
Channel: Adobe Community : All Content - Adobe Animate CC - General
Viewing all articles
Browse latest Browse all 13519

Flash CC: use jQuery functions

$
0
0

I want to use jquery functions into flash for html5 game I am building. What I tried to do is add the following lines, and then use simple jquery function, but it seems not loaded, because I get the error: $ is not defined

 

My code, which is in the first frame of the main timeline, is:

var head = document.getElementsByTagName('head')[0];
var file = "http://code.jquery.com/jquery-1.11.0.min.js";
var ref = document.getElementsByTagName('script')[0];
var js = document.createElement('script');
js.src = file;
ref.parentNode.insertBefore(js, ref);

console.log(head.outerHTML);
console.log($(document).height());


console.log($(document).height());

 

The result I see in the console log, is the following:

<head>
      <meta charset="UTF-8">
      <title>ggg</title>
      <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script><script src="http://code.createjs.com/easeljs-0.7.1.min.js"></script>
     <script src="http://code.createjs.com/tweenjs-0.5.1.min.js"></script>
     <script src="http://code.createjs.com/movieclip-0.7.1.min.js"></script>
     <script src="ggg.js"></script>
     <script> var canvas, stage, exportRoot;
          function init()
          {   
               canvas = document.getElementById("canvas");
               exportRoot = new lib.ggg();
               stage = new createjs.Stage(canvas);
               stage.addChild(exportRoot); stage.update();
               createjs.Ticker.setFPS(lib.properties.fps);
               createjs.Ticker.addEventListener("tick", stage);
          }
     </script> </head> ggg.js:163

 

 

  1. > Uncaught ReferenceError: $ is not defined

 

What is wrong with that? and what I have to do so I can use jquery?

 

TIA


Viewing all articles
Browse latest Browse all 13519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>