actionscript 3 - Flash error undefined property stage -


i created added_to_stage eventlistener in class flash giving error ... \rtmp_test.as, line 28, column 8 1120: access of undefined property stage.

public function rtmp_test (streamid:string, videourl:string):void {     sid = streamid;     vurl = videourl;      if (stage)     {         init_rtmp();     }     else     {         this.addeventlistener(event.added_to_stage, onaddedtostage);     } }  private function onaddedtostage():void {     this.removeeventlistener(event.added_to_stage, onaddedtostage);     init_rtmp(); } 

edit: when put "extends movieclip" i'm getting error.

here's init_rtmp function:

private function init_rtmp():void {     /*     streamid  = "mp4:myvideo";     videourl = "rtmp://fms.xstream.dk/*********.mp4";     */      vid = new video(); //typo! "vid = new video();"      nc = new netconnection();     nc.addeventlistener(netstatusevent.net_status, onconnectionstatus);     nc.addeventlistener(asyncerrorevent.async_error, asyncerrorhandler);     nc.client = { onbwdone: function():void{} };     nc.connect(vurl);            } 

ok, put "extends movieclip" class , corrected mistakes. i'm not getting errors.


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -