sfUI.as
上传用户:lctyggxszx
上传日期:2022-06-30
资源大小:280k
文件大小:1k
- if (_global.$sfUIClass == undefined) {
- _global.$sfUIClass = function() {};
-
- var p = _global.$sfUIClass.prototype;
-
- // this doesn't work yet..
- // the idea is using flash to create native windows components, like
- // a status bar, file menu, buttons, etc etc...
- p.addButton = function(txt, name, x, y, callback, scope){
- // generate a unique id - this is probably better handled
- // with a class to create ids, but for now
- // we'll try the quick and dirty approach - the chances
- // of getting duplicate values aren't that great.
- var tmp = Math.random().toString().split('.')[1];
-
- // send the command to the wrapper with the library, function, args, and callback id
- fscommand("sfUI.addButton", txt + "," + name + "," + x + "," + y + "|" + tmp);
-
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) {
- scope = this;
- }
- _global.$SharpFlash.CallBackList[tmp] = new Object();
- _global.$SharpFlash.CallBackList[tmp].callback = callback;
- _global.$SharpFlash.CallBackList[tmp].scope = scope;
- }
- }
-
- delete p;
-
- sfUI = new _global.$sfUIClass();
- }