diff --git a/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java b/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java index cc5ef3ea8..a8849d941 100644 --- a/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java +++ b/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java @@ -1605,7 +1605,7 @@ public class XFLConverter { } } - private static String convertFrame(boolean shapeTween, HashMap characters, List tags, SoundStreamHeadTypeTag soundStreamHead, StartSoundTag startSound, int frame, String frameName, boolean isAnchor, int duration, String actionScript, String elements) { + private static String convertFrame(boolean shapeTween, HashMap characters, List tags, SoundStreamHeadTypeTag soundStreamHead, StartSoundTag startSound, int frame, int duration, String actionScript, String elements) { String ret = ""; DefineSoundTag sound = null; if (startSound != null) { @@ -1624,16 +1624,6 @@ public class XFLConverter { if (duration > 1) { ret += " duration=\"" + duration + "\""; } - if (frameName != null) { - ret += " name=\"" + frameName + "\""; - if (isAnchor) { - ret += " labelType=\"anchor\" bookmark=\"true\""; - } else { - ret += " labelType=\"name\""; - } - isAnchor = false; - frameName = null; - } if (shapeTween) { ret += " tweenType=\"shape\" keyMode=\"" + KEY_MODE_SHAPE_TWEEN + "\""; } else { @@ -1748,8 +1738,6 @@ public class XFLConverter { String lastElements = ""; int duration = 1; - String frameName = null; - boolean isAnchor = false; CharacterTag character = null; MATRIX matrix = null; @@ -1851,11 +1839,6 @@ public class XFLConverter { clipActions = null; } } - if (t instanceof FrameLabelTag) { - FrameLabelTag flt = (FrameLabelTag) t; - frameName = flt.getLabelName(); - isAnchor = flt.isNamedAnchor(); - } if (t instanceof ShowFrameTag) { elements = ""; @@ -1887,7 +1870,7 @@ public class XFLConverter { frame++; if (!elements.equals(lastElements) && frame > 0) { - ret += convertFrame(lastShapeTween, characters, tags, null, null, frame - duration, frameName, isAnchor, duration, "", lastElements); + ret += convertFrame(lastShapeTween, characters, tags, null, null, frame - duration, duration, "", lastElements); duration = 1; } else if (frame == 0) { duration = 1; @@ -1897,14 +1880,11 @@ public class XFLConverter { lastShapeTween = shapeTween; lastElements = elements; - - - frameName = null; - isAnchor = false; } } if (!lastElements.equals("")) { - ret += convertFrame(lastShapeTween, characters, tags, null, null, (frame - duration < 0 ? 0 : frame - duration), frameName, isAnchor, duration, "", lastElements); + frame++; + ret += convertFrame(lastShapeTween, characters, tags, null, null, (frame - duration < 0 ? 0 : frame - duration), duration, "", lastElements); } afterStr = "" + afterStr; if (!ret.equals("")) { @@ -1913,7 +1893,7 @@ public class XFLConverter { return ret; } - public static String convertActionScriptLayer(int layerIndex, int spriteId, List tags, List timeLineTags, String backgroundColor) { + public static String convertActionScriptLayer(int spriteId, List tags, List timeLineTags, String backgroundColor) { String ret = ""; String script = ""; @@ -1965,7 +1945,62 @@ public class XFLConverter { } } if (!ret.equals("")) { - ret = "" + ret = "" + + "" + + ret + + "" + + ""; + } + return ret; + } + + public static String convertLabelsLayer(int spriteId, List tags, List timeLineTags, String backgroundColor) { + String ret = ""; + int duration = 0; + int frame = 0; + String frameLabel = ""; + boolean isAnchor = false; + for (Tag t : timeLineTags) { + if (t instanceof FrameLabelTag) { + FrameLabelTag fl = (FrameLabelTag) t; + frameLabel = fl.getLabelName(); + isAnchor = fl.isNamedAnchor(); + } + if (t instanceof ShowFrameTag) { + + if (frameLabel.equals("")) { + duration++; + } else { + if (duration > 0) { + ret += " 1) { + ret += " duration=\"" + duration + "\""; + } + ret += " keyMode=\"" + KEY_MODE_NORMAL + "\">"; + ret += ""; + ret += ""; + ret += ""; + } + ret += "" + "" + ret + "" @@ -1992,7 +2027,7 @@ public class XFLConverter { if (t instanceof ShowFrameTag) { if (soundStreamHead != null || startSound != null) { if (lastSoundStreamHead != null || lastStartSound != null) { - ret += convertFrame(false, characters, tags, lastSoundStreamHead, lastStartSound, frame, null, false, duration, "", ""); + ret += convertFrame(false, characters, tags, lastSoundStreamHead, lastStartSound, frame, duration, "", ""); } frame += duration; duration = 1; @@ -2010,7 +2045,7 @@ public class XFLConverter { frame = 0; duration = 1; } - ret += convertFrame(false, characters, tags, lastSoundStreamHead, lastStartSound, frame, null, false, duration, "", ""); + ret += convertFrame(false, characters, tags, lastSoundStreamHead, lastStartSound, frame, duration, "", ""); } if (!ret.equals("")) { ret = "" @@ -2035,6 +2070,10 @@ public class XFLConverter { String ret = ""; ret += ""; ret += ""; + + ret += convertLabelsLayer(spriteId, tags, timelineTags, backgroundColor); + ret += convertActionScriptLayer(spriteId, tags, timelineTags, backgroundColor); + int layerCount = getLayerCount(timelineTags); Stack parentLayers = new Stack<>(); int index = 0; @@ -2102,11 +2141,6 @@ public class XFLConverter { int soundLayerIndex = layerCount; layerCount++; ret += convertSoundLayer(soundLayerIndex, backgroundColor, characters, tags, timelineTags); - - int actionScriptLayerIndex = layerCount; - layerCount++; - ret += convertActionScriptLayer(actionScriptLayerIndex, spriteId, tags, timelineTags, backgroundColor); - ret += ""; ret += ""; return ret;