问题
Right now in Flash CS3 and up (using Actionscript 3) if you have the same instance that is used in multiple keyframes in a layer, and you decide to assign or change the instance name later, you would have to go to each keyframe and set the instance name. This is a big nuisance. Is there a quicker or better way to do this?
NOTE: In AS2, you can set the name by using name property of the MovieClip in your code in the onLoad handler of the MovieClip class so it's done once and for all. Unfortunately in AS3, you are not allowed to set the name property anymore.
回答1:
You can use JSFL, a javascript-based automation lanaguage in Flash, to automate tasks like this.
- Click File > New
- Select "Flash JavaScript File" from the list
- Paste the following script
- Make sure you have your instances selected in your FLA file
- Click the Run (Play) button in your JSFL script file
You can then use the following code to name all selected instances with a prefix and an an index number:
var prefix:String = "myInstance_";
for(i in fl.getDocumentDOM().selection)
{
fl.getDocumentDOM().selection[i].name = prefix + i.toString();
}
This will result in your instances being named myInstance_1, myInstance_2, etc. This is mainly an example for you to extend to your specific needs.
(One thing to note fl.trace() is how you print trace messages in JSFL when you're debugging, took me a while to figure that out)
回答2:
A semi-automatic way of finding and replacing instance names would be:
- Flash main menu > Edit > Find and Replace (CTRL+F)
- Search in "Current Document"
- For "Symbol"
- Name [your instance's symbol]
- Ensure that Live Edit is UNchecked.
- Write down your new instance name someplace, then copy it to clipboard.
Repeat the following per instance:
- Press Find Next on the Find and Replace panel
- Double-click the Instance Name textfield in the Properties panel, to select All
- Paste your new instance name, overwriting the original
- Press ENTER to commit your change.
Have fun! That's the best way using the tools within the Flash IDE
回答3:
Name your instances before copying them to multiple keyframes! (before pressing F6 - Insert New Keyframe) That's always the best solution.
回答4:
if all of the instance frames is serial, you just assign the name in first of that. else 'finding and replacing instance names' maybe the best solution.
回答5:
the best way to change multiply frame ( but not the most conman )
- select all the frame in your that time line
click the button "Edit multiply frame"
this button is just below the time line near the onion skinchange the instance name
this will change your instance name for all the frame
回答6:
This extension will set the instance name over multiple keyframes: http://ajarproductions.com/blog/2010/03/30/set-instance-name-on-multiple-frames/
来源:https://stackoverflow.com/questions/410011/setting-instance-names-on-keyframes-quickly-in-as3