Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package
- {
- import flash.display.DisplayObject;
- import flash.display.Loader;
- import flash.display.MovieClip;
- import flash.display.Sprite;
- import flash.display.StageAlign;
- import flash.display.StageScaleMode;
- import flash.events.Event;
- import flash.net.URLRequest;
- import flash.text.TextField;
- /**
- * ...
- * @author kobayashi-taro
- */
- public class test extends Sprite
- {
- public function test()
- {
- stage.align = StageAlign.TOP_LEFT;
- stage.scaleMode = StageScaleMode.NO_SCALE;
- var tf:TextField = new TextField;
- tf.width = stage.stageWidth;
- tf.height = stage.stageHeight;
- addChild(tf);
- var id:String = loaderInfo.parameters.swf_id || '01';
- var ldr:Loader = new Loader;
- ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, function _onLoaded(event:Event):void {
- ldr.contentLoaderInfo.removeEventListener(Event.COMPLETE, _onLoaded);
- tf.text = parseMovieClip(ldr.content as MovieClip);
- });
- ldr.load(new URLRequest(id+'.swf'));
- }
- private function parseMovieClip(mc:MovieClip, level:int = 0):String {
- var numChildren:int = mc.numChildren;
- var child:DisplayObject;
- var childMC:MovieClip;
- var childInfo:Array = [];
- for (var i:int = 0; i < numChildren; ++i) {
- child = mc.getChildAt(i);
- if (child is MovieClip) {
- childMC = child as MovieClip;
- childInfo.push(
- getSpaces(level << 2) + childMC.name
- );
- childInfo = childInfo.concat(parseMovieClip(childMC, level + 1));
- }
- }
- return childInfo.join('\n');
- }
- private function getSpaces(count:int):String {
- return new Array(count)
- .map(function (...r):String { return " "; })
- .join('');
- }
- }
- }
Add Comment
Please, Sign In to add comment