Filed as http://www.openlaszlo.org/jira/browse/LPP-6658
A.
On Tue, Jul 15, 2008 at 12:29 PM , Raju Bitter wrote:
Thanks, Tucker. <when runtime="swf9"> does indeed work. :)
I was irritated by an old comment left in drawview.lzx from Jim:
</when>
<otherwise>
<!-- TODO [jgrandy 6/1/2007] <otherwise> should be <when
runtime="as2"> but that isn't currently supported -->
<script when="immediate"><![CDATA[
Guess that comment should be changed then. Max?
- Raju
Am 15.07.2008 16:53 Uhr schrieb "P T Withington" unter
<[EMAIL PROTECTED]>:
<when runtime="swf9"> does not work?
Is there a bug filed for 'if at top level'? I think that is an
arbitrary restriction in the compiler that was meant to avoid bugs
but
instead is just preventing useful patterns.
On 2008-07-15, at 02:13EDT, Raju Bitter wrote:
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