I am not an expert on the Flash APIs, but it seems to me from what I know of
how some of them work that the error is telling you that you cannot
instantiate a NetStream object until the NetConnection object has actually
connected.


        this._conn = new NetConnection(); // Create connection object.
        this._conn.connect("rtmp://192.168.1.94/Red5SharedObject/"); //
Connect to server.
        s1 = new NetStream(this._conn);   // Open stream within connection.

The error is happening when the "new NetStream" is called.

So, usually these APIs have a callback event handler (an as3 event, not a
Laszlo event).
You probably have to add a listener in as3 for the "connect" event on the
NetConnection object, and only then should you instantiate a NetStream for
it.

This is just my theory, I have not tried it.

The documentation on NetConnection says

connect to Flash Media Server, use rtmp, rtmpe, rtmps, rtmpt, rtmpte, or
rtmfp as the protocol. If the connection is successful, a netStatus event
with a code property of NetConnection.Connect.Success is returned. See the
NetStatusEvent.info property for a list of all event codes returned in
response to calling connect().

So you should look at adding a handler for the NetStatusEvent using
addEventListener probably

On Tue, Nov 24, 2009 at 3:48 PM, cem sonmez <[email protected]> wrote:

> @Henry Minsky
> You said that you compile the code without errors. But i have
> downloaded the latest nightly build of openlaszlo from
> http://download.openlaszlo.org/nightly/trunk/. And compiled it on
> swf10. I m using the flash debug player and the error message that i m
> getting is :
>
> ArgumentError: Error #2126 : NetConnection object must be connected.
>        at flash.net::NetStream()
>       at $lzc$class_$2Fcanvas/$m2()
>       at 
> Function/http://adobe.com/AS3/2006/builtin::call()<http://adobe.com/AS3/2006/builtin::call%28%29>
>       at LzEvent/sendEvent()
>       at LzCanvas/__LZcallInit()
>       at LzCanvas/__LZinstantiationDone()
>       at LzInstantiatorService/makeSomeViews()
>       at LzInstantiatorService/checkQ()
>       at 
> Function/http://adobe.com/AS3/2006/builtin::call()<http://adobe.com/AS3/2006/builtin::call%28%29>
>
> Do you suggest any solution to work out this error. Except you, if
> anyone who has faced this like error before, please help me about this
> issue. I m doing my job on openlaszlo platform and i have to solve
> this in a short time. And specially i want to work on swf9-swf10. Bec.
> of this i look like a bit hasty. Sorry for keeping the list busy.
>
> Looking for your replies.
> Best Regards.
>
>
>
> 2009/11/24 cem sonmez <[email protected]>:
> > I had seen on that adding the following line will fix the problem :
> > - NetConnection.defaultObjectEncoding = ObjectEncoding.AMF0; But also
> > it doesnT answer the purpose.
> > - I have downloaded the latest nightly build of openlaszlo
> > - I have added the flash.net.NetConnection, flash.net.NetStream..
> explicitly
> > - I am using the flash debug player and the full message that i m
> > getting at runtime is at my previous post
> >
> > Is there any advice to do this work on swf10?
> >
> > Regards
> >
> > 2009/11/23 cem sonmez <[email protected]>:
> >> I am using flash 10 debug player plugin. The message that i m getting is
> :
> >>
> >> ActionScript hatası oluştu:
> >> ArgumentError: Error #2126: NetConnection nesnesi bağlanmalıdır.
> >>        at flash.net::NetStream/construct()
> >>        at flash.net::NetStream()
> >>        at $lzc$class_$2Fcanvas/$m2()
> >>        at 
> >> Function/http://adobe.com/AS3/2006/builtin::call()<http://adobe.com/AS3/2006/builtin::call%28%29>
> >>        at LzEvent/sendEvent()
> >>        at LzCanvas/__LZcallInit()
> >>        at LzCanvas/__LZinstantiationDone()
> >>        at LzInstantiatorService/makeSomeViews()
> >>        at LzInstantiatorService/checkQ()
> >>        at 
> >> Function/http://adobe.com/AS3/2006/builtin::call()<http://adobe.com/AS3/2006/builtin::call%28%29>
> >>        at LzEvent/sendEvent()
> >>        at LzIdleKernel$/__update()
> >>
> >> 2009/11/23 Max Carlson <[email protected]>:
> >>> One thing you might want to try is installing the Flash 10 debug
> player:
> >>> http://www.adobe.com/support/flashplayer/downloads.html
> >>>
> >>> The debug player makes it much easier to pinpoint these kinds of
> issues.
> >>>  Let me know if that helps!
> >>>
> >>> cem sonmez wrote:
> >>>>
> >>>> Hi
> >>>> Especially i m compiling my code on swf10 but especially at the
> >>>> netconnection operations (sharedobject, netconnection, netstream..) i
> m
> >>>> getting many errors.
> >>>> For example at this code for swf8 everything goes fine
> >>>> <canvas debug="true" height="500" width="100%">
> >>>>    <attribute name="_conn"/>
> >>>>    <attribute name="s1"/>
> >>>>    <attribute name="s2"/>
> >>>>
> >>>>    <handler name="oninit">
> >>>>        // These lines begin broadcasting.
> >>>>        this._conn = new NetConnection(); // Create connection object.
> >>>>        this._conn.connect("rtmp://192.168.1.94/Red5SharedObject/
> >>>> <http://192.168.1.94/Red5SharedObject/>"); // Connect to server.
> >>>>        s1 = new NetStream(this._conn);   // Open stream within
> connection.
> >>>>        //s1.attachAudio(Microphone.get());   // Capture audio.
> >>>>        s1.attachVideo(Camera.get());       // Capture video.
> >>>>        s1.publish("todays_news");          // Begin broadcasting.
> >>>>
> >>>>        s2 = new NetStream(this._conn);
> >>>>        live._attachStream(s2); // Specify where to display video.
> >>>>        s2.play("todays_news"); // play() uses the same name as
> publish()
> >>>> above.
> >>>>                  this.s1.onStatus = function(info) {
> >>>>                Debug.write("simpleNetStream onStatus",info);
> >>>>            };
> >>>>            this.s1.onCuePoint = function(info) {
> >>>>                Debug.write("simpleNetStream onCuePoint",info);
> >>>>            };
> >>>>            this.s1.onPlayStatus = function(info) {
> >>>>                Debug.write("simpleNetStream onPlayStatus",info);
> >>>>            };
> >>>>            this.s1.onMetaData = function(info) {
> >>>>                Debug.write("simpleNetStream onMetaData",info);
> >>>>            };          </handler>
> >>>>          <simplelayout/>
> >>>>      <videoview id="live" width="150" height="150" type="rtmp" />
> >>>>       </canvas>
> >>>>
> >>>> But when i try the same operations with as3 way on swf10. Althought i
> have
> >>>> added lines below in order to add the flash classes to the application
> for
> >>>> as3, e.g last problem about this issue is an error, like : |Error:
> Call to a
> >>>> possibly undefined method NetStream...|
> >>>>
> >>>> <switch>
> >>>>            <when property="$as3">
> >>>>                <passthrough>
> >>>>                    import flash.net.*;
> >>>>                    import flash.events.*;
> >>>>                </passthrough>
> >>>>            </when>
> >>>> </switch>
> >>>>
> >>>>
> >>>> I am planning to try my applications just on swf10 env. But most of
> the
> >>>> time, it is a bit harder than swf8 to work without problem. Do you
> suggest
> >>>> swf10 development on openlaszlo platform for now.
> >>>>
> >>>> Best regards.
> >>>> --
> >>>> Cem SONMEZ
> >>>
> >>> --
> >>> Regards,
> >>> Max Carlson
> >>> OpenLaszlo.org
> >>>
> >>
> >>
> >>
> >> --
> >> Cem SONMEZ
> >>
> >
> >
> >
> > --
> > Cem SONMEZ
> >
>
>
>
> --
> Cem SONMEZ
>
>


-- 
Henry Minsky
Software Architect
[email protected]

Reply via email to