Author: max
Date: 2007-09-19 15:32:07 -0700 (Wed, 19 Sep 2007)
New Revision: 6531

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/services/platform/swf/LzHistory.as
   openlaszlo/trunk/lps/includes/source/embednew.js
   openlaszlo/trunk/lps/includes/source/lzhistory.js
Log:
Change 20070919-maxcarlson-Z by [EMAIL PROTECTED] on 2007-09-19 09:23:44 PDT
    in /Users/maxcarlson/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Fix history for swf7

New Features:

Bugs Fixed: LPP-4746 - Javascript errors when using the history mechanism in 
swf7

Technical Reviewer: promanik
QA Reviewer: ben
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details: LzHistory.as - Fix braino - use correct callJS() API.

embednew.js - Add 'loaded' property that is set to true when applications are 
loaded.  Use loaded property to decide when apps are ready to receive events.

lzhistory.js - Add explicit scope for all methods, properties in 
Lz.history.set()
    

Tests: http://localhost:8080/trunk/test/history/history.lzx?lzr=swf7 no longer 
warns



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/services/platform/swf/LzHistory.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/services/platform/swf/LzHistory.as 
2007-09-19 21:58:57 UTC (rev 6530)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/services/platform/swf/LzHistory.as 
2007-09-19 22:32:07 UTC (rev 6531)
@@ -37,7 +37,7 @@
 LzHistory.__setHistory = function(s) {
     //Debug.write('__setHistory', s);
     LzBrowser._jsreset();
-    LzBrowser.callJS('Lz.history.set("' + s + '")', false);
+    LzBrowser.callJS('Lz.history.set', false, s);
     this.__lzloading = true;
 }
 

Modified: openlaszlo/trunk/lps/includes/source/embednew.js
===================================================================
--- openlaszlo/trunk/lps/includes/source/embednew.js    2007-09-19 21:58:57 UTC 
(rev 6530)
+++ openlaszlo/trunk/lps/includes/source/embednew.js    2007-09-19 22:32:07 UTC 
(rev 6531)
@@ -110,6 +110,7 @@
             ,getCanvasAttribute: Lz._getCanvasAttributeSWF
             ,callMethod: Lz._callMethodSWF
             ,_ready: Lz._ready
+            ,loaded: false
             ,_sendMouseWheel: Lz._sendMouseWheel
             ,_setCanvasAttributeDequeue: Lz._setCanvasAttributeDequeue
         }
@@ -198,6 +199,7 @@
             runtime: 'dhtml'
             ,_id: properties.id
             ,_ready: Lz._ready
+            ,loaded: false
             ,setCanvasAttribute: Lz._setCanvasAttributeDHTML
             ,getCanvasAttribute: Lz._getCanvasAttributeDHTML
         }
@@ -337,7 +339,7 @@
      * @param hist:Boolean value - if true, add a history event.
      */
     _setCanvasAttributeSWF: function (name, value, hist) {
-        if (dojo.flash.ready) {
+        if (this.loaded) {
             if (hist) {
                 Lz.history._store(name, value);
             } else {
@@ -386,6 +388,7 @@
     }
     ,/** @access private */
     _ready: function (cref) {
+        this.loaded = true;
         if (this._setCanvasAttributeQ) {
             this._setCanvasAttributeDequeue();
         }
@@ -402,7 +405,7 @@
      * @param name:String name of the property to read
      */
     _getCanvasAttributeSWF: function (name) {
-        if (dojo.flash.ready) {
+        if (this.loaded) {
             return dojo.flash.comm.getCanvasAttribute(name);
         } else {
             alert('Flash is not ready: getCanvasAttribute' + name);
@@ -545,7 +548,7 @@
      * @param js:String javascript to call in the form 
'foo.bar.methodcall(arg1,arg2,...)'
      */
     _callMethodSWF: function (js) {
-        if (dojo.flash.ready) {
+        if (this.loaded) {
             return dojo.flash.comm.callMethod(js);
         } else {
             this._lastjs = function() {

Modified: openlaszlo/trunk/lps/includes/source/lzhistory.js
===================================================================
--- openlaszlo/trunk/lps/includes/source/lzhistory.js   2007-09-19 21:58:57 UTC 
(rev 6530)
+++ openlaszlo/trunk/lps/includes/source/lzhistory.js   2007-09-19 22:32:07 UTC 
(rev 6531)
@@ -33,7 +33,7 @@
             // use an iframe;
             var i = document.createElement('iframe');
             Lz.__setAttr(i, 'id', 'lzHistory');
-            Lz.__setAttr(i, 'border', '0');
+            Lz.__setAttr(i, 'border', 0);
             document.body.appendChild(i);
             i.style.position = 'absolute';
             i.style.display = 'none';
@@ -97,8 +97,8 @@
     ,/** */
     set: function(s) {
         if (s == null) s = '';
-        if (this._currentstate == s) return;
-        this._currentstate = s;
+        if (Lz.history._currentstate == s) return;
+        Lz.history._currentstate = s;
 
         var hash = '#' + s;
 
@@ -108,19 +108,19 @@
             doc.open();
             doc.close();
             doc.location.hash = hash;
-            this._parse(s + '');
+            Lz.history._parse(s + '');
         } else if (Lz.__BrowserDetect.isSafari) {
             // can't preserve query strings :(
-            this._form.action = hash;
-            top.document.location.lzaddr.history = this._history.toString();
-            this._skip = true;
-            this._history[history.length] = hash;
-            this._historylength = history.length + 1;
-            this._form.submit()
-            this._skip = false;
+            Lz.history._form.action = hash;
+            top.document.location.lzaddr.history = 
Lz.history._history.toString();
+            Lz.history._skip = true;
+            Lz.history._history[history.length] = hash;
+            Lz.history._historylength = history.length + 1;
+            Lz.history._form.submit()
+            Lz.history._skip = false;
         } else {
             top.location.hash = hash;
-            this._parse(s + '');
+            Lz.history._parse(s + '');
         }
         return true;
     }


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to