title: mootools.swiff : loaderInfo never completes
body: <p>[EDIT 07-22-2010] removed deoms from my site[/EDIT]
  [EDIT 08-26-2009] added really weird issue to the bottom of question[/EDIT]
  Hi everyone
  I'm trying to get going with the mootools swiff thing and I seem not to get the loaderInfo.COMPLETE event in flash.
  more precisely a dynamically loaded swf never loads completely, while a static one does. Here is relevant code of my document class in flash (AS3).</p>
  <p>use firefox + firebug to see the traces</p>
  <pre><code>package pt.classes{
      import flash.display.MovieClip
      import flash.display.LoaderInfo
      import flash.external.*
      import flash.events.Event
      import flash.events.ProgressEvent
      import flash.events.IOErrorEvent
      import flash.events.HTTPStatusEvent
      import pt.utils.myTrace
      import pt.testTrace
      import pt.classes.Episode
      
      public class Main extends MovieClip{
          include &quot;../testTrace.as&quot;;//this is a trace() implementation that redirects traces to the firebug console
          public function Main(){
              trace (&quot;constructor for &quot;+ this);
              var l_this:Main = this;
              loaderInfo.addEventListener(Event.COMPLETE, loaderComplete);
              loaderInfo.addEventListener(Event.INIT, function(_e:Event){trace(&quot;init for &quot;+ l_this)});
              loaderInfo.addEventListener(Event.OPEN, function(_e:Event){trace(&quot;open for &quot;+ l_this)});
              loaderInfo.addEventListener(ProgressEvent.PROGRESS, function(_e:ProgressEvent){trace(&quot;Progress for &quot;+ l_this)});
              loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function(_e:IOErrorEvent){trace(&quot;IOError for &quot;+ l_this)});
              loaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS, function(_e:HTTPStatusEvent){trace(&quot;HTTPStatus for &quot;+ l_this)});
              ExternalInterface.addCallback(&quot;trace&quot;, this.trace);
          }
          private var m_params:Object;
          /*! loaderComplete
           * called when the stage has finished loading
           * @param _e : an Event
           */
          private function loaderComplete (_e:Event){
              m_params = new Object;
              for (var i:String in loaderInfo.parameters){
                  m_params[i] = loaderInfo.parameters[i];
              }
              trace(&quot;loader complete for &quot; + this);
          }
      }
  }
  </code></pre>
  <p>and when i simply use the html that flash IDE gives me, the firebug console gives me this :</p>
  <blockquote>
  <p>constructor for Main Pokertales</p>
  <p>init for Main Pokertales</p>
  <p>Progress for Main Pokertales</p>
  <p>loader complete for MainPokertales</p>
  </blockquote>
  <p>but, when I use swiff like this (.js file included in  right after my moo-core.js) :</p>
  <pre><code>mySwiff = new Swiff(&quot;files/main.swf&quot;,{
    width:  200,
    height: 150,
    params: {
        wmode: 'opaque',
    },
    vars: {
        myVariableString: 'hello'
    },
    callBacks: {
      load: function() {
        alert(&quot;Flash is loaded!&quot;);
        console.log(&quot;flash is loaded&quot;);
        this.trace('hello from flash');
      },
      error: function(){console.log(&quot;error!&quot;)},
      start: function(){console.log(&quot;start!&quot;)}
    }
  });
  console.log(mySwiff);
  window.addEvent('domready', function() {
    console.log('dom is ready');
    //document.newElement(mySwiff);/*
    var myCont;
    if (myCont = $('swiffcontainer')){
      mySwiff.inject(myCont,'top');
    };
    //console.log(myCont, mySwiff);
  });
  </code></pre>
  <p>i only get the two first logs (no progress, no complete, and no load callback...</p>
  <blockquote>
  <p>Object options=Object instance=Swiff_1251130426079</p>
  <p>dom is ready</p>
  <p>constructor for Main Pokertales</p>
  <p>init for Main Pokertales</p>
  </blockquote>
  <p>so the swf is created, it inits its loaderInfo then stops... anyone got insights on this?</p>
  <p>What am I doing wrong here?
  OH, and thanks in advance for any help :)</p>
  <p>EDIT : as weird as it may seem, the swiff actually fully loads and logs all the way to loader complete, IF the .swf file has been generated less than 10seconds ago... if i hit &quot;publish&quot; in flash IDE and then immediately hit F5 in firefox, I get this log :</p>
  <blockquote>
  <p>Object options=Object instance=Swiff_1251294375102</p>
  <p>dom is ready constructor for Main</p>
  <p>Pokertales init for Main Pokertales</p>
  <p>Progress for Main Pokertales</p>
  <p>loader complete for Main Pokertales</p>
  <pre><code>      start = Swiff.CallBacks.Swiff_1251294375102.start
  
        myVariableString = hello
  
        error = Swiff.CallBacks.Swiff_1251294375102.error
  
        load = Swiff.CallBacks.Swiff_1251294375102.load
  </code></pre>
  </blockquote>
  <p>Maybe I'm missing some security/allowDomain issue I don't know? Surely I can't publish &amp; upload a .swf every 10s on my site (productivity would be quite low :) )</p>
  <p>EDIT 2 : Ok I am narrowing the problem : the script actually works if i open the html file directly, but stops a init event when called through HTTP (local or distant servers all the same). Is it some domain policy thing I don't know?</p>