Skip to main content
calmchessplayer
Inspiring
June 29, 2009
Question

publish problem

  • June 29, 2009
  • 2 replies
  • 984 views

I have a netstream publish problem on the client side...the first time I call a custom event function which connects the netstream everything works fine but when i call the function a second time it dies silently ...however if i use a button click instead of a custom event function then the netstream connects properly here is the problem code

private  function setStream(e:SendStreamEvent):void {
               trace("rePubID = "+rePublishID1);
               if (rePublishID1==0 ) {
                    trace("publish success"+e.num1[0]);
                    stream0.publish(e.num1[0],"live");
                    dispatchEvent(new DefStreamEvent("TYPE_DEFSTR",false,false,e.num1[0]));
                    //con1.removeEventListener("TYPE_STREAMNUM",setStream);
               } else if (rePublishID1==1 ) {
                    
                    stream0.publish("private","live");
                    dispatchEvent(new DefStreamEvent("TYPE_DEFSTR",false,false,"private"));
               //pub = new NewPublisher(nc2,con1);
               } else if (rePublishID1==2) {
                    stream0.publish(e.num1[0],"live");
                    dispatchEvent(new DefStreamEvent("TYPE_DEFSTR",false,false,e.num1[0]));
               }
    This topic has been closed for replies.

    2 replies

    Participant
    July 7, 2009

    Sorry because i'm out of subject, but i need a information please. How can restrict the numbers of viewers who watch something live? And the another question should be , how can I do to no one see my IP without me? Please answer me...

    June 30, 2009

    I don't see anything wrong with the code you posted.

    You mentioned that it dies silently when invoked by script. When this happens, are you certain that the value of e is a SendStreamEvent? If the trace statement at the top of the function isn't being executed, that would suggest that the error is due to a type mismatch for the value of e.

    calmchessplayer
    Inspiring
    June 30, 2009

    the traces work flawlessly as well as the dispatch the stream0.publish is the only thing that doesn't work don't worry about it though i've hired a programmer to look into this matter he has solved a similar problem for me in the past.

    calmchessplayer
    Inspiring
    July 7, 2009

    solved......had to specify the stream through the eventlistner likes so....


    e.currentTarget.parent.stream.stream0.Publish("stream0");