Pregunta

We have a relatively simple SWF created by a 3rd-person that basically moves around some text. I need to be able to modify that text daily, but I don't have Flash and I don't know how to use Flash. So opening and modifying it in Flash is not an option. External files are not an option either.

I tried using FLASM and SWFMILL to disassemble the SWF, but the result doesn't display the actual text.

With FLASM I used flasm -d main_ver3.swf > main_ver3.flm. This was the result: https://dl.dropboxusercontent.com/u/10067449/Flash/main_ver3.flm

With swfmill I used swfmill swf2xml main_ver3.swf main_ver3.xml. This was the result: https://dl.dropboxusercontent.com/u/10067449/Flash/main_ver3.xml

In neither of them I see some of the text that was added to the Flash, for example, "Blackberry Curve", "Apple iphone", "Nokia Lumia".

What could the problem be? The text was created using Flash's Text tool.

Thanks.

¿Fue útil?

Solución

Yes, unfortunately it's not going to be as easy as replacing a text string. SWF is a complex format with a lot of possibilities. In your case the font is embedded as a set of glyphs, and the glyphs (letters) are referenced in the text objects.

The comic sans font is defined under this tag:

  <DefineFont3 objectID="15" isShiftJIS="0" isUnicode="0" isANSII="0" wideGlyphOffsets="0" italic="0" bold="0" language="1" name="Comic Sans MS">

This tag has a bunch of glyphs defined in it, and you'll notice the 10th glyph (index of 9 if you start counting from 0) has a map="65" value:

      <Glyph map="65">
        <GlyphShape>
          <edges>
            <ShapeSetup x="12500" y="300" fillStyle0="1"/>
            <CurveTo x1="-920" y1="0" x2="-680" y2="-2360"/>
            <CurveTo x1="-260" y1="-900" x2="-390" y2="-2250"/>
            ...

Decimal "65" is a capital A in ASCII. So the above draw calls are drawing a capital A. Later the Text record that starts with a glyph 9 (ascii 65, capital A) and spells out 'Apple iPhone' is (I've added the letters):

  <DefineText objectID="22">
    <bounds>
      <Rectangle left="26" right="2560" top="81" bottom="574"/>
    </bounds>
    <transform>
      <Transform transX="0" transY="0"/>
    </transform>
    <records>
      <TextRecord>
        <records>
          <TextRecord6 isSetup="1" objectID="15" y="440" fontHeight="400">
            <color>
              <Color red="255" green="255" blue="255"/>
            </color>
          </TextRecord6>
          <TextRecord6 isSetup="0">
            <glyphs>
              <TextEntry glyph="9" advance="293"/>   #  9 = A
              <TextEntry glyph="25" advance="214"/>  # 25 = p
              <TextEntry glyph="25" advance="214"/>  # 25 = p
              <TextEntry glyph="21" advance="110"/>  # 21 = l
              <TextEntry glyph="17" advance="219"/>  # 17 = e
              <TextEntry glyph="0" advance="120"/>   #  0 = space
              <TextEntry glyph="19" advance="112"/>  # 19 = i
              <TextEntry glyph="25" advance="214"/>  # 25 = P
              <TextEntry glyph="18" advance="231"/>  # 18 = h
              <TextEntry glyph="24" advance="210"/>  # 24 = o
              <TextEntry glyph="23" advance="209"/>  # 23 = n
              <TextEntry glyph="17" advance="219"/>  # 17 = e
            </glyphs>
          </TextRecord6>
          <TextRecord6 isSetup="0">
            <glyphs/>
          </TextRecord6>
        </records>
      </TextRecord>
    </records>
  </DefineText>

I'm not sure what the advance="###" is, but I'm guessing it's defining letter spacing. The l, i and space are only about 100 units wide, while the other letters are about 200 units.

Also, SWFs are compact, so it's not guaranteed that you have every glyph necessary to replace the text at will - it might only have the glyphs needed to render the text already in the SWF.

So in short, it is possible to modify the SWF with these tools, but it'd be a bit of digging and effort for you to change this text.

Also note that you could build a SWF that decompiled with a simple replaceable textfield if the designer was careful. It would need to pick up the text for the textfield from an Array defined in AS3 code (aka actions).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top