Highlighted

Adobe Animate js export is different than Flash Professional

New Here ,
Jul 08, 2019

Copy link to clipboard

Copied

Hello,

I'm currently trying to migrate a project that is using the published JS file (published from a *.fla file) and import it in CreateJs based application. After the JS file has been published I modify it a bit further in order to make some optimizations before importing it into the CreateJs project.

Currently I'm trying to publish the same *.fla file from Adobe Animate. I have the exact same publish settings, as if I'm publishing the file from Flash Professional.

However the published JS file is different compared to the one published from Flash Professional which brakes my scipt, which I run afterwards.

Below you can see a bit the published code from both softwares:

Flash Professional:

(lib.myMc = function() {

this.initialize();

// Layer 2

this.instance = new lib.mcName();

this.instance.setTransform(-14,167);

this.instance_1 = new lib.mcRibbon();

this.instance_1.setTransform(-18,189);

this.addChild(this.instance_1,this.instance);

}).prototype = p = new cjs.Container();

p.nominalBounds = new cjs.Rectangle(-39,-35,339,338);

Animate:

(lib.myMc = function(mode,startPosition,loop) {

this.initialize(mode,startPosition,loop,{});

// Layer 2

this.instance = new lib.mcName();

this.instance.parent = this;

this.instance.setTransform(-14,167);

this.instance_1 = new lib.mcRibbon();

this.instance_1.parent = this;

this.instance_1.setTransform(-18,189);

this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.instance_1},{t:this.instance}]}).wait(1));

}).prototype = getMCSymbolPrototype(lib.myMc, new cjs.Rectangle(-39,-35,339,338), null);

As you can see there are some differences in both snippets. The main one is that in Flash Professional we see this "this.addChild(this.instance_1,this.instance);" and in Animate we see this "this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.instance_1},{t:this.instance}]}).wait(1));"

This part breaks my script as it is expecting "this.instance_1" and "this.instance" to be children of "this", while in Animate they are added as tweens to "this.timeline".

Have anyone experience such issue and how have worked around it?

Thank you in advance!

Adobe Community Professional
Correct answer by ClayUUID | Adobe Community Professional

The internal structure of Flash/Animate's generated Canvas code has evolved over time. Adobe is free to do this because the internal structure does not constitute a public API. Thus, any external code that depends on it being structured in a certain way does so at its own risk.

In other words, too bad, you're gonna have to update your script.

TOPICS
Discussions

Views

109

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

Adobe Animate js export is different than Flash Professional

New Here ,
Jul 08, 2019

Copy link to clipboard

Copied

Hello,

I'm currently trying to migrate a project that is using the published JS file (published from a *.fla file) and import it in CreateJs based application. After the JS file has been published I modify it a bit further in order to make some optimizations before importing it into the CreateJs project.

Currently I'm trying to publish the same *.fla file from Adobe Animate. I have the exact same publish settings, as if I'm publishing the file from Flash Professional.

However the published JS file is different compared to the one published from Flash Professional which brakes my scipt, which I run afterwards.

Below you can see a bit the published code from both softwares:

Flash Professional:

(lib.myMc = function() {

this.initialize();

// Layer 2

this.instance = new lib.mcName();

this.instance.setTransform(-14,167);

this.instance_1 = new lib.mcRibbon();

this.instance_1.setTransform(-18,189);

this.addChild(this.instance_1,this.instance);

}).prototype = p = new cjs.Container();

p.nominalBounds = new cjs.Rectangle(-39,-35,339,338);

Animate:

(lib.myMc = function(mode,startPosition,loop) {

this.initialize(mode,startPosition,loop,{});

// Layer 2

this.instance = new lib.mcName();

this.instance.parent = this;

this.instance.setTransform(-14,167);

this.instance_1 = new lib.mcRibbon();

this.instance_1.parent = this;

this.instance_1.setTransform(-18,189);

this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.instance_1},{t:this.instance}]}).wait(1));

}).prototype = getMCSymbolPrototype(lib.myMc, new cjs.Rectangle(-39,-35,339,338), null);

As you can see there are some differences in both snippets. The main one is that in Flash Professional we see this "this.addChild(this.instance_1,this.instance);" and in Animate we see this "this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.instance_1},{t:this.instance}]}).wait(1));"

This part breaks my script as it is expecting "this.instance_1" and "this.instance" to be children of "this", while in Animate they are added as tweens to "this.timeline".

Have anyone experience such issue and how have worked around it?

Thank you in advance!

Adobe Community Professional
Correct answer by ClayUUID | Adobe Community Professional

The internal structure of Flash/Animate's generated Canvas code has evolved over time. Adobe is free to do this because the internal structure does not constitute a public API. Thus, any external code that depends on it being structured in a certain way does so at its own risk.

In other words, too bad, you're gonna have to update your script.

TOPICS
Discussions

Views

110

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
Jul 08, 2019 0
Adobe Community Professional ,
Jul 08, 2019

Copy link to clipboard

Copied

The internal structure of Flash/Animate's generated Canvas code has evolved over time. Adobe is free to do this because the internal structure does not constitute a public API. Thus, any external code that depends on it being structured in a certain way does so at its own risk.

In other words, too bad, you're gonna have to update your script.

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...
Jul 08, 2019 0
New Here ,
Jul 09, 2019

Copy link to clipboard

Copied

Hi ClayUUID, thank for your prompt response.

From what I understand there is no way of having all nested movie clips/instances added as children to the parent movie clip? Even I have to update my script which is working with the output *.js file I think there will be other cases/people that when importing the default output *.js in their projects, these projects will expect the imported animations to have children in the parents container. Hope I express myself clear.

On another note, could you please recommend a proper tools for debugging *.jsfl scripts? What I find is only using fl.trace() and alert(). But if I have a variable of type object, then when using these two techniques I can't expand and see what is inside this object.

Thank you.

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...
Jul 09, 2019 0