A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Read text back thats inside a swf?

  1. #1
    Junior Member
    Join Date
    Jun 2000
    Posts
    3
    Hiya,
    Here's a question that i have been working on for weeks without any luck, Basically i need a way to read the text thats in textboxes within a swf (not dynamically from actionscript, if only it was that easy lol,the text has to be extracted from swf's directly)

    I have tried openswf.org and although its possible to get details such as the font type etc using thier script, the actual text isnt something thats available. Anyone out there knows anything about how to read the text from inside a swf I would be extremly grateful if you could post a reply or email rawebd@softhome.net .


    Thanks in advance,
    Will(rawebd)

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    Hi rawebd,

    its actually a two-step process. The font gets copied partially to the swf, with a table that relates characters to indexes in the glyph table. Then the actual text only uses these indexes. Using a swf tool of any sort, you have to find the DefineFont or DefineFont2 bit to get the character list, and then the DefineText bit to extract the glyph indexes and translate them into character codes.

    I have a program that gives me enough detail of swf's to do that manually, but I would probably wrap a a perl script around it or even write a rogram specific to the goal if it comes to lots of text.

    Just an aside comment: the above-mentioned character table is not required technically, so it is just a convenience feature.A "swf optimizer" might just throw it out

    Musicman

  3. #3
    Senior Member
    Join Date
    Jul 2000
    Posts
    503
    You can't really get a definate string unless you also parse the actionscript inside the SWF (in case of many of the "more advanced" sites which store TXT in databases or text files)...that could be a pain.

    --Jesse

  4. #4
    Registered User
    Join Date
    Feb 2010
    Posts
    1

    Smile

    Quote Originally Posted by Musicman View Post
    Hi rawebd,

    its actually a two-step process. The font gets copied partially to the swf, with a table that relates characters to indexes in the glyph table. Then the actual text only uses these indexes. Using a swf tool of any sort, you have to find the DefineFont or DefineFont2 bit to get the character list, and then the DefineText bit to extract the glyph indexes and translate them into character codes.

    I have a program that gives me enough detail of swf's to do that manually, but I would probably wrap a a perl script around it or even write a rogram specific to the goal if it comes to lots of text.

    Just an aside comment: the above-mentioned character table is not required technically, so it is just a convenience feature.A "swf optimizer" might just throw it out

    Musicman
    Musicman, I realize this post is ancient but I am now confronted with the same problem. Is there any chance you can expand on what you wrote and point me in the direction of any resources? Much obliged.

  5. #5
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    Hi,

    one part of the job is my swf analyzer - you can find it at www.fontimages.org.uk
    Now this might output
    Code:
    tag 10 stagDefineFont at file offset 26
    font 1: 4 glyphs
    0, offs 8:
    move 469 -580
    fillstyle0 1
    linestyle 0
    line 9,-15
    here all outline data of the font is shown
    This would be followed by a section
    Code:
    tag 13 stagDefineFontInfo at file offset 582
    font 1: BlueStone ANSI 
    0: B
    1: e
    2: l
    3: u
    and yet later by a section
    Code:
    tag 11 stagDefineText at file offset 701
    text 4
    rect 1.75,16.95 120.25,47.10
    translate 0 0
    rgb 0 0 0
    dy 931
    font 1 size 960
    2 chars:
    code u dx 742
    code e dx 742
    So you have a fragment with just the two characters "u" and "e"
    Note that the swf analyzer does not know much about unicode

    Musicman

    Musicman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center