zoukankan      html  css  js  c++  java
  • 读取swf里所有类定义

        public class test1 extends Sprite
        {
            public function test1()
            {
                test();
            }
            private function test():void {
                var loader:URLLoader=new URLLoader();
                loader.dataFormat=URLLoaderDataFormat.BINARY;
                loader.addEventListener(Event.COMPLETE,completeHandler);
                loader.load(new URLRequest("bank.swf"));
            }
            private function completeHandler(event:Event):void {
                var bytes:ByteArray=URLLoader(event.target).data;
                bytes.endian=Endian.LITTLE_ENDIAN;
                bytes.writeBytes(bytes,8);
                bytes.uncompress();
                bytes.position=Math.ceil(((bytes[0]>>>3)*4+5)/8)+4;
                while(bytes.bytesAvailable>2){
                    var head:int=bytes.readUnsignedShort();
                    var size:int=head&63;
                    if (size==63)size=bytes.readInt();
                    if (head>>6!=76)bytes.position+=size;
                    else {
                        head=bytes.readShort();
                        for(var i:int=0;i<head;i++){
                            bytes.readShort();
                            size=bytes.position;
                            while(bytes.readByte()!=0);
                            size=bytes.position-(bytes.position=size);
                            trace(bytes.readUTFBytes(size));
                        }
                    }
                }
            } 
        }
  • 相关阅读:
    video和audio
    H5-geolocation学习
    hammer.js学习
    echarts学习
    移动端手势识别
    SVG
    e.key && e.which && e.keyCode
    git中避免提交.DS_Store文件[转载]
    前端笔试题[1]
    Javascript实现格式化输出
  • 原文地址:https://www.cnblogs.com/as3lib/p/2468643.html
Copyright © 2011-2022 走看看