Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Canvas Publishing renaming duplicate instance names

Community Beginner ,
Sep 17, 2018 Sep 17, 2018

I have a general problem in converting some assets from ActionScript to canvas that I encounter on occasion.

I have a movie clip we'll call mcpatterns which contains 24 frames.  Inside each frame is a movie clip called "arrow1".  In some frames Arrow1 is an instance of a movieClip A, in some frames it's an instance of movieClip B, C or D.  In .as we could set a frame and reliably set the sub frame of "arrow1" no matter which movieClip it represented A,B,C,D.

Unfortunately, when I publish, the native .js "renames" my instances to arrow1, arrow1_1, arrow1_2, and arrow1_3.  This is a bit of an issue as I am programmatically referencing mcpatterns.arrow1 and dynamically changing it's frame.

One trick that's worked for me in the past, but doesn't seem to work here is to put each distinct type instance (referencing A,B,C,D sub-clibs) on separate layers, but this doesn't seem to resolve the "renaming".

I'm looking for a decent idea that doesn't require a lot of rework, as I'm trying to maintain both a .swf and .js version somewhat in parity.

I do see the issue that the Animate generated .js has when the .addTween command adds each of these to the timeline.  It needs to be able to uniquely reference them.  But once these are on the timeline of mcPatterns, I suspected it could have remapped the names back to what was intended.

 

The only thought I had was to reduce the complexity by combining all the movieclips into one and just have all the different states represented by the different frames.  But that will change the calculus of determining frames in the existing algorithm by more than I was hoping.

Thanks,

Jason

arrows .png

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

correct answers 1 Correct answer

LEGEND , Sep 17, 2018 Sep 17, 2018

Yup: https://forums.adobe.com/message/8715712?tstart=0#8715712

TL;DR instance names on a Canvas timeline always refer to the first instance to have that name, and subsequent instances of the same object on the same layer will actually be the original instance, referenced by the same name, even if you gave the instance a different name.

All this isn't an intrinsic limitation of CreateJS, it's just how they wrote the exporter. They got a little too aggressive with optimizing object creation.

What yo

...
Translate
LEGEND ,
Sep 17, 2018 Sep 17, 2018

Yup: https://forums.adobe.com/message/8715712?tstart=0#8715712

TL;DR instance names on a Canvas timeline always refer to the first instance to have that name, and subsequent instances of the same object on the same layer will actually be the original instance, referenced by the same name, even if you gave the instance a different name.

All this isn't an intrinsic limitation of CreateJS, it's just how they wrote the exporter. They got a little too aggressive with optimizing object creation.

What you can do is just not rely on the instance names at all. For example, you could have each arrow clip call a global or parent function like setCurrentArrow(this), which would reset the arrow clip to a known state and store the clip reference.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 17, 2018 Sep 17, 2018

I like your solution.  For now, I think I may just consolidate all the clips into one different movieclip and set the correct frame.  But I may revisit your idea.  I like the idea of moving away from instance names. 

I will say this aggressive optimization by the Animate compiler is really a thorn in the side of getting a lot of conversions done quickly.   It also introduces the possibility of unintended glitches of a movieclip perhaps not showing when you expect it to and also leaves open the possibility that you miss somewhere along the conversion process. 

Thanks for your help, really appreciate it!

Jason

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 17, 2018 Sep 17, 2018
LATEST

Oh yeah, it's a huge pain in the neck. I suspect whoever wrote the exporter was thinking more about straight animations and kind of forgot about interactively scripted timelines.

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