it's the behavior of closures. to make this compatible, you could add a
property to the function, and then retrive it using arguments.callee
this._nc.onStatus = function(info) {
_root.Debug.write('onStatus ', info.code);
_root.Debug.write('this ', arguments.callee.originalthis );
}
this._nc.originalthis = this;
A
On Jun 15, Sarah Allen wrote:
>
> You are so right. It's a Flash Player 7 vs. Flash Player 8 issue, consistent
> across Mac & Windows.
> I'm still puzzled though. The NetConnection object was introduced in Flash
> Player 6.
>
>
> On Thu, Jun 15, 2006 at 3:28 PM, Adam Wolff wrote:
>
> > same flash player version?
> >
> > On Jun 15, Sarah Allen wrote:
> >
> > >
> > > I have some code that I just started testing on other machines today, and
> > > unexpectedly, I started seeing different (broken) behavior on a Mac. I've
> > > isolated it down to the following test case:
> > >
> > > <canvas>
> > > <node>
> > > <!--- a reference to the Flash NetConnection object
> > > @keywords private -->
> > > <attribute name="_nc" value="null" />
> > >
> > > <method name="init">
> > > super.init();
> > > this._nc = new NetConnection();
> > >
> > > var ok = this._nc.connect('rtmp://localhost/test');
> > > var t = this;
> > > this._nc.onStatus = function(info) {
> > > _root.Debug.write('onStatus ', info.code);
> > > _root.Debug.write('this (t) ', t); // this is line 17
> > > }
> > > </method>
> > > </node>
> > > </canvas>
> > >
> > > which generates the following:
> > > WARNING: test.lzx:17: reference to undefined variable 't'
> > > this (t) undefined
> > >
> > > Confused again,
> > > Sarah
> > >
> > > _______________________________________________
> > > Laszlo-dev mailing list
> > > [email protected]
> > > http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
> > >
>
>
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev