emincote
asked on
How do I convert this AS2 function to AS3 which receives data from a stream.
Hi Experts,
I have been using an Adobe example that you can find here.
http://www.adobe.com/devnet/flashmediaserver/articles/metadata_video_streaming.html
I have made it work really well. I now want to use the Openvdeoplayer (http://openvideoplayer.sourceforge.net/) and code in as3. I am trying to convert the function that receives the text and shows it in a box under the player. The original as2 function was the following.
my_ns.onDataEvent = function(str) {
_root.display_txt.text = str;
};
I have written the following version
public function onDataEvent(str:String):vo id {
display_txt.text = "test " + str;
}
But I can see that it is not listening to the stream. I thought that I should be using 'addEventListener', but I am getting nowhere. I am using the Akamai example CS4sampleLive and I have attached both files. They compile fine but into a nice swf but they don't pick up the data. I am still using the orignial code in the main.asc on my fms 3.5 server and the insert.swf.
I hope that it is something simple that I am missing.
Thanks
CS4sampleLive.as
CS4sampleLive.fla
I have been using an Adobe example that you can find here.
http://www.adobe.com/devnet/flashmediaserver/articles/metadata_video_streaming.html
I have made it work really well. I now want to use the Openvdeoplayer (http://openvideoplayer.sourceforge.net/) and code in as3. I am trying to convert the function that receives the text and shows it in a box under the player. The original as2 function was the following.
my_ns.onDataEvent = function(str) {
_root.display_txt.text = str;
};
I have written the following version
public function onDataEvent(str:String):vo
display_txt.text = "test " + str;
}
But I can see that it is not listening to the stream. I thought that I should be using 'addEventListener', but I am getting nowhere. I am using the Akamai example CS4sampleLive and I have attached both files. They compile fine but into a nice swf but they don't pick up the data. I am still using the orignial code in the main.asc on my fms 3.5 server and the insert.swf.
I hope that it is something simple that I am missing.
Thanks
CS4sampleLive.as
CS4sampleLive.fla
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
Many thanks for this, I have added it within the last public function and it compiles correctly. I think I understand what is going on, but will have to wait a little until I can test all the way through as I am out of the office at the moment.
Kind regards
Emincote
Many thanks for this, I have added it within the last public function and it compiles correctly. I think I understand what is going on, but will have to wait a little until I can test all the way through as I am out of the office at the moment.
Kind regards
Emincote
ASKER
HI,
I am happy to accept your solution and close this, but for interests sake I dug right down into the OPV code and in the end used OvpEvent.NETSTREAM_TEXTDAT A which had a data type of data in my function. So with great joy it all worked.
Hope this helps others,
Emincote
I am happy to accept your solution and close this, but for interests sake I dug right down into the OPV code and in the end used OvpEvent.NETSTREAM_TEXTDAT
Hope this helps others,
Emincote
display_txt.addEventListen
display_txt.text = "test " + str;
}
However I don't believe you can pass variables to an event listener so you would have to get str from elsewhere.