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

How to control the number of frames of a specified layer within a symbol through jsfl

Contributor ,
Sep 25, 2022 Sep 25, 2022

Implementation using jsfl,Symbol one shows the fifth frame of layer three

2345.png

TOPICS
ActionScript , Code , Exchange extensions
517
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 Expert ,
Sep 26, 2022 Sep 26, 2022

layer.frames is read-only so you can't add/remove frames to a layer. you can insert and remove frames from a timeline.

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
Contributor ,
Sep 26, 2022 Sep 26, 2022

The third layer is the symbol,Can you control it to display the fifth frame of a single frame?

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 Expert ,
Sep 27, 2022 Sep 27, 2022

i'm not sure what you've done, but you can convert a layer to a symbol (specifically a movieclip) and then you can manipulate that (and every other) moveiclip symbol's timeline by using timeline.cutFrames() and timeline.insertFrames() 

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
Engaged ,
Sep 27, 2022 Sep 27, 2022

Hi,

If I understand your question correctly, I think that the property you looking for is called firstFrame. If you want to display frame 5 of the internal timeline of a symbol, its instance on the stage should be graphic.

Then, you can select the instance and execute the following code:

 

fl.getDocumentDOM().selection[0].firstFrame = 4;

 

 

This will set the displayed frame of the selected instance at the current keyframe to 5.

 

 

- Vlad: UX and graphic design, Flash user since 1998
Member of Flanimate Power Tools team - extensions for character animation
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
Engaged ,
Sep 27, 2022 Sep 27, 2022

As an additional advice:
You can open your History Panel, right click on it and choose:
View > Javascript in Panel.
In this way, you'll see all the corresponding JSFL statements when you make changes via the UI.

Also, here is the complete (almost) JSFL documentation.

 

 

- Vlad: UX and graphic design, Flash user since 1998
Member of Flanimate Power Tools team - extensions for character animation
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
Contributor ,
Sep 27, 2022 Sep 27, 2022

I would like to be able to specify the number of frames in the layer inside the scene control symbol

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
Contributor ,
Sep 27, 2022 Sep 27, 2022

01.png02.png03.png

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
Contributor ,
Sep 27, 2022 Sep 27, 2022

so that there is no need to go inside the symbol for control

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
Contributor ,
Sep 30, 2022 Sep 30, 2022

@Vladin M. Mitov Can you take a look at my project file?

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
Contributor ,
Sep 30, 2022 Sep 30, 2022

What if all layers are inside a symbol

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
Contributor ,
Sep 30, 2022 Sep 30, 2022
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
Contributor ,
Oct 01, 2022 Oct 01, 2022

截屏2022-10-01 下午3.16.45.png

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 Expert ,
Oct 01, 2022 Oct 01, 2022
LATEST

see your post, https://community.adobe.com/t5/animate-discussions/how-to-choose-a-specific-layer/m-p/13238484#M3574...

 

or

 

var layerIndex = fl.getDocumentDOM().getTimeline().findLayerIndex("your_layer_name");


fl.getDocumentDOM().getTimeline().setSelectedLayers(layerIndex[0], true); 

/* if you have same named layers, index 0 might not be what you want. */

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
Contributor ,
Sep 30, 2022 Sep 30, 2022
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
Contributor ,
Sep 30, 2022 Sep 30, 2022

截屏2022-10-01 下午2.22.06.png

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