本人菜鸟。。用外部as写的按钮命令等各种出问题。。求大神帮助该怎么写。。
package {
import flash.display.Sprite;
import flash.events.ProgressEvent;
import flash.net.Socket;
import flash.events.*;
public class SocketExample extends Sprite {
private var socket: Socket;
public function SocketExample() {
socket = new Socket();
// Listen for when data is received from the socket server
socket.addEventListener(Event.CONNECT, onConnect);
socket.connect("192.168.1.2", 7999);
}
private var btn:Button;
private function ButtonOnload():void {
btn=new Button;
home.addEventListener(MouseEvent.CLICK, home00);
btnopen.addEventListerner(MouseEvent.CLICK,open00);
this.addChild(btn);
}
private function home00(event: MouseEvent): void{
gotoAndStop("frame1");
}
private function open00(event:Event):void{
socket.writeUTFBytes("hello world")
}
}
}
代码如上,就是在外部链接写两个按钮命令分别是按钮1,点击播放帧"frame1",按钮2点击发送数据"hello word"给局域网的192.168.1.2的7999端口。
求解该咋办。。本人菜鸟。。
错误如下。
Line 15, Column 191046: Type was not found or was not a compile-time constant: Button.
Line 12, Column 431120: Access of undefined property onConnect.
Line 17, Column 111180: Call to a possibly undefined method Button.
Line 19, Column 41120: Access of undefined property btnopen.
Line 23, Column 91061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display:DisplayObject.
package {
import flash.display.Sprite;
import flash.events.ProgressEvent;
import flash.net.Socket;
import flash.events.*;
public class SocketExample extends Sprite {
private var socket: Socket;
public function SocketExample() {
socket = new Socket();
// Listen for when data is received from the socket server
socket.addEventListener(Event.CONNECT, onConnect);
socket.connect("192.168.1.2", 7999);
}
private var btn:Button;
private function ButtonOnload():void {
btn=new Button;
home.addEventListener(MouseEvent.CLICK, home00);
btnopen.addEventListerner(MouseEvent.CLICK,open00);
this.addChild(btn);
}
private function home00(event: MouseEvent): void{
gotoAndStop("frame1");
}
private function open00(event:Event):void{
socket.writeUTFBytes("hello world")
}
}
}
代码如上,就是在外部链接写两个按钮命令分别是按钮1,点击播放帧"frame1",按钮2点击发送数据"hello word"给局域网的192.168.1.2的7999端口。
求解该咋办。。本人菜鸟。。
错误如下。
Line 15, Column 191046: Type was not found or was not a compile-time constant: Button.
Line 12, Column 431120: Access of undefined property onConnect.
Line 17, Column 111180: Call to a possibly undefined method Button.
Line 19, Column 41120: Access of undefined property btnopen.
Line 23, Column 91061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display:DisplayObject.