diff --git a/CHANGELOG.md b/CHANGELOG.md index 651e211b6..3f53adf15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ All notable changes to this project will be documented in this file. - Incorrect placeobject display (tag selection) - Generic tag saving problem - timelined exception - [#1332] Flash viewer - Show directly added images when placeFlagHasImage is true on AS3 swfs +- XML Import - not set SWF and Timelined internal values caused an exception on item display ## [14.1.0] - 2021-03-05 ### Added diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/SwfXmlImporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/SwfXmlImporter.java index 92f152cf3..7d410eeb4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/SwfXmlImporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/SwfXmlImporter.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.importers; import com.jpexs.decompiler.flash.SWF; @@ -37,6 +38,7 @@ import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter; import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; import com.jpexs.decompiler.flash.abc.types.traits.Traits; import com.jpexs.decompiler.flash.amf.amf3.Amf3Value; +import com.jpexs.decompiler.flash.tags.DefineSpriteTag; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.TagTypeInfo; import com.jpexs.decompiler.flash.types.ALPHABITMAPDATA; @@ -143,11 +145,26 @@ public class SwfXmlImporter { Document doc = docBuilder.parse(new InputSource(new StringReader(xml))); processElement(doc.getDocumentElement(), swf, swf, null); swf.clearAllCache(); + setSwfAndTimelined(swf); } catch (ParserConfigurationException | SAXException ex) { logger.log(Level.SEVERE, null, ex); } } + private void setSwfAndTimelined(SWF swf) { + for (Tag t : swf.getTags()) { + t.setSwf(swf); + t.setTimelined(swf); + if (t instanceof DefineSpriteTag) { + DefineSpriteTag s = (DefineSpriteTag) t; + for (Tag st : s.getTags()) { + st.setSwf(swf); + st.setTimelined(s); + } + } + } + } + public Object importObject(String xml, Class requiredType, SWF swf) throws IOException { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); try {