Skip to main content
calmchessplayer
Inspiring
Jun 29, 2009 10:40 PM UTC
Question

publish problem

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 is closed to new replies. Start a new post to keep the conversation going.

    4 replies

    Participant
    Jul 7, 2009 10:53 AM UTC

    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...

    Translate
    Jun 30, 2009 1:34 PM UTC

    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.

    Translate
    calmchessplayer
    Inspiring
    Jun 30, 2009 1:38 PM UTC

    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.

    Translate
    calmchessplayer
    Inspiring
    Jul 7, 2009 12:05 AM UTC

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


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

    Translate