Setting instance names on keyframes quickly in AS3

ぐ巨炮叔叔 提交于 2019-12-04 15:36:00

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)

A semi-automatic way of finding and replacing instance names would be:

  1. Flash main menu > Edit > Find and Replace (CTRL+F)
  2. Search in "Current Document"
  3. For "Symbol"
  4. Name [your instance's symbol]
  5. Ensure that Live Edit is UNchecked.
  6. Write down your new instance name someplace, then copy it to clipboard.

Repeat the following per instance:

  1. Press Find Next on the Find and Replace panel
  2. Double-click the Instance Name textfield in the Properties panel, to select All
  3. Paste your new instance name, overwriting the original
  4. Press ENTER to commit your change.

Have fun! That's the best way using the tools within the Flash IDE

Name your instances before copying them to multiple keyframes! (before pressing F6 - Insert New Keyframe) That's always the best solution.

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.

the best way to change multiply frame ( but not the most conman )

  1. select all the frame in your that time line
  2. click the button "Edit multiply frame"
    this button is just below the time line near the onion skin

  3. change the instance name

this will change your instance name for all the frame

This extension will set the instance name over multiple keyframes: http://ajarproductions.com/blog/2010/03/30/set-instance-name-on-multiple-frames/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!