Highlighted

Use javascript in the exported html file to edit a variable in the javascript canvas file.

New Here ,
Aug 12, 2020

Copy link to clipboard

Copied

Hi,
 
This is my first post here. I hope someone can help?
 
I am familiar with Javascript and Animate. 
 
I have an animate file that I have exported (it is a canvas) and I would like to write some javascript within the html file that can change something in the javascript file.
 
Specifically:

I want to edit the reference to "l3" below to "l1" or "l2" on the fly from javascript within my html file.


// stage content:
(lib.fileName = function(mode,startPosition,loop) {
this.initialize(mode,startPosition,loop,{});

// timeline functions:
this.frame_30 = function() {
exportRoot.text.line.gotoAndStop(0);
exportRoot.text.textBlueBG.gotoAndStop("l3");
exportRoot.text.textWhiteBG.gotoAndStop("l3");


}


Any tips or refences to documentations would be great.

 

Thank you.


 

Views

26

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Use javascript in the exported html file to edit a variable in the javascript canvas file.

New Here ,
Aug 12, 2020

Copy link to clipboard

Copied

Hi,
 
This is my first post here. I hope someone can help?
 
I am familiar with Javascript and Animate. 
 
I have an animate file that I have exported (it is a canvas) and I would like to write some javascript within the html file that can change something in the javascript file.
 
Specifically:

I want to edit the reference to "l3" below to "l1" or "l2" on the fly from javascript within my html file.


// stage content:
(lib.fileName = function(mode,startPosition,loop) {
this.initialize(mode,startPosition,loop,{});

// timeline functions:
this.frame_30 = function() {
exportRoot.text.line.gotoAndStop(0);
exportRoot.text.textBlueBG.gotoAndStop("l3");
exportRoot.text.textWhiteBG.gotoAndStop("l3");


}


Any tips or refences to documentations would be great.

 

Thank you.


 

Views

27

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 12, 2020 0
Adobe Community Professional ,
Aug 12, 2020

Copy link to clipboard

Copied

Why are you publishing as separate HTML and JS files? There's practically never any reason not to publish with them merged into a single HTML file.

 

Well anyway, once everything's loaded there's no concept of separate files since everything occupies the same browser namespace. So just replace your hard-coded strings with something like exportRoot.myLabel (exportRoot is a global reference to the root timeline) and make sure it's initialized to a default value somewhere. Then you can change it at will in any other code.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 12, 2020 0
Nick5FF2 LATEST
New Here ,
Aug 12, 2020

Copy link to clipboard

Copied

Thank you for your help.

 

I have just replaced my "l3" "l2" "and "l1" references with a variable outside the abode animate code and it works great.

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 12, 2020 0