[Laszlo-checkins] r13290 - openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9
bargull@openlaszlo.org
bargull at openlaszlo.org
Sat Mar 14 17:31:30 PDT 2009
Author: bargull
Date: 2009-03-14 17:31:26 -0700 (Sat, 14 Mar 2009)
New Revision: 13290
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/DojoExternalInterface.as
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzBrowserKernel.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzFontManager.as
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzLibrary.as
Log:
Change 20090312-bargull-Q2h by bargull at dell--p4--2-53 on 2009-03-12 14:41:57
in /home/Admin/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: clean-up for AS3 import statements - PART 2
New Features:
Bugs Fixed: LPP-7904 (SWF9: unnecessary imports) (partial)
Technical Reviewer: hminsky
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
DojoExternalInterfaceClass:
- added typing
LzBrowserKernel:
- added missing typing
- updated import statements
LzFontManager:
- added typing
LzLibrary:
- added missing typing
- updated import statements
Tests:
smokecheck (swf9)
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/DojoExternalInterface.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/DojoExternalInterface.as 2009-03-15 00:24:38 UTC (rev 13289)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/DojoExternalInterface.as 2009-03-15 00:31:26 UTC (rev 13290)
@@ -18,18 +18,18 @@
#passthrough (toplevel:true) {
import flash.external.ExternalInterface;
}#
- var available = null;
- var flashMethods = [];
- var numArgs = null;
- var argData = null;
- var resultData = null;
+ var available :Boolean = false;
+ var flashMethods :Object = {};
+ var numArgs :* = null;
+ var argData :Array = null;
+ var resultData :String = null;
// var installing = false;
- var _id;
-
- function DojoExternalInterfaceClass(id){
+ var _id:*;
+
+ function DojoExternalInterfaceClass(id:*){
// extract the dojo base path
//Debug.write('initialize', ExternalInterface.addCallback);
-
+
// see if we need to do an express install
/* var install = new ExpressInstall();
if(install.needsUpdate){
@@ -41,7 +41,7 @@
if (id == null) return;
this._id = id;
-
+
// register our callback functions
ExternalInterface.addCallback("startExec", this.startExec);
ExternalInterface.addCallback("setNumberArguments", this.setNumberArguments);
@@ -50,38 +50,38 @@
ExternalInterface.addCallback("getReturnLength", this.getReturnLength);
ExternalInterface.addCallback("chunkReturnData", this.chunkReturnData);
ExternalInterface.addCallback("endExec", this.endExec);
-
+
// set whether communication is available
this.available = ExternalInterface.available;
this.call("loaded");
}
-
- function addCallback(methodName, instance, method) {
+
+ function addCallback(methodName:String, instance:*, method:*) :Boolean {
//Debug.write('addCallback', methodName, instance, method);
// register DojoExternalInterface methodName with it's instance
this.flashMethods[methodName] = instance;
-
+
// tell JavaScript about DojoExternalInterface new method so we can create a proxy
//Debug.write('calling dojo.flash.comm.' + this._id + "._addExternalInterfaceCallback", methodName, this._id);
- /* bypass dojo
+ /* bypass dojo
var wrapperCall = function(args) {
//Debug.write('Called', instance, '.', methodName, 'with', args);
return instance[methodName].apply(instance, args);
}
ExternalInterface.addCallback("dojo.comm." + this._id + "." + methodName, wrapperCall);
- */
+ */
ExternalInterface.call("lz.embed.dojo.comm." + this._id + "._addExternalInterfaceCallback", methodName, this._id);
-
+
return true;
}
-
- function call(...args) {
- var methodName = args[0];
- var resultsCallback = args[1];
- var parameters = [];
- for(var i = 0; i < args.length; i++){
+ function call(...args) :void {
+ var methodName:String = args[0];
+ var resultsCallback:Function = args[1];
+
+ var parameters:Array = [];
+ for(var i:int = 0; i < args.length; i++){
if(i != 1){ // skip the callback
parameters.push(args[i]);
}
@@ -90,15 +90,15 @@
// we might have any number of optional arguments, so we have to
// pass them in dynamically; strip out the results callback
//Debug.write('Calling', parameters);
- var results = ExternalInterface.call.apply(null, parameters);
-
+ var results:* = ExternalInterface.call.apply(null, parameters);
+
// immediately give the results back, since ExternalInterface is
// synchronous
if(resultsCallback != null && typeof resultsCallback != "undefined"){
resultsCallback.call(null, results);
}
}
-
+
/**
Called by Flash to indicate to JavaScript that we are ready to have
our Flash functions called. Calling loaded()
@@ -106,107 +106,104 @@
Flash has finished loading and adding its callbacks, and can begin to
interact with the Flash file.
*/
- function loaded(){
+ function loaded() :void {
//Debug.write('loaded');
//if (this.installing) return;
this.call("lz.embed.dojo.loaded", null, this._id);
LzBrowserKernel.__jsready();
}
-
- function startExec(){
+
+ function startExec() :void {
//Debug.write('startExec');
this.numArgs = null;
this.argData = null;
this.resultData = null;
}
-
- function setNumberArguments(numArgs){
+
+ function setNumberArguments(numArgs:Number) :void {
//Debug.write('setNumberArguments', numArgs);
this.numArgs = numArgs;
this.argData = [];
}
-
- function chunkArgumentData(value, argIndex){
+
+ function chunkArgumentData(value:*, argIndex:int) :void {
//Debug.write('chunkArgumentData', value, argIndex);
//getURL("javascript:dojo.debug('FLASH: chunkArgumentData, value="+value+", argIndex="+argIndex+"')");
- var currentValue = this.argData[argIndex];
+ var currentValue:* = this.argData[argIndex];
if(currentValue == null || typeof currentValue == "undefined"){
this.argData[argIndex] = value;
- }else{
+ } else {
this.argData[argIndex] += value;
}
}
-
- function exec(methodName){
+
+ function exec(methodName:String) :void {
//Debug.write('exec', methodName);
// decode all of the arguments that were passed in
- for(var i = 0; i < this.argData.length; i++){
- this.argData[i] =
- this.decodeData(this.argData[i]);
+ for(var i:int = 0; i < this.argData.length; i++){
+ this.argData[i] = this.decodeData(this.argData[i]);
}
-
- var instance = this.flashMethods[methodName];
+
+ var instance:* = this.flashMethods[methodName];
//Debug.write('instance', instance, instance[methodName]);
- this.resultData = instance[methodName].apply(
- instance, this.argData) + '';
+ this.resultData = String(instance[methodName].apply(instance, this.argData));
//Debug.write('result', this.resultData);
// encode the result data
- this.resultData =
- this.encodeData(this.resultData);
+ this.resultData = this.encodeData(this.resultData);
//Debug.write('resultData', this.resultData);
-
+
//getURL("javascript:dojo.debug('FLASH: encoded result data="+this.resultData+"')");
}
-
- function getReturnLength(){
- if(this.resultData == null ||
+
+ function getReturnLength() :Number {
+ if(this.resultData == null ||
typeof this.resultData == "undefined"){
- return 0;
- }
- var segments = Math.ceil(this.resultData.length / 1024);
- //Debug.write('getReturnLength', typeof this.resultData, this.resultData.length, segments);
- return segments;
+ return 0;
+ }
+ var segments:Number = Math.ceil(this.resultData.length / 1024);
+ //Debug.write('getReturnLength', typeof this.resultData, this.resultData.length, segments);
+ return segments;
}
-
- function chunkReturnData(segment){
- var numSegments = this.getReturnLength();
- var startCut = segment * 1024;
- var endCut = segment * 1024 + 1024;
+
+ function chunkReturnData(segment:Number) :String {
+ var numSegments:Number = this.getReturnLength();
+ var startCut:Number = segment * 1024;
+ var endCut:Number = segment * 1024 + 1024;
if(segment == (numSegments - 1)){
endCut = segment * 1024 + this.resultData.length;
}
-
- var piece = this.resultData.substring(startCut, endCut);
-
+
+ var piece:String = this.resultData.substring(startCut, endCut);
+
//getURL("javascript:dojo.debug('FLASH: chunking return piece="+piece+"')");
-
+
return piece;
}
-
- function endExec(){
+
+ function endExec() :void {
}
-
- function decodeData(data){
+
+ function decodeData(data:String) :String{
// we have to use custom encodings for certain characters when passing
// them over; for example, passing a backslash over as //// from JavaScript
// to Flash doesn't work
data = this.replaceStr(data, "&custom_backslash;", "\\");
-
+
data = this.replaceStr(data, "\\\'", "\'");
data = this.replaceStr(data, "\\\"", "\"");
//Debug.write('decodeData', data);
-
+
return data;
}
-
- function encodeData(data){
+
+ function encodeData(data:String) :String {
//getURL("javascript:dojo.debug('inside flash, data before="+data+"')");
// double encode all entity values, or they will be mis-decoded
// by Flash when returned
data = this.replaceStr(data, "&", "&");
-
+
// certain XMLish characters break Flash's wire serialization for
// ExternalInterface; encode these into a custom encoding, rather than
// the standard entity encoding, because otherwise we won't be able to
@@ -214,7 +211,7 @@
// that are being used in the string itself
data = this.replaceStr(data, '<', '&custom_lt;');
data = this.replaceStr(data, '>', '&custom_gt;');
-
+
// encode control characters and JavaScript delimiters
data = this.replaceStr(data, "\n", "\\n");
data = this.replaceStr(data, "\r", "\\r");
@@ -226,17 +223,17 @@
//getURL("javascript:dojo.debug('inside flash, data after="+data+"')");
return data;
}
-
+
/**
Flash ActionScript has no String.replace method or support for
Regular Expressions! We roll our own very simple one.
*/
- function replaceStr(inputStr, replaceThis, withThis){
- var splitStr = inputStr.split(replaceThis)
+ function replaceStr(inputStr:String, replaceThis:String, withThis:String) :String {
+ var splitStr:Array = inputStr.split(replaceThis)
inputStr = splitStr.join(withThis)
return inputStr;
}
-
+
/*
function getDojoPath(){
var url = _root._url;
@@ -252,6 +249,6 @@
}
/* X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2001-2008 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2001-2009 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* X_LZ_COPYRIGHT_END ******************************************************/
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzBrowserKernel.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzBrowserKernel.lzs 2009-03-15 00:24:38 UTC (rev 13289)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzBrowserKernel.lzs 2009-03-15 00:31:26 UTC (rev 13290)
@@ -14,8 +14,10 @@
*/
class LzBrowserKernel {
-#passthrough (toplevel:true) {
- import flash.net.*;
+#passthrough (toplevel:true) {
+ import flash.net.navigateToURL;
+ import flash.net.SharedObject;
+ import flash.net.URLRequest;
import flash.system.Capabilities;
import flash.system.Security;
import flash.system.System;
@@ -29,7 +31,7 @@
* @param String target: Optionally specifies a named frame to display the contents of the URL.
* The document specified by URL is loaded into the current browser frame by default.
*/
-static function loadURL ( url, target=null, features=null ){
+static function loadURL (url:String, target:String=null, features:String=null) :void {
navigateToURL(new URLRequest(url), target);
}
@@ -43,7 +45,7 @@
* By default, the javascript specified in 'js' is executed in the current
* browser frame .
*/
-static function loadJS ( js, target='_self'){
+static function loadJS (js:String, target:String='_self') :void {
navigateToURL(new URLRequest('javascript:' + js + ';void(0);'), target);
}
@@ -53,16 +55,16 @@
* @keywords flashspecific
*/
static function callJS (...args) :* {
- var js = args[0];// String js: Browser javascript to execute
- var callback = args[1];
+ var js:String = args[0];// String js: Browser javascript to execute
+ var callback:* = args[1];
//DojoExternalInterface.call.apply(null, args);
if (LzBrowserKernel.jsready != true) {
LzBrowserKernel.__jslocked = true;
}
if (LzBrowserKernel.__jslocked == true) {
if (callback != false) {
- var o = [];
- for (var i = 0; i < args.length; i++) {
+ var o:Array = [];
+ for (var i:int = 0; i < args.length; i++) {
o[i] = args[i];
}
LzBrowserKernel.__jscallq.push(o);
@@ -86,23 +88,23 @@
}
/** @access private */
-static var jsready = false;
+static var jsready :Boolean = false;
/** @access private */
-static var __jscallback = null;
+static var __jscallback :* = null;
/** @access private */
-static var __jslocked = false;
+static var __jslocked :Boolean = false;
/** @access private */
-static var __jscallq = [];
+static var __jscallq :Array = [];
// called from DojoExternalInterface
/** @access private */
-static function __jsready () {
+static function __jsready () :void {
//Debug.write('jsready', LzBrowserKernel.__jscallq);
- LzBrowserKernel.jsready=true;
+ LzBrowserKernel.jsready = true;
LzBrowserKernel._dequeueJS();
}
-static function callJSReturn (a) {
+static function callJSReturn (a:*) :void {
if (LzBrowserKernel.__jscallback) {
//Debug.write('callJSReturn', a, LzBrowserKernel.__jscallback);
LzBrowserKernel.__jscallback.call(null, a);
@@ -111,12 +113,12 @@
}
/** @access private */
-static function _dequeueJS () {
+static function _dequeueJS () :void {
//Debug.write('_dequeueJS');
LzBrowserKernel.__jslocked = false;
LzBrowserKernel.__jscallback = null;
if (LzBrowserKernel.__jscallq.length > 0) {
- var a = LzBrowserKernel.__jscallq.pop();
+ var a:Array = LzBrowserKernel.__jscallq.pop();
//Debug.write('calling with args q', a);
LzBrowserKernel.callJS.apply(LzBrowserKernel, a);
}
@@ -126,24 +128,24 @@
* Sets the browser history to a specified offset.
* @access private
*/
-static function setHistory(n) {
+static function setHistory(n:*) :void {
//Debug.write('__setHistory', n);
LzBrowserKernel.callJS('lz.embed.history.set', null, n);
}
-static function getPersistedObject(n) {
+static function getPersistedObject(n:String) :SharedObject {
try {
return SharedObject.getLocal(n);
- } catch (err) {
- return null;
+ } catch (err:Error) {
}
+ return null;
}
/**
* Invoked by browser JavaScript to call a method
* @access private
*/
-static function callMethod(js) {
+static function callMethod(js:*) :* {
return lz.Utils.safeEval(js);
}
@@ -175,7 +177,7 @@
* @return String : the URL the swf was loaded from
*
*/
-static function getLoadURL () {
+static function getLoadURL () :String {
return LFCApplication.stage.loaderInfo.loaderURL;
}
@@ -188,7 +190,7 @@
* @return String: The value for a key that appears in the request to the lps
* server
*/
-static function getInitArg (name) {
+static function getInitArg (name:String) :* {
var parameters = LFCApplication.stage.loaderInfo.parameters;
if (parameters == null)
return null;
@@ -201,7 +203,7 @@
*
* @return String: The id the app was started with
*/
-static function getAppID() {
+static function getAppID() :* {
return LzBrowserKernel.getInitArg('id');
}
@@ -210,7 +212,7 @@
* @keywords flashspecific private
* @param Boolean truefalse: boolean value - true for on, false for off.
*/
-static function showMenu (truefalse) {
+static function showMenu (truefalse:Boolean) :void {
LFCApplication.stage.showDefaultContextMenu = truefalse;
}
@@ -220,7 +222,7 @@
*
* @param String str: String to set the system clipboard to
*/
-static function setClipboard (str){
+static function setClipboard (str:String) :void {
System.setClipboard(str);
}
@@ -230,7 +232,7 @@
*
* @return: True if a screen reader is active and the Flash player is focused
*/
-static function isAAActive ():Boolean{
+static function isAAActive () :Boolean {
return Capabilities.hasAccessibility && Accessibility.active;
}
@@ -239,7 +241,7 @@
* @keywords flashspecific
* @access private
*/
-static function updateAccessibility () {
+static function updateAccessibility () :void {
Accessibility.updateProperties();
}
@@ -248,7 +250,7 @@
* @keywords flashspecific
* @access private
*/
-static function loadProxyPolicy (url) {
+static function loadProxyPolicy (url:String) :void {
Security.loadPolicyFile(url);
}
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzFontManager.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzFontManager.as 2009-03-15 00:24:38 UTC (rev 13289)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzFontManager.as 2009-03-15 00:31:26 UTC (rev 13290)
@@ -1,11 +1,11 @@
/**
* LzFontManager.as
*
- * @copyright Copyright 2001-2008 Laszlo Systems, Inc. All Rights Reserved.
+ * @copyright Copyright 2001-2009 Laszlo Systems, Inc. All Rights Reserved.
* Use is subject to license terms.
*
* @topic Kernel
- * @subtopic AS2
+ * @subtopic swf9
*/
/** Manages the font dictionary.
@@ -23,7 +23,7 @@
import flash.text.Font;
}#
- static var fonts = { };
+ static var fonts :Object = {};
/** @devnote currently doesn't support sending variables...
*/
@@ -40,24 +40,24 @@
* @param Object bi: The bold italic style of the font.
* @access private
*/
- public static function addFont( fontname , n , b , i , bi ){
+ public static function addFont (fontname:String, n:Object, b:Object, i:Object, bi:Object) :void {
- var ff = new Object;
+ var ff:Object = new Object;
ff.name = fontname;
-
+
if ( n ){
- new LzFont( ff , n, "plain");
+ new LzFont( ff, n, "plain");
}
if ( b ) {
- new LzFont( ff , b , "bold");
+ new LzFont( ff, b, "bold");
}
if ( i ){
- new LzFont( ff , i, "italic" );
+ new LzFont( ff, i, "italic" );
}
if ( bi ){
- new LzFont( ff , bi , "bolditalic");
+ new LzFont( ff, bi, "bolditalic");
}
-
+
LzFontManager.fonts[ fontname ] = ff;
}
@@ -69,26 +69,26 @@
* @return any: An <class>LzFont</class> object, or undefined if not found
*
*/
- public static function getFont ( fontname , style ){
+ public static function getFont (fontname:String, style:String) :LzFont {
if ( style == null ) { style = "plain" }
- var fns = fontname.split(',');
+ var fns:Array = fontname.split(',');
if (fns.length > 0) {
- for (var i = 0; i < fns.length; i++) {
+ for (var i:int = 0; i < fns.length; i++) {
fontname = fns[i];
- var tfn = LzFontManager.fonts[ fontname ];
+ var tfn:LzFont = LzFontManager.fonts[ fontname ];
if (tfn) {
- return tfn[ style ];
- }
+ return tfn[ style ];
+ }
}
return null;
- } else {
- var tfn = LzFontManager.fonts[ fontname ];
+ } else {
+ var tfn:LzFont = LzFontManager.fonts[ fontname ];
if (tfn) {
- return tfn[ style ];
+ return tfn[ style ];
} else {
return null;
}
- }
+ }
}
/**
@@ -100,62 +100,61 @@
* @return LzFont: The new <class>LzFont</class>.
* @access private
*/
- public static function addStyle ( f , s ){
+ public static function addStyle (f:LzFont, s:String) :LzFont {
//not pretty -- especially if the complexity of styles grows -- but works
//for now
if ( f.style == "bolditalic") {
return f;
} else if ( s == "bold" ){
- if ( f.style =="italic" ){
+ if ( f.style == "italic" ){
return f.fontobject.bolditalic;
} else {
return f.fontobject.bold;
}
} else if ( s == "italic" ) {
- if ( f.style =="bold" ){
+ if ( f.style == "bold" ){
return f.fontobject.bolditalic;
} else {
return f.fontobject.italic;
}
- } else if ( s== "bolditalic" ){
+ } else if ( s == "bolditalic" ){
return f.fontobject.bolditalic;
}
// no change
return f;
-
}
// Map {font-name -> true} of client font names. convertFontList
// initializes this.
- static var __clientFontNames;
+ static var __clientFontNames :Object;
// A map from CSS generic font family names such as 'sans-serif' to
// Flash names such as '_sans'.
- static var __fontFamilyMap = {'monospace': '_typewriter', 'serif': '_serif', 'sans-serif': '_sans'};
+ static var __fontFamilyMap :Object = {'monospace': '_typewriter', 'serif': '_serif', 'sans-serif': '_sans'};
// A hashset of device font family names.
- static var __genericClientFontFamilyNames = {'_typewriter': true, '_serif': true, '_sans': true};
+ static var __genericClientFontFamilyNames :Object = {'_typewriter': true, '_serif': true, '_sans': true};
- static public var __fontnameCacheMap = {};
+ static public var __fontnameCacheMap :Object = {};
- static var __debugWarnedFonts = {};
+ static var __debugWarnedFonts :Object = {};
/**
* Convert an LZX font name to one that the Flash runtime can render.
* This involves removing whitespace, and changing CSS generic font family
* names such as 'sans-serif' to Flash names such as '_sans'.
*/
- public static function __convertFontName (name) {
+ public static function __convertFontName (name:String) :String {
// FIXME [2004-11-29 ows]: trim other types of whitespace too
while (name.charAt(0) == ' ') name = name.slice(1);
while (name.charAt(name.length - 1) == ' ') name = name.slice(0, name.length-1);
- var map = LzFontManager.__fontFamilyMap;
+ var map:Object = LzFontManager.__fontFamilyMap;
// Warn about uses of Flash-specific names. These won't work on
// other runtimes.
if ($debug) {
- for (var i in map)
+ for (var i:String in map)
if (name == map[i] && !LzFontManager.__debugWarnedFonts[name]) {
LzFontManager.__debugWarnedFonts[name] = true;
Debug.warn("Undefined font %w. Use %w instead", name, i);
@@ -171,19 +170,19 @@
* none of the names can be rendered. str is a comma-separated list
* of font names.
*/
- public static function __findMatchingFont (str) {
+ public static function __findMatchingFont (str:String) :String {
if (LzFontManager.__clientFontNames == null) {
LzFontManager.__clientFontNames = {};
- var fonts = Font.enumerateFonts(true);
- for (var i in fonts) {
- LzFontManager.__clientFontNames[fonts[i].fontName] = true;
- }
+ var fonts:Array = Font.enumerateFonts(true);
+ for (var i:int = 0; i < fonts.length; ++i) {
+ LzFontManager.__clientFontNames[fonts[i].fontName] = true;
+ }
}
-
- var name = null;
+
+ var name:String = null;
if (str.indexOf(',') >= 0) {
- var names = str.split(',');
- for (var i = 0; i < names.length; i++) {
+ var names:Array = str.split(',');
+ for (var i:int = 0; i < names.length; i++) {
name = names[i] = LzFontManager.__convertFontName(names[i]);
if (LzFontManager.__clientFontNames[name] || LzFontManager.__genericClientFontFamilyNames[name]) {
return name;
@@ -204,7 +203,7 @@
/**
* @access private
*/
- public static function __fontExists (str) {
+ public static function __fontExists (str:String) :Boolean {
return (LzFontManager.fonts[ str ] != null ||
LzFontManager.__clientFontNames[str] != null ||
LzFontManager.__genericClientFontFamilyNames[str] != null ||
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzLibrary.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzLibrary.as 2009-03-15 00:24:38 UTC (rev 13289)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzLibrary.as 2009-03-15 00:31:26 UTC (rev 13290)
@@ -14,34 +14,25 @@
*/
class LzLibrary extends LzNode {
- #passthrough (toplevel:true) {
- import flash.display.*;
- import flash.events.*;
- import flash.text.*;
- import flash.ui.*;
- import flash.geom.*;
- import flash.utils.*;
- import mx.controls.Button;
- import flash.net.*;
- import flash.utils.*;
- import flash.system.*;
-
-
+ #passthrough (toplevel:true) {
+ import flash.display.Loader;
+ import flash.display.LoaderInfo;
+ import flash.events.Event;
+ import flash.net.URLRequest;
+ import flash.net.URLRequestMethod;
}#
/** @access private
* @modifiers override
*/
-static var tagname = 'import';
+static var tagname :String = 'import';
/** @access private */
-static var attributes = new LzInheritedHash(LzNode.attributes);
+static var attributes :Object = new LzInheritedHash(LzNode.attributes);
/** @access private */
-var loaded = false;
+var loaded :Boolean = false;
/** @access private */
-var loading = false;
-/** @access private */
-var sprite = null;
+var loading :Boolean = false;
/**
* A reference to a target file whose content is treated as a
@@ -51,7 +42,7 @@
* @type string
* @access public
*/
-var href;
+var href:String;
/**
* When set to 'defer', the library will not be loaded until its
@@ -63,12 +54,12 @@
* @lzxdefault "late"
* @access public
*/
-var stage = "late";//"late|defer"
+var stage :String = "late";//"late|defer"
/**
* @access private
*/
-function $lzc$set_stage(val) {
+function $lzc$set_stage(val:String) :void {
this.stage = val;
}
@@ -80,19 +71,19 @@
* @lzxtype event
* @access public
*/
-var onload = LzDeclaredEvent;
+var onload :LzDeclaredEventClass = LzDeclaredEvent;
/** @access private
* @modifiers override
*/
-function LzLibrary ( parent:LzNode? = null , attrs:Object? = null , children:Array? = null, instcall:Boolean = false) {
- super(parent,attrs,children,instcall);
+function LzLibrary (parent:LzNode? = null, attrs:Object? = null, children:Array? = null, instcall:Boolean = false) {
+ super(parent, attrs, children, instcall);
}
/**
* @access private
*/
-function $lzc$set_href(val) {
+function $lzc$set_href(val:String) :void {
this.href = val;
}
@@ -119,20 +110,16 @@
* @access private
*/
override function destroy () {
- if (this.sprite) {
- this.sprite.destroy();
- this.sprite = null;
- }
super.destroy();
}
/** @access private */
-static var libraries = {};
+static var libraries :Object = {};
/**
* @access private
*/
-static function findLibrary (libname){
+static function findLibrary (libname:String) :LzLibrary {
return LzLibrary.libraries[libname];
}
@@ -151,7 +138,7 @@
*
* @access public
*/
-function load () {
+function load () :void {
if (this.loading || this.loaded) {
return;
}
@@ -172,14 +159,14 @@
this.libapp = library;
}
-var libapp;
+var libapp:Object;
/**
* Called by LzLibraryCleanup when this library has finished loading.
*
* @access private
*/
-function loadfinished (){
+function loadfinished () :void {
this.loading = false;
if (this.onload.ready) this.onload.sendEvent(true);
}
@@ -197,20 +184,20 @@
* Callback for runtime loaded libraries
* @access private
*/
-static function __LZsnippetLoaded (url){
+static function __LZsnippetLoaded (url:String) :void {
// find the lib with this url
// Strip out query string
url = LzLibrary.stripQueryString(url);
- var lib = null;
- var libs = LzLibrary.libraries;
- for (var l in libs ) {
+ var lib:LzLibrary = null;
+ var libs:Object = LzLibrary.libraries;
+ for (var l:String in libs) {
var libhref = LzLibrary.stripQueryString(libs[l].href);
if (libhref == url) {
lib = libs[l];
break;
}
}
-
+
if (lib == null) {
Debug.error("could not find library with href", url);
} else {
More information about the Laszlo-checkins
mailing list