Skip to main content
Participant
October 10, 2007
Question

MP3 streaming using AS3

  • October 10, 2007
  • 1 reply
  • 690 views
hi
i want to stream mp3 file located at FMS. The problem is how to do this in AS3 as i m using flash cs3.
i done bit but i m getting the error;

Mine code is as follow:

import flash.net.*;


var conn = new NetConnection();
conn.connect("rtmp://192.168.0.106/wss");
var myStream = new NetStream(conn);
myStream.play("mp3:rec");


The Error is:

ArgumentError: Error #2126: NetConnection object must be connected.
at flash.net::NetStream/flash.net:NetStream::construct()
at flash.net::NetStream$iinit()
at temp_fla::MainTimeline/temp_fla::frame1()
Error #2044: Unhandled NetStatusEvent:. level=error, code=NetConnection.Connect.Failed
at temp_fla::MainTimeline/temp_fla::frame1()

Text Text
    This topic has been closed for replies.

    1 reply

    Participant
    November 4, 2008
    NetConnection has not been established. You need to addEventListener.

    nc = new NetConnection();
    nc.addEventListener(NetStatusEvent.NET_STATUS, function(e:NetStatusEvent) {
    if (e.info.code == 'NetConnection.Connect.Success') {
    ns = new NetStream(nc);
    ns.play("songs");