Hi folks…
A function I wrote that is supposed to respond to a mouse click event…is not being reached. I am not sure why. The following is the code exercpt:
public function Stuff()
{
txtAreaMain = new TextArea;
var rtmpNow = "rtmp://compName/Toy";
nc = new NetConnection ;
nc.connect(rtmpNow);
nc.addEventListener(NetStatusEvent.NET_STATUS,doSharedObject);
trace("1");
btnSubmit=new Button();
trace("2");
btnSubmit.addEventListener (MouseEvent.CLICK,sendMsg);
trace("3");
}
private function sendMsg(e:MouseEvent):void
{
trace("function sendMsg() ");
text_so.setProperty("msg",chatInput.text);
txtAreaMain.appendText(chatInput.text + "
");
}
I placed the button in the FLA file directly and named it ‘btnSubmit’. The sendMsg function is within the ‘Stuff’ class and the instantiation of the button object is also done within the ‘Stuff’ function. The doSharedObject function is called without a problem. I wrote the 3 trace statements just to confirm if the compiler traverses those lines…, and they are indeed printed to the output, so I don’t know why the ‘sendMsg’ function is not called. Hope someone can advise me. Thanks.