ActionScript 类型反射

import flash.utils.describeType;

trace(describeType(flash.net.NetStream));

以debug模式运行,在console控制台会打印输出NetStream的所有属性和方法(需保证安装的是debugger版本的 flash 播放器):
<type name="flash.net::NetStream" base="Class" isDynamic="true" isFinal="true" isStatic="true">
  <extendsClass type="Class"/>
  <extendsClass type="Object"/>
  <constant name="DIRECT_CONNECTIONS" type="String"/>
  <constant name="CONNECT_TO_FMS" type="String"/>
  <accessor name="prototype" access="readonly" type="*" declaredBy="Class"/>
  <factory type="flash.net::NetStream">
    <metadata name="Event">
      <arg key="name" value="onPlayStatus"/>
    </metadata>
    <metadata name="Event">
      <arg key="name" value="onCuePoint"/>
    </metadata>
    <metadata name="Event">
      <arg key="name" value="onTextData"/>
    </metadata>
    <metadata name="Event">
      <arg key="name" value="onImageData"/>
    </metadata>
    <metadata name="Event">
      <arg key="name" value="onMetaData"/>
    </metadata>
    <metadata name="Event">
      <arg key="name" value="onXMPData"/>
    </metadata>
    <metadata name="Event">
      <arg key="name" value="netStatus"/>
      <arg key="type" value="flash.events.NetStatusEvent"/>
    </metadata>
    <metadata name="Event">
      <arg key="name" value="ioError"/>
      <arg key="type" value="flash.events.IOErrorEvent"/>
    </metadata>
    <metadata name="Event">
      <arg key="name" value="asyncError"/>
      <arg key="type" value="flash.events.AsyncErrorEvent"/>
    </metadata>
    <extendsClass type="flash.events::EventDispatcher"/>
    <extendsClass type="Object"/>
    <implementsInterface type="flash.events::IEventDispatcher"/>
    <constructor>
      <parameter index="1" type="*" optional="false"/>
      <parameter index="2" type="*" optional="true"/>
    </constructor>
    <accessor name="time" access="readonly" type="Number" declaredBy="flash.net::NetStream"/>
    <method name="togglePause" declaredBy="flash.net::NetStream" returnType="void"/>
    <accessor name="bytesLoaded" access="readonly" type="uint" declaredBy="flash.net::NetStream"/>
    <accessor name="currentFPS" access="readonly" type="Number" declaredBy="flash.net::NetStream"/>
    <method name="resume" declaredBy="flash.net::NetStream" returnType="void"/>
    <accessor name="bytesTotal" access="readonly" type="uint" declaredBy="flash.net::NetStream"/>
    <method name="attachCamera" declaredBy="flash.net::NetStream" returnType="void">
      <parameter index="1" type="flash.media::Camera" optional="false"/>
      <parameter index="2" type="int" optional="true"/>
    </method>
    <accessor name="decodedFrames" access="readonly" type="uint" declaredBy="flash.net::NetStream">
      <metadata name="Inspectable">
        <arg key="environment" value="none"/>
      </metadata>
    </accessor>
    <method name="play" declaredBy="flash.net::NetStream" returnType="void"/>
    <accessor name="bufferLength" access="readonly" type="Number" declaredBy="flash.net::NetStream"/>
    <method name="attachAudio" declaredBy="flash.net::NetStream" returnType="void">
      <parameter index="1" type="flash.media::Microphone" optional="false"/>
    </method>
    <accessor name="videoCodec" access="readonly" type="uint" declaredBy="flash.net::NetStream">
      <metadata name="Inspectable">
        <arg key="environment" value="none"/>
      </metadata>
    </accessor>
    <accessor name="audioCodec" access="readonly" type="uint" declaredBy="flash.net::NetStream">
      <metadata name="Inspectable">
        <arg key="environment" value="none"/>
      </metadata>
    </accessor>
    <method name="close" declaredBy="flash.net::NetStream" returnType="void"/>
    <accessor name="bufferTime" access="readwrite" type="Number" declaredBy="flash.net::NetStream"/>
    <accessor name="checkPolicyFile" access="readwrite" type="Boolean" declaredBy="flash.net::NetStream"/>
    <accessor name="client" access="readwrite" type="Object" declaredBy="flash.net::NetStream"/>
    <method name="receiveAudio" declaredBy="flash.net::NetStream" returnType="void">
      <parameter index="1" type="Boolean" optional="false"/>
    </method>
    <method name="seek" declaredBy="flash.net::NetStream" returnType="void">
      <parameter index="1" type="Number" optional="false"/>
    </method>
    <method name="receiveVideo" declaredBy="flash.net::NetStream" returnType="void">
      <parameter index="1" type="Boolean" optional="false"/>
    </method>
    <accessor name="liveDelay" access="readonly" type="Number" declaredBy="flash.net::NetStream"/>
    <method name="publish" declaredBy="flash.net::NetStream" returnType="void">
      <parameter index="1" type="String" optional="true"/>
      <parameter index="2" type="String" optional="true"/>
    </method>
    <accessor name="objectEncoding" access="readonly" type="uint" declaredBy="flash.net::NetStream"/>
    <method name="receiveVideoFPS" declaredBy="flash.net::NetStream" returnType="void">
      <parameter index="1" type="Number" optional="false"/>
    </method>
    <method name="send" declaredBy="flash.net::NetStream" returnType="void">
      <parameter index="1" type="String" optional="false"/>
    </method>
    <method name="pause" declaredBy="flash.net::NetStream" returnType="void"/>
    <accessor name="soundTransform" access="readwrite" type="flash.media::SoundTransform" declaredBy="flash.net::NetStream"/>
    <method name="addEventListener" declaredBy="flash.events::EventDispatcher" returnType="void">
      <parameter index="1" type="String" optional="false"/>
      <parameter index="2" type="Function" optional="false"/>
      <parameter index="3" type="Boolean" optional="true"/>
      <parameter index="4" type="int" optional="true"/>
      <parameter index="5" type="Boolean" optional="true"/>
    </method>
    <method name="toString" declaredBy="flash.events::EventDispatcher" returnType="String"/>
    <method name="dispatchEvent" declaredBy="flash.events::EventDispatcher" returnType="Boolean">
      <parameter index="1" type="flash.events::Event" optional="false"/>
    </method>
    <method name="hasEventListener" declaredBy="flash.events::EventDispatcher" returnType="Boolean">
      <parameter index="1" type="String" optional="false"/>
    </method>
    <method name="willTrigger" declaredBy="flash.events::EventDispatcher" returnType="Boolean">
      <parameter index="1" type="String" optional="false"/>
    </method>
    <method name="removeEventListener" declaredBy="flash.events::EventDispatcher" returnType="void">
      <parameter index="1" type="String" optional="false"/>
      <parameter index="2" type="Function" optional="false"/>
      <parameter index="3" type="Boolean" optional="true"/>
    </method>
  </factory>
</type>
[SWF] home/dyw/workspace-eclipse33/as3/bin-debug/HelloWorld.swf - 1,453 bytes after decompression


使用
flash.external.ExternalInterface.call("console.log",describeType(flash.net.NetStream).toXMLString());
则可以把信息打印到firebug控制台。

你可能感兴趣的:(xml,.net,Firebug,Flash,actionscript)