PDA

View Full Version : i need it to run directly after placing a key-frame for the chosen symbol in the time


MegaManZZ
02-13-2010, 05:12 AM
I am very new to JSFL, so i'm going to do my best to properly describe my issue.

At the moment I have a command that changes the embedded frame for the currently selected symbol ( if you don't know what I mean by embedded frame, I'm speaking about the number you can change for a symbol in properties area, directly above it you'll see the option of 'play once', 'loop','single frame').

My issue is i need it to run directly after placing a key-frame for the chosen symbol in the time-line, but it does not do that.

When i create a key-frame and then immediately run that command it Doesn't work. It only work if prior to selecting the command i click on the key that i created via mouse click. Which is undesirable.

I guess what I'm looking for is a simple script that places a key-frame and then selects the key I just made (so i don;t have to click it manually).


Please help me out!

animatorgeek
03-01-2010, 10:12 PM
It would help if you posted your code. With some quick testing, though, I've found the following to work correctly immediately after creating a keyframe:

// Set the currently selected symbol(s) to have their start frame be 4
fl.getDocumentDOM().setElementProperty('firstFrame ', 4-1);

// This part is just a workaround to make sure that CS4 updates its display correctly
original_selection = fl.getDocumentDOM().selection;
fl.getDocumentDOM().setSelectionRect({left:0, top:0, right:0, bottom:0});
fl.getDocumentDOM().selection = original_seleciton;


Note that the most current version of CS4 has a bug in it that makes it so that the display won't update correctly after the command to change the first frame, though. The stuff about the selection in the second part is a workaround for that.