Undocumented ActionScript Flash Hack - Looking at the Prototype Property
(Page 3 of 4 )
To see if there is anything interesting within the classes, we can look at each property of the classes in turn. If we hit upon theprototypeproperty — where methods and properties are stored for the class (whether using ActionScript 1.0 or 2.0) — looking at its properties and methods should reveal whatever interesting tidbits lurk there:
// Set protection flags to 110 for _global to unhide everything
ASSetPropFlags(_global, null, 6, 1);
// List all objects in _global
for (thisObject in _global) {
ASSetPropFlags(_global[thisObject], null, 6, 1);
trace("\n" + thisObject);
for (props in _global[thisObject]) {
trace(" " + props);
// List subitems found under prototype.
if (props == "prototype") {
ASSetPropFlags(_global[thisObject].prototype, null, 6, 1);
for (protoChain in _global[thisObject].prototype) {
trace(" " + protoChain);
}
}
}
}
If you attach the preceding code to frame 1 and test the movie in Flash MX 2004, you’ll see a lengthy display (which would stretch 10 pages in this book). The listing includes documented classes and their methods and properties, such as for the String class:
String
fromCharCode
_ _proto_ _
constructor
prototype
substr
split
substring
slice
lastIndexOf
indexOf
concat
charCodeAt
charAt
toLowerCase
toUpperCase
toString
valueOf
_ _proto_ _
constructor
Note that this lists class methods and class properties followed by instance methods and instance properties indented under theprototype property.
 | If you've enjoyed what you've seen here, or to get more information, click on the "Buy the book!" graphic. Pick up a copy today!
Visit the O'Reilly Network http://www.oreillynet.com for more online content. |
Next: Trace() Statements >>
More Flash Articles
More By O'Reilly Media