Skip to main content
Deni318644749r7p
Known Participant
August 24, 2023
Answered

Adobe Animate HTML 5 Error when accessing internal library via external js script

  • August 24, 2023
  • 1 reply
  • 1944 views

Recently started learning Javascript and here is the problem When trying to access the internal Adobe Animate library through an external JS script, it swears and writes an error And if I write this script inside Adobe Animate it works fine, please help

 

let myBlue = new lib.blueShape;
exportRoot.addChild(myBlue);
let xPosition = Math.floor(Math.random()*700);
let yPosition = Math.floor(Math.random()*700);
myBlue.x = xPosition;
myBlue.y = yPosition;
root.push(myBlue);

 throws an error on - let myBlue = new lib.blueShape;

 

    This topic has been closed for replies.
    Correct answer kglad

    var queue = new createjs.LoadQueue(); queue.loadManifest([ "ext_file.js" ]); This is how I add the code well, I need something from the ext_file.js file to access the Adobe Animate library, and not from the timeline

     


    i showed you how to do that

     

    in your fla

     

    // don't use "var"

    tl = this;  // main timeline reference
    LIB = lib;  // library reference

     

    // load your js file(s)
    var queue = new createjs.LoadQueue();
    queue.loadManifest([
    "ext_file.js"
    ]);

     

     

    in your external js file

     

    let myBlue=new LIB.blueShape();

    tl.addChild(myBlue);

    1 reply

    kglad
    Community Expert
    Community Expert
    August 24, 2023

    you have to wait until the library is initialized to access it. 

     

    and that should be

     

    new lib.blueShape();

    Deni318644749r7p
    Known Participant
    August 24, 2023

    Thanks for the reply, but it still gives the same error.

    kglad
    Community Expert
    Community Expert
    August 25, 2023

    you still have a timing issue.  and then you'll need a lib reference.