Henry,

based on your advice I've come up with a wrapper class for the problem
with prototypes and the NetConnection in rtmpconnection.lzx. If it's
$swf9 I use a dynamic wrapper class for the NetConnection object:

        // For $swf9 it's not possible to use the prototpye approach with
        // _nc since NetConnection is not a dynamic class.
        if ($swf9) {
            this._nc = new NetConnectionWrapper();
        } else {
            // $swf8 or $swf7
            this._nc = new NetConnection();
        }
       ...
       var t = this;
        this._nc.onStatus = function(info) {
              this.t._onStatus(info);
        }
        // Local reference to rtmpconnection.
        // For some reason this cannot be done as a closure (in FP7).
        // See bug lpp-2197.
        this._nc.t = this;
;
Here's what the wrapper class looks like right now:
<library>
    <switch>
            <when runtime="dhtml">
            <!-- no RTMP support in DHTML mode -->      
            </when>
        <otherwise>
            <!-- really need to to
            <when runtime="as3">
            here -->
        <script when="immediate"><![CDATA[
            dynamic public class NetConnectionWrapper extends NetConnection {
                if ($swf9) {
                    #passthrough (toplevel:true) {
                import flash.net.NetConnection;
                        }#
            }

                public var nc:NetConnection = null;
                public var t = null;
        
                public function NetConnectionWrapper (arg=null) {
                super();
        
                }
        }
        ]]></script>
        </otherwise>
    </switch>
</library>

With that approach I'm fine for the swf9 runtime but of course run
into problems for swf8. There's no way to put the whole class
structure in an

if ($swf9) { dynamic public class NetConnectionWrapper extends
NetConnection { ... } }

construct since "if" ist no allowed at top level. The only solution I
see is to support <when runtime="as3"> syntax which would make things
a lot easier in many situations (like: adding swf9 specific content
inside tag based classes, which is right now limited to code blocks in
methods only (when tag not allowed inside classes, script tag not
allowed, import statements can not be inserted into LZX tag based
classes).

Thanks,
Raju

Reply via email to