If you are looking for the decompiler itself, visit https://github.com/jindrapetrik/jpexs-decompiler
NEW : We have got a new blog where we post some interesting SWF internals info.
![List of issues](/flash/images/issue_list.png)
#2063 How to assign ActionScript to DefineSprite
Author:
NEMAMENE
![user user](/flash/images/user.png)
Date created:
Type: question
Visibility: Everybody
Assigned to:
State: closed ![Help](/flash/images/help.png)
![Help](/flash/images/help.png)
Hey! I`m interested in how to assign ActionScript to DefineSprite.
When decompiling the SWF, I saw that some sprites have scripts attached (the name of the
script after the index), but I can't do that. When trying to connect DoInitAction through
the context window of the sprite, nothing happens and an error appears:
21/08/2023 21:40:19 SEVERE Uncaught exception in thread: AWT-EventQueue-0
java.lang.ClassCastException: com.jpexs.decompiler.flash.gui.abc.ClassesListTreeModel
cannot be cast to com.jpexs.decompiler.flash.treeitems.FolderItem
at
com.jpexs.decompiler.flash.gui.tagtree.TagTreeContextMenu.addSpriteInitScript(TagTreeConte
xtMenu.java:2250)
at
com.jpexs.decompiler.flash.gui.tagtree.TagTreeContextMenu.addAs12SpriteInitScriptActionPer
formed(TagTreeContextMenu.java:2341)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
![Download](/flash/images/disk.png)
![Download](/flash/images/disk.png)
![Download](/flash/images/disk.png)
All you have to do is put a DoAction tag in some frame(s) of your sprite.
If you want it to be "named", you have to add ExportAssets tag after the sprite, and then
right-click on assets[count] to add one entry, then fill in the sprite ID and name of your
choice.
Thank you!
State: new→closed