Search code examples
actionscript-3flashflash-cs4textfield

Intangible Flash textfields


I'm currently trying to mimic a screen from a flash game for my own inscrutable purposes, and a typical screenshot of the screen in question looks something like this
(http://i56.tinypic.com/2n9i5c8.png). I've successfully found and extracted the background image
(http://i55.tinypic.com/2vkmiqc.jpg) from the file, and now I'm trying to find out the positioning of the various text fields. The actionscript for the SWF has the various textfields being declared as such:

public var speedText:TextField;
public var exp:TextField;
public var evadeText:TextField;
public var lvl:TextField;
public var critText:TextField;

The problem I have is that I can't find any instance anywhere in the code that actually assigns x, y, width, or height attributes to any of the text fields, nor are they anywhere on the stage using Flash CS4, so I can't determine their positioning at all. I've searched all actionscript files associated with the swf for any instance of the textfield names, without any hits except for assigning text to them. If they aren't receiving their positioning attributes via actionscript, how are they receiving these values, and how can I obtain them?


Solution

  • load the swf with a Loader-Instance, then you can loop through its children and trace the positions:

    private function loadCompleteHandler(event : Event) : void
    {
    var content : MovieClip = loader.content as MovieClip;
    loopIt(content);
    }
    private function loopIt(movieClip : MovieClip) : void
    {
      for(var i : int = 0; i < movieClip.numChildren; i++)
      {
       trace("x pos: " + movieClip.getChildAt(0).x);
       if(movieClip.getChildAt(0) is MovieClip)
       {
         if(movieClip.getChildAt(0).numChildren>0)
         {
            loopIt(ovieClip.getChildAt(0));
         }
       }
      }
    }