Audiovox P965 Datasheet Page 248

  • Download
  • Add to my manuals
  • Print
  • Page
    / 280
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 247
API ActionScript 3 class
245
}
}
Example 1
// Short example that outputs wireless registration-table every second
import ApiSocket;
import ApiEvent;
var sock:ApiSocket;
var myTimer:Timer = new Timer(1000);
myButton.addEventListener(MouseEvent.CLICK, testAPI);
myTimer.addEventListener(TimerEvent.TIMER, timedFunction);
function testAPI(evt:MouseEvent):void {
sock = new ApiSocket("172.17.1.1", 8728);
sock.addEventListener(ApiEvent.RECEIVED, receive);
sock.addEventListener(Event.CONNECT, connected);
sock.addEventListener(ApiEvent.LOGIN, loggedin);
}
function connected(evt:Event) {
trace("Connected. Logging in.");
sock.login("admin","password");
}
function loggedin(evt:ApiEvent) {
// result can be done, trap or fatal
if (evt.result == 'done') {
myTimer.start();
}
}
function timedFunction(e:TimerEvent) {
sock.sendRequest("/interface/wireless/registration-table/print", ".tag=mytag");
}
function receive(evt:ApiEvent) {
trace("Got Event with tag " + evt.tag + " result: " + evt.result);
if (evt.tag == 'mytag' && evt.result == 'done') {
trace("Got rows: " + evt.data.length);
for (var i:int = 0; i < evt.data.length; ++i) {
Page view 247
1 2 ... 243 244 245 246 247 248 249 250 251 252 253 ... 279 280

Comments to this Manuals

No comments