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

Is there any event for when a sprite changes in a motion

Community Beginner ,
Feb 13, 2019 Feb 13, 2019

I have been programming a command for Animate(a jsfl file), and I'm implementing something with it's Animate's own 'Export Motion as XML'.

The problem is that after exporting it, it just gives its transform informations, and I'm needing to get the sprite/frame/image change on it's motion, I have been trying to find in it's documentation about looking IF the actual frame is a keyframe, and the closest thing is frame.hasMotionPath() and frame.isMotionObject()

Now, I'm wanting informations or triggers when the keyframe got different informations about more internal frames, if it changed the image during the motion, and to what image it changed

171
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 ,
Feb 13, 2019 Feb 13, 2019

Hi.

You can detect keyframes by using the frame.frameStart and frame.duration properties.

Anyway, I think I didn't get what exactly you want to do.

Can you elaborate more or give some example?

Regards,

JC

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 ,
Feb 13, 2019 Feb 13, 2019

What I want is: know when in the motion it change the actual image it is using

Let's suppose that in a motion I make one symbol change its image from 'idle.png' to 'walk.png', it usually don't appear something like that

Can i know in the motion any attribute that says what image it is current using? As I know transform attributes is possible, but I didn't find anything about the image

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 ,
Feb 14, 2019 Feb 14, 2019

Hi again.

If I'm understanding correctly, you can use the libraryItem property.

Say for example you have a timeline with only one layer and that there are two keyframes with one bitmap in each keyframe. The first bitmap is called idle.png in the Library and the second is called walk.png in the Library.

You could write this:

var doc = fl.getDocumentDOM();

var timeline = doc.getTimeline();

var frames = timeline.layers[timeline.currentLayer].frames;

var current;

var previous = null;

frames.forEach(function(frame, index)

{   

    current = frame.elements[0].libraryItem.name;

   

    if (previous && previous !== current)

            fl.trace("changed" + ", " + index + ", " + previous + ", " + current);

   

    previous = current;

});

Please let me know if this helps you.

Regards,

JC

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 ,
Feb 15, 2019 Feb 15, 2019
LATEST

It is very close to what I want to do, you're in the way.

The next thing I wanted to do is: in the library I could find the symbol name for the frame, the problem is that I want the next frame that is inside the symbol that i found by searching for libraryItem.name, as it doesn't change it because it is inside the own symbol and don't have a separate bitmap for this

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