Copy link to clipboard
Copied
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
throws an error on - let myBlue = new lib.blueShape;
2 Correct answers
1. remove your js file from the include panel
2. use code to reference your library (and you'll need the main timeline, too)
3. load your js with code
// 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 ext_file.js you can use:
let myBlue=new LIB.blueShape();
tl.addChild(myBlue);
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);
Copy link to clipboard
Copied
Thank you very much! You are the best, I figured out how to add features to clips, thanks again! and sorry for disturbing
Copy link to clipboard
Copied
you're welcome, but i'm not sure how we got from the last post about problem to your most recent one with a solution.
what code are you using?
Copy link to clipboard
Copied
Here is the code
Copy link to clipboard
Copied
All the same, I need help, when I click hide an object, it hides all the objects that are on the canvas, but I need to individually
Copy link to clipboard
Copied
is the code you're showing in an external js file?
Copy link to clipboard
Copied
Yes, the internal code created another movie clip, the error was removed, well, I can’t understand how I can make functions for each individually, for example, the blue square disappears when you click it, but the green square doesn’t, since all movie clips disappear
Copy link to clipboard
Copied
get rid of the getMCSymbol... code. you're not using it.
and use "this" in your event listener.
Copy link to clipboard
Copied
What does it look like?
Copy link to clipboard
Copied
Whatever I haven’t written already, I can’t individually access the library, it adds all the movie clips from the canvas to the array and makes them under one function
Copy link to clipboard
Copied
Copy link to clipboard
Copied
And I don't understand how to address each object individually
Copy link to clipboard
Copied
the objects in list_playforms?
Copy link to clipboard
Copied
No, this is an array, well, when I add list_platforms.push(this.getChildAt(i)) then everything on the canvas is added to this array, but it is necessary that this array be individual, now I will write an example from as3.0, there it is works
Copy link to clipboard
Copied
if you're trying to select instances with a particular linkage, this has been addressed.
Copy link to clipboard
Copied
So what should be the code?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
all the is-statements in init() are problematic. i gave you a starting point to solve this, but i don't know how to proceed. ie, i would have to spend significant time to answer that.
there's only a certain amount of time i'll devote to solving user coding problems in the forums. beyond that, i would need to be hired (for pay).
Copy link to clipboard
Copied
I understand you, thank you very much
Copy link to clipboard
Copied
you're welcome.


-
- 1
- 2