From 8ce1df20608485731da6c64466a8985d12bbfbe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=F8=EDk?= Date: Mon, 20 May 2013 19:10:45 +0200 Subject: [PATCH] better script search caching placeobject getname fix --- .../decompiler/flash/abc/gui/ABCPanel.java | 27 +++-- .../flash/abc/gui/CachedDecompilation.java | 52 +++++++++ .../flash/abc/gui/DecompiledEditorPane.java | 81 ++----------- .../flash/action/gui/ActionPanel.java | 86 ++++---------- .../flash/action/gui/CachedScript.java | 36 ++++++ .../jpexs/decompiler/flash/helpers/Cache.java | 106 ++++++++++++++++++ .../flash/helpers/Highlighting.java | 3 +- .../flash/tags/PlaceObject2Tag.java | 2 +- .../flash/tags/PlaceObject3Tag.java | 2 +- .../decompiler/flash/tags/PlaceObjectTag.java | 2 +- .../flash/tags/PlaceObjectTypeTag.java | 2 +- .../decompiler/flash/xfl/XFLConverter.java | 4 +- 12 files changed, 251 insertions(+), 152 deletions(-) create mode 100644 trunk/src/com/jpexs/decompiler/flash/abc/gui/CachedDecompilation.java create mode 100644 trunk/src/com/jpexs/decompiler/flash/action/gui/CachedScript.java create mode 100644 trunk/src/com/jpexs/decompiler/flash/helpers/Cache.java diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/ABCPanel.java b/trunk/src/com/jpexs/decompiler/flash/abc/gui/ABCPanel.java index 4e1858ad2..256b3790d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/ABCPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/ABCPanel.java @@ -32,6 +32,7 @@ import java.awt.event.*; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.TimerTask; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; @@ -43,7 +44,6 @@ import javax.swing.table.*; import javax.swing.tree.TreePath; import jsyntaxpane.DefaultSyntaxKit; import jsyntaxpane.actions.DocumentSearchData; -import jsyntaxpane.actions.gui.QuickFindDialog; public class ABCPanel extends JPanel implements ItemListener, ActionListener { @@ -94,6 +94,9 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener { found.add(p); } } + + System.gc(); + //found = decompiledTextArea.searchCache(txt, ignoreCase, regexp); if (found.isEmpty()) { searchPanel.setVisible(false); @@ -449,17 +452,17 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener { Main.mainFrame.tagTree.setSelectionPath(tp); Main.mainFrame.tagTree.scrollPathToVisible(tp); decompiledTextArea.setCaretPosition(0); - try { - Thread.sleep(100); - } catch (InterruptedException ex) { - Logger.getLogger(ABCPanel.class.getName()).log(Level.SEVERE, null, ex); - } - DocumentSearchData dsd = DocumentSearchData.getFromEditor(decompiledTextArea); - dsd.setPattern(searchFor, searchRegexp, searchIgnoreCase); - QuickFindDialog quickFindDlg = new QuickFindDialog(decompiledTextArea, dsd); - quickFindDlg.setRegularExpression(searchRegexp); - quickFindDlg.setIgnoreCase(searchIgnoreCase); - quickFindDlg.showFor(decompiledTextArea); + java.util.Timer t = new java.util.Timer(); + t.schedule(new TimerTask() { + @Override + public void run() { + DocumentSearchData dsd = DocumentSearchData.getFromEditor(decompiledTextArea); + dsd.setPattern(searchFor, searchRegexp, searchIgnoreCase); + dsd.showQuickFindDialogEx(decompiledTextArea, searchIgnoreCase, searchRegexp); + } + }, 1000); + + } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/CachedDecompilation.java b/trunk/src/com/jpexs/decompiler/flash/abc/gui/CachedDecompilation.java new file mode 100644 index 000000000..64019fb3d --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/CachedDecompilation.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2013 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.abc.gui; + +import com.jpexs.decompiler.flash.helpers.Highlighting; +import java.io.Serializable; +import java.util.List; + +/** + * + * @author JPEXS + */ +public class CachedDecompilation implements Serializable { + + public String text; + public String hilightedText; + + public List getHighlights() { + return Highlighting.getInstrHighlights(hilightedText); + } + + public List getTraitHighlights() { + return Highlighting.getTraitHighlights(hilightedText); + } + + public List getMethodHighlights() { + return Highlighting.getMethodHighlights(hilightedText); + } + + public List getClassHighlights() { + return Highlighting.getClassHighlights(hilightedText); + } + + public CachedDecompilation(String hilightedText) { + this.hilightedText = hilightedText; + this.text = Highlighting.stripHilights(hilightedText); + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/DecompiledEditorPane.java b/trunk/src/com/jpexs/decompiler/flash/abc/gui/DecompiledEditorPane.java index 0b5b3ce16..714263f46 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/DecompiledEditorPane.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/DecompiledEditorPane.java @@ -21,17 +21,13 @@ import com.jpexs.decompiler.flash.abc.ScriptPack; import com.jpexs.decompiler.flash.abc.types.ScriptInfo; import com.jpexs.decompiler.flash.abc.types.traits.Trait; import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; +import com.jpexs.decompiler.flash.helpers.Cache; import com.jpexs.decompiler.flash.helpers.Highlighting; import com.jpexs.decompiler.flash.tags.ABCContainerTag; import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; import java.util.List; -import java.util.Set; import java.util.Timer; import java.util.TimerTask; -import java.util.regex.Pattern; import javax.swing.event.CaretEvent; import javax.swing.event.CaretListener; @@ -50,6 +46,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL private ABCPanel abcPanel; private int classIndex = -1; private boolean isStatic = false; + private Cache cache = new Cache(); public ScriptPack getScriptLeaf() { return script; @@ -216,61 +213,16 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL } } - private class CachedDecompilation { - - public String text; - public String hilightedText; - - public List getHighlights() { - return Highlighting.getInstrHighlights(hilightedText); - } - - public List getTraitHighlights() { - return Highlighting.getTraitHighlights(hilightedText); - } - - public List getMethodHighlights() { - return Highlighting.getMethodHighlights(hilightedText); - } - - public List getClassHighlights() { - return Highlighting.getClassHighlights(hilightedText); - } - - public CachedDecompilation(String hilightedText) { - this.hilightedText = hilightedText; - this.text = Highlighting.stripHilights(hilightedText); - } - } - private List cacheKeys = new LinkedList(); - private List cacheValues = new LinkedList(); - private void uncache(ScriptPack pack) { - for (int i = 0; i < cacheKeys.size(); i++) { - if (cacheKeys.get(i) == pack) { - cacheValues.remove(i); - cacheKeys.remove(i); - break; - } - } + cache.remove(pack); } private CachedDecompilation getCached(ScriptPack pack) { - for (int i = 0; i < cacheKeys.size(); i++) { - if (cacheKeys.get(i) == pack) { - return cacheValues.get(i); - } - } - return null; + return (CachedDecompilation) cache.get(pack); } public String getCachedText(ScriptPack pack) { - for (int i = 0; i < cacheKeys.size(); i++) { - if (cacheKeys.get(i) == pack) { - return cacheValues.get(i).text; - } - } - return null; + return getCached(pack).text; } public void gotoLastTrait() { @@ -326,8 +278,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL private List abcList; public void clearScriptCache() { - cacheKeys.clear(); - cacheValues.clear(); + cache.clear(); } public void cacheScriptPack(ScriptPack scriptLeaf, List abcList) { @@ -340,24 +291,13 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL if (scriptIndex > -1) { script = abc.script_info[scriptIndex]; } - boolean found = false; - for (int i = 0; i < cacheKeys.size(); i++) { - if (cacheKeys.get(i) == scriptLeaf) { - found = true; - break; - } - } - if (!found) { - cacheKeys.add(scriptLeaf); + if (!cache.contains(scriptLeaf)) { for (int scriptTraitIndex : scriptLeaf.traitIndices) { hilightedCodeBuf.append(script.traits.traits[scriptTraitIndex].convertPackaged("", abcList, abc, false, false, scriptIndex, -1, true, new ArrayList())); } + hilightedCode = hilightedCodeBuf.toString(); - cacheValues.add(new CachedDecompilation(hilightedCode)); - } - if (cacheKeys.size() > maxCacheSize) { - cacheKeys.remove(0); - cacheValues.remove(0); + cache.put(scriptLeaf, new CachedDecompilation(hilightedCode)); } } @@ -407,8 +347,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL public void setABC(ABC abc) { this.abc = abc; - cacheKeys.clear(); - cacheValues.clear(); + cache.clear(); setText(""); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java b/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java index 9b0dc2da3..4705aa561 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java @@ -19,8 +19,6 @@ package com.jpexs.decompiler.flash.action.gui; import com.jpexs.decompiler.flash.DisassemblyListener; import com.jpexs.decompiler.flash.Main; import com.jpexs.decompiler.flash.SWF; -import com.jpexs.decompiler.flash.abc.ScriptPack; -import com.jpexs.decompiler.flash.abc.gui.DecompiledEditorPane; import com.jpexs.decompiler.flash.abc.gui.LineMarkedEditorPane; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.ActionGraph; @@ -32,6 +30,7 @@ import com.jpexs.decompiler.flash.gui.GraphFrame; import com.jpexs.decompiler.flash.gui.TagNode; import com.jpexs.decompiler.flash.gui.TagTreeModel; import com.jpexs.decompiler.flash.gui.View; +import com.jpexs.decompiler.flash.helpers.Cache; import com.jpexs.decompiler.flash.helpers.Helper; import com.jpexs.decompiler.flash.helpers.Highlighting; import com.jpexs.decompiler.flash.tags.Tag; @@ -46,8 +45,8 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; -import java.util.LinkedList; import java.util.List; +import java.util.TimerTask; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; @@ -66,7 +65,6 @@ import javax.swing.event.CaretListener; import javax.swing.tree.TreePath; import jsyntaxpane.DefaultSyntaxKit; import jsyntaxpane.actions.DocumentSearchData; -import jsyntaxpane.actions.gui.QuickFindDialog; public class ActionPanel extends JPanel implements ActionListener { @@ -107,51 +105,21 @@ public class ActionPanel extends JPanel implements ActionListener { private int foundPos = 0; private JLabel searchForLabel; private String searchFor; - private List cacheKeys = new LinkedList(); - private List cacheValues = new LinkedList(); - //private HashMap cache = new HashMap(); private boolean searchIgnoreCase; private boolean searchRegexp; + private Cache cache = new Cache(); private CachedScript getCached(ASMSource pack) { - for (int i = 0; i < cacheKeys.size(); i++) { - if (cacheKeys.get(i) == pack) { - return cacheValues.get(i); - } - } - return null; + return (CachedScript) cache.get(pack); } private void cacheScript(ASMSource src) { - int maxCacheSize = 20; - for (int i = 0; i < cacheKeys.size(); i++) { - if (cacheKeys.get(i) == src) { - return; - } - } - List as = src.getActions(SWF.DEFAULT_VERSION); - String s = com.jpexs.decompiler.flash.action.Action.actionsToSource(as, SWF.DEFAULT_VERSION); - List hilights = Highlighting.getInstrHighlights(s); - String srcNoHex = Highlighting.stripHilights(s); - cacheKeys.add(src); - cacheValues.add(new CachedScript(srcNoHex, hilights, as)); - if (cacheKeys.size() > maxCacheSize) { - cacheKeys.remove(0); - cacheValues.remove(0); - } - - } - - private static class CachedScript { - - public String text; - List hilights; - List actions; - - public CachedScript(String text, List hilights, List actions) { - this.text = text; - this.hilights = hilights; - this.actions = actions; + if (!cache.contains(src)) { + List as = src.getActions(SWF.DEFAULT_VERSION); + String s = com.jpexs.decompiler.flash.action.Action.actionsToSource(as, SWF.DEFAULT_VERSION); + List hilights = Highlighting.getInstrHighlights(s); + String srcNoHex = Highlighting.stripHilights(s); + cache.put(src, new CachedScript(srcNoHex, hilights)); } } @@ -225,7 +193,9 @@ public class ActionPanel extends JPanel implements ActionListener { editor.setText(stripped); for (Highlighting h : disassembledHilights) { if (h.offset == offset) { - editor.setCaretPosition(h.startPos); + if (h.startPos <= editor.getText().length()) { + editor.setCaretPosition(h.startPos); + } break; } } @@ -280,7 +250,7 @@ public class ActionPanel extends JPanel implements ActionListener { } cacheScript(asm); CachedScript sc = getCached(asm); - lastCode = sc.actions; + lastCode = asm.getActions(SWF.DEFAULT_VERSION); decompiledHilights = sc.hilights; lastDecompiled = sc.text; stripped = lastDecompiled; @@ -652,26 +622,18 @@ public class ActionPanel extends JPanel implements ActionListener { Main.mainFrame.tagTree.setSelectionPath(tp); Main.mainFrame.tagTree.scrollPathToVisible(tp); decompiledEditor.setCaretPosition(0); - try { - Thread.sleep(100); - } catch (InterruptedException ex) { - Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, null, ex); - } - DocumentSearchData dsd = DocumentSearchData.getFromEditor(decompiledEditor); - dsd.setPattern(searchFor, searchRegexp, searchIgnoreCase); - QuickFindDialog quickFindDlg = new QuickFindDialog(decompiledEditor, dsd); - quickFindDlg.setRegularExpression(searchRegexp); - quickFindDlg.setIgnoreCase(searchIgnoreCase); - quickFindDlg.showFor(decompiledEditor); + java.util.Timer t = new java.util.Timer(); + t.schedule(new TimerTask() { + @Override + public void run() { + DocumentSearchData dsd = DocumentSearchData.getFromEditor(decompiledEditor); + dsd.setPattern(searchFor, searchRegexp, searchIgnoreCase); + dsd.showQuickFindDialogEx(decompiledEditor, searchIgnoreCase, searchRegexp); + } + }, 1000); } private void uncache(ASMSource pack) { - for (int i = 0; i < cacheKeys.size(); i++) { - if (cacheKeys.get(i) == pack) { - cacheValues.remove(i); - cacheKeys.remove(i); - break; - } - } + cache.remove(pack); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/gui/CachedScript.java b/trunk/src/com/jpexs/decompiler/flash/action/gui/CachedScript.java new file mode 100644 index 000000000..cca4fa7f2 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/action/gui/CachedScript.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2013 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.action.gui; + +import com.jpexs.decompiler.flash.helpers.Highlighting; +import java.io.Serializable; +import java.util.List; + +/** + * + * @author JPEXS + */ +public class CachedScript implements Serializable { + + public String text; + List hilights; + + public CachedScript(String text, List hilights) { + this.text = text; + this.hilights = hilights; + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/Cache.java b/trunk/src/com/jpexs/decompiler/flash/helpers/Cache.java new file mode 100644 index 000000000..4219bd550 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/Cache.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2013 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.helpers; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.Map; +import java.util.WeakHashMap; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author JPEXS + */ +public class Cache { + + private Map cacheFiles = new WeakHashMap(); + + public boolean contains(Object key) { + return cacheFiles.containsKey(key); + } + + public void clear() { + for (File f : cacheFiles.values()) { + f.delete(); + } + cacheFiles.clear(); + } + + public void remove(Object key) { + if (cacheFiles.containsKey(key)) { + File f = cacheFiles.get(key); + f.delete(); + cacheFiles.remove(key); + } + } + + public Object get(Object key) { + if (!cacheFiles.containsKey(key)) { + return null; + } + File f = cacheFiles.get(key); + FileInputStream fis = null; + try { + fis = new FileInputStream(f); + ObjectInputStream ois = new ObjectInputStream(fis); + return ois.readObject(); + } catch (IOException ex) { + Logger.getLogger(Helper.class.getName()).log(Level.SEVERE, null, ex); + } catch (ClassNotFoundException ex) { + Logger.getLogger(Helper.class.getName()).log(Level.SEVERE, null, ex); + } finally { + if (fis != null) { + try { + fis.close(); + } catch (IOException ex) { + //ignore + } + } + } + return null; + } + + public void put(Object key, Object value) { + File temp = null; + ObjectOutputStream oos = null; + try { + temp = File.createTempFile("ffdec_cache", ".tmp"); + temp.deleteOnExit(); + oos = new ObjectOutputStream(new FileOutputStream(temp)); + oos.writeObject(value); + oos.flush(); + + cacheFiles.put(key, temp); + } catch (IOException ex) { + Logger.getLogger(Helper.class.getName()).log(Level.SEVERE, null, ex); + } finally { + if (oos != null) { + try { + oos.close(); + } catch (IOException ex) { + //ignore + } + } + } + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/Highlighting.java b/trunk/src/com/jpexs/decompiler/flash/helpers/Highlighting.java index fcd5cc98e..ac38bf4cf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/Highlighting.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/Highlighting.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.helpers; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; @@ -27,7 +28,7 @@ import java.util.regex.Pattern; * * @author JPEXS */ -public class Highlighting { +public class Highlighting implements Serializable { /** * Starting position diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java index 766cf4b82..f3dbd1699 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java @@ -297,7 +297,7 @@ public class PlaceObject2Tag extends Tag implements Container, PlaceObjectTypeTa } @Override - public String getName() { + public String getInstanceName() { if (placeFlagHasName) { return name; } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java index f35b07803..497d61d26 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java @@ -404,7 +404,7 @@ public class PlaceObject3Tag extends Tag implements Container, PlaceObjectTypeTa } @Override - public String getName() { + public String getInstanceName() { if (placeFlagHasName) { return name; } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java index 1d8a75a57..82b7b9c63 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java @@ -138,7 +138,7 @@ public class PlaceObjectTag extends Tag implements PlaceObjectTypeTag { } @Override - public String getName() { + public String getInstanceName() { return null; } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTypeTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTypeTag.java index a466f7444..f73638d46 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTypeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTypeTag.java @@ -19,7 +19,7 @@ public interface PlaceObjectTypeTag { public MATRIX getMatrix(); - public String getName(); + public String getInstanceName(); public CXFORM getColorTransform(); diff --git a/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java b/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java index 02eb395f6..a6c214e61 100644 --- a/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java +++ b/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java @@ -571,7 +571,7 @@ public class XFLConverter { usages.put(ch, 0); } int usageCount = usages.get(ch); - if (po.getName() != null) { + if (po.getInstanceName() != null) { usageCount++; } if (po.getColorTransform() != null) { @@ -1543,7 +1543,7 @@ public class XFLConverter { } video = (DefineVideoStreamTag) ch; } else { - elements += convertSymbolInstance(po.getName(), po.getMatrix(), po.getColorTransform(), po.getColorTransformWithAlpha(), po.cacheAsBitmap(), po.getBlendMode(), po.getFilters(), po.isVisible(), po.getBackgroundColor(), characters.get(characterId), characters, tags); + elements += convertSymbolInstance(po.getInstanceName(), po.getMatrix(), po.getColorTransform(), po.getColorTransformWithAlpha(), po.cacheAsBitmap(), po.getBlendMode(), po.getFilters(), po.isVisible(), po.getBackgroundColor(), characters.get(characterId), characters, tags); } } }