forwarding to laszlo-user, and dev in case anyone else has an idea
---------- Forwarded message ----------
From: cem sonmez <[email protected]>
Date: Mon, Nov 23, 2009 at 4:03 PM
Subject: Re: [Laszlo-dev] errors while swf10 compilation during
NetConnection operations
To: Henry Minsky <[email protected]>
I did small changes and When i handle the netconnection status. I see
the application has connected to the flash server successfully. But
another error message is :
ArgumentError: Error #2126: NetConnection object must be connected.
And the error occurs with the "s1 = new NetStream(this._conn);" line.
I have no idea where i m wrong at. Openlaszlo platform version and
code are the same with yours but the behaviour is different. Isn't
this so strange. I m getting these like errors for a couple of days.
And i donT want to be obliged to working on swf8 bec. of. these
errors.
Thanks.
<canvas debug="true" height="500" width="100%">
<attribute name="_conn"/>
<attribute name="s1"/>
<attribute name="s2"/>
<switch>
<when property="$as3">
<passthrough>
import flash.net.*;
import flash.events.*;
import flash.media.Camera;
import flash.media.Video;
import flash.media.Microphone;
</passthrough>
</when>
</switch>
<handler name="oninit">
NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0;
// These lines begin broadcasting.
this._conn = new NetConnection(); // Create connection object.
this._conn.connect("rtmp://192.168.1.4/Red5SharedObject/"); //
Connect to server.
this._conn.addEventListener(NetStatusEvent.NET_STATUS,
netStatusHandler);
s1 = new NetStream(this._conn); // Open stream within connection.
//s1.attachAudio(Microphone.get()); // Capture audio.
s1.attachVideo(Camera.getCamera()); // 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>
<method name="netStatusHandler" args="event">
switch (event.info.code) {
case "NetConnection.Connect.Success":
Debug.write("The connection attempt succeeded.");
break;
case "NetConnection.Connect.Failed":
Debug.write("The connection attempt failed.");
break;
}
</method>
<simplelayout/>
<videoview id="live" width="150" height="150" type="rtmp" />
</canvas>
2009/11/23 cem sonmez <[email protected]>
>
> I have downloaded the latest nightly build of openlaszlo from [1]. And i m
using the flash debugger plugin as well. When i try the code below in swf10.
The error message is :
>
> Error #2044: Unhadled NetStatusEvent:. level=error,
code=NetConnection.Connect.Failed ...
>
> [1] - http://download.openlaszlo.org/nightly/trunk/15210
>
>
> 2009/11/23 Henry Minsky <[email protected]>
>>
>> This compiles for me in swf10 without error in trunk
>>
>> <canvas debug="true" height="500" width="100%">
>> <attribute name="_conn"/>
>> <attribute name="s1"/>
>> <attribute name="s2"/>
>>
>> <switch>
>> <when property="$as3">
>> <passthrough>
>> import flash.net.*;
>> import flash.events.*;
>> import flash.media.Camera;
>> import flash.media.Video;
>> import flash.media.Microphone;
>>
>> </passthrough>
>> </when>
>> </switch>
>>
>> <handler name="oninit">
>> // These lines begin broadcasting.
>> 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.
>> //s1.attachAudio(Microphone.get()); // Capture audio.
>> s1.attachVideo(Camera.getCamera()); // 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>
>>
>>
>>
>>
>>
>>
>> On Mon, Nov 23, 2009 at 7:05 AM, cem sonmez <[email protected]> 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/"); //
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
>>
>>
>>
>> --
>> Henry Minsky
>> Software Architect
>> [email protected]
>>
>>
>
>
>
> --
> Cem SONMEZ
--
Cem SONMEZ
--
Henry Minsky
Software Architect
[email protected]