[Laszlo-checkins] r11374 - in openlaszlo/branches/4.2b2: . WEB-INF/lps/lfc/kernel/swf WEB-INF/lps/lfc/kernel/swf9 WEB-INF/lps/lfc/services demos/lzpix/classes

max@openlaszlo.org max at openlaszlo.org
Tue Oct 7 16:14:57 PDT 2008


Author: max
Date: 2008-10-07 16:14:54 -0700 (Tue, 07 Oct 2008)
New Revision: 11374

Modified:
   openlaszlo/branches/4.2b2/
   openlaszlo/branches/4.2b2/WEB-INF/lps/lfc/kernel/swf/LzBrowserKernel.lzs
   openlaszlo/branches/4.2b2/WEB-INF/lps/lfc/kernel/swf9/LzBrowserKernel.lzs
   openlaszlo/branches/4.2b2/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
   openlaszlo/branches/4.2b2/WEB-INF/lps/lfc/services/LzBrowser.lzs
   openlaszlo/branches/4.2b2/demos/lzpix/classes/dataman.lzx
Log:
Merged revisions 11369 via svnmerge from 
http://svn.openlaszlo.org/openlaszlo/trunk

.......
  r11369 | max | 2008-10-07 00:01:23 -0700 (Tue, 07 Oct 2008) | 22 lines
  
  Change 20081006-maxcarlson-v by maxcarlson at Roboto.local on 2008-10-06 23:50:37 PDT
      in /Users/maxcarlson/openlaszlo/trunk-clean
      for http://svn.openlaszlo.org/openlaszlo/trunk
  
  Summary: Fix resource loading in lzpix for Flash 9
  
  Bugs Fixed: LPP-7132 - SWF9: Views with resources broken after r11331
  
  Reviewer: Technical Reviewer: andre.bargull at udo.edu
  QA Reviewer: promanik
  
  Details: swf/LzBrowserKernel.lzs, swf9/LzBrowserKernel.lzs - Add implementation of lz.Browser.loadProxyPolicy()
  
  swf9/LzSprite.as - Add shared LoaderContext and set to laod policy files before image completion - see http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/system/LoaderContext.html#checkPolicyFile.  Set __isinternalresource after unlaod() to prevent it from being nulled out.  Be careful about removing event listeners for ENTER_FRAME events - see http://www.gskinner.com/blog/archives/2006/07/as3_resource_ma_1.html
  
  LzBrowser.lzs - Add loadProxyPolicy() method for loading specific policy files - required by flickr - see http://www.yswfblog.com/blog/2007/08/29/flickr-now-even-more-flash-friendly/
  
  dataman.lzx - Preload required proxy policy files to workaround Flash bug where it can't seem to handle 302 redirects!
  
  Tests: See LPP-7132
.......



Property changes on: openlaszlo/branches/4.2b2
___________________________________________________________________
Name: svnmerge-integrated
   - /openlaszlo/branches/4.1:1-10153 /openlaszlo/branches/devildog:1-8432 /openlaszlo/branches/pagan-deities:1-7955,8825,10756-10920,10922-10928,10930-10935,11151,11207 /openlaszlo/branches/paperpie:1-6504,6506-6574,6576-7135,7137-7235 /openlaszlo/branches/wafflecone:1-5746,5818-6068,6070-6205,6207-6213,6216-6265,6267-6368,6370-6431,6433-6450,6497,6509,6661,7097,7872 /openlaszlo/trunk:1-11334,11340,11342
   + /openlaszlo/branches/4.1:1-10153 /openlaszlo/branches/devildog:1-8432 /openlaszlo/branches/pagan-deities:1-7955,8825,10756-10920,10922-10928,10930-10935,11151,11207 /openlaszlo/branches/paperpie:1-6504,6506-6574,6576-7135,7137-7235 /openlaszlo/branches/wafflecone:1-5746,5818-6068,6070-6205,6207-6213,6216-6265,6267-6368,6370-6431,6433-6450,6497,6509,6661,7097,7872 /openlaszlo/trunk:1-11334,11340,11342,11369

Modified: openlaszlo/branches/4.2b2/WEB-INF/lps/lfc/kernel/swf/LzBrowserKernel.lzs
===================================================================
--- openlaszlo/branches/4.2b2/WEB-INF/lps/lfc/kernel/swf/LzBrowserKernel.lzs	2008-10-07 18:17:20 UTC (rev 11373)
+++ openlaszlo/branches/4.2b2/WEB-INF/lps/lfc/kernel/swf/LzBrowserKernel.lzs	2008-10-07 23:14:54 UTC (rev 11374)
@@ -230,6 +230,14 @@
     Accessibility.updateProperties();
 }
 
+/**
+  * Loads a proxy policy file
+  * @keywords flashspecific
+  * @access private
+  */
+static function loadProxyPolicy (url) {
+    System.security.loadPolicyFile(url);
+}
 
 } // End of LzBrowserKernel
 

Modified: openlaszlo/branches/4.2b2/WEB-INF/lps/lfc/kernel/swf9/LzBrowserKernel.lzs
===================================================================
--- openlaszlo/branches/4.2b2/WEB-INF/lps/lfc/kernel/swf9/LzBrowserKernel.lzs	2008-10-07 18:17:20 UTC (rev 11373)
+++ openlaszlo/branches/4.2b2/WEB-INF/lps/lfc/kernel/swf9/LzBrowserKernel.lzs	2008-10-07 23:14:54 UTC (rev 11374)
@@ -17,6 +17,7 @@
 #passthrough (toplevel:true) {  
   import flash.net.*;
   import flash.system.Capabilities;
+  import flash.system.Security;
 }#
 
 /**
@@ -247,5 +248,13 @@
   throw new Error("updateAccessibility not implemented");
 }
 
+/**
+  * Updates accessibility data
+  * @keywords flashspecific
+  * @access private
+  */
+static function loadProxyPolicy (url) {
+    Security.loadPolicyFile(url);
+}
 
 } // End of LzBrowserKernel

Modified: openlaszlo/branches/4.2b2/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
===================================================================
--- openlaszlo/branches/4.2b2/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as	2008-10-07 18:17:20 UTC (rev 11373)
+++ openlaszlo/branches/4.2b2/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as	2008-10-07 23:14:54 UTC (rev 11374)
@@ -19,6 +19,7 @@
   import flash.utils.*;
   import mx.controls.Button;
   import flash.net.URLRequest;
+  import flash.system.LoaderContext;
   import flash.media.Sound;
   import flash.media.SoundChannel;
   import flash.media.SoundMixer;
@@ -65,6 +66,8 @@
       var resourceCache:Array = null;
 
       /* private */ static const soundLoaderContext:SoundLoaderContext = new SoundLoaderContext(1000, true);
+      /* private */ 
+      static const loaderContext:LoaderContext = new LoaderContext(true);
       /* private */ static const MP3_FPS:Number = 30;
       /* private */ var sound:Sound = null;
       /* private */ var soundChannel:SoundChannel = null;
@@ -260,6 +263,7 @@
           if (getFileType(url, filetype) == "mp3") {
               // unload previous image-resource and sound-resource
               this.unload();
+              this.__isinternalresource = false;
               this.resource = url;
               this.loadSound(url);
           } else {
@@ -272,6 +276,7 @@
                   if (this.resourceObj) {
                       this.unload();
                   }
+                  this.__isinternalresource = false;
                   imgLoader = new Loader();
                   imgLoader.mouseEnabled = false;// @devnote: see LPP-7022
                   this.resourceObj = imgLoader;
@@ -290,7 +295,7 @@
                   res.scaleX = res.scaleY = 1.0;
               }
               //Debug.write('sprite setsource load ', url);
-              imgLoader.load(new URLRequest(url));
+              imgLoader.load(new URLRequest(url), loaderContext);
           }
       }
       
@@ -329,13 +334,17 @@
               this.resourcewidth = 0;
               this.resourceheight = 0;
               if (event.type == Event.COMPLETE) {
+                  if (this.loaderMC) {
+                      this.loaderMC.removeEventListener(Event.ENTER_FRAME, updateFrames);
+                      this.loaderMC = null;
+                  }
+
                   var info:LoaderInfo = event.target as LoaderInfo;
                   if (info.content is AVM1Movie) {
                       if ($debug) {
                           Debug.warn("Playback control will not work for the resource.  Please update or recompile the resource for Flash 9.", this.resource);
                       }
-                      this.loaderMC = null;
-                  } else {
+                  } else if (info.content is MovieClip) {
                       // store a reference for playback control
                       this.loaderMC = MovieClip(event.target.content);  
 
@@ -345,6 +354,7 @@
                       this.owner.resourceevent('play', null, true);
                       this.playing = this.owner.playing = true;
                   }
+
                   try {
                       var loader:Loader = Loader(event.target.loader);
                       this.resourcewidth = loader.width;
@@ -372,7 +382,7 @@
               } else if (event.type == Event.UNLOAD) {
               }
           } catch (error:Error) {
-              trace(event.type + " " + error);
+              Debug.warn(event.type + " " + error);
           }
       }
       
@@ -1217,6 +1227,10 @@
         this.lastreswidth = this.lastresheight = this.resourcewidth = this.resourceheight = 0;
         this.resource = null;
         this.__isinternalresource = null;
+        if (this.loaderMC) {
+            this.loaderMC.removeEventListener(Event.ENTER_FRAME, updateFrames);
+            this.loaderMC = null;
+        }
         this.loaderMC = null;
         this.imgLoader = null;
         this.resourceObj = null;

Modified: openlaszlo/branches/4.2b2/WEB-INF/lps/lfc/services/LzBrowser.lzs
===================================================================
--- openlaszlo/branches/4.2b2/WEB-INF/lps/lfc/services/LzBrowser.lzs	2008-10-07 18:17:20 UTC (rev 11373)
+++ openlaszlo/branches/4.2b2/WEB-INF/lps/lfc/services/LzBrowser.lzs	2008-10-07 23:14:54 UTC (rev 11374)
@@ -160,6 +160,15 @@
   function updateAccessibility ()
     { LzBrowserKernel.updateAccessibility ();}
 
+  /**
+    * Loads a proxy policy file
+    * @keywords flashspecific
+    * @access private
+    */
+  function loadProxyPolicy (url) {
+    LzBrowserKernel.loadProxyPolicy(url);
+  }
+
   /** @access private */
   var postToLps = true;
   /** @access private */

Modified: openlaszlo/branches/4.2b2/demos/lzpix/classes/dataman.lzx
===================================================================
--- openlaszlo/branches/4.2b2/demos/lzpix/classes/dataman.lzx	2008-10-07 18:17:20 UTC (rev 11373)
+++ openlaszlo/branches/4.2b2/demos/lzpix/classes/dataman.lzx	2008-10-07 23:14:54 UTC (rev 11374)
@@ -223,6 +223,15 @@
     <!-- just for testing... -->
     <dataset name="testds" type="http" ondata="if (global['debugdata']) Debug.write('ondata', this)" />
 
+    <handler name="oninit">
+        // See http://www.yswfblog.com/blog/2007/08/29/flickr-now-even-more-flash-friendly/
+        if ($swf9) {
+            lz.Browser.loadProxyPolicy('http://farm1.static.flickr.com/crossdomain.xml');
+            lz.Browser.loadProxyPolicy('http://farm2.static.flickr.com/crossdomain.xml');
+            lz.Browser.loadProxyPolicy('http://farm3.static.flickr.com/crossdomain.xml');
+            lz.Browser.loadProxyPolicy('http://farm4.static.flickr.com/crossdomain.xml');
+        }
+    </handler>
 </library>
 
 <!--



More information about the Laszlo-checkins mailing list