tags:

views:

1044

answers:

1

I'm trying to use Mootool's Swiff object to load a flash movie and to start talking with it. I've been following the example here:

http://mootools.net/blog/2008/02/12/whats-new-in-12-swiff/#more-63

Which I know is a little out of date (the events option should be callBacks apparently) but should at least be a start. Yet I can't get the thing working one bit. No JS errors, firebug says its loaded SWF from my server at least but no alerts! Whats missing?

Actionscript:

//(ActionScript)
import flash.external.*;

function echoText(text) {
    ExternalInterface.call('alert', "This message is from Flash: "+text);   
}

ExternalInterface.addCallback( "echoText", this, echoText );

//Fires the 'onLoad' event within the Swiff object.
ExternalInterface.call(_root.onLoad);

My JS:

<html>
    <head>
     <title>Terris test console</title>
    </head>
    <body>
     <script type="text/javascript" src="mootools.js"></script>
     <script type="text/javascript">

      var obj;

      window.addEvent( "domready", function() {
       //(JavaScript)
       obj = new Swiff('interface.swf', {
        width:  1,
        height: 1,
        container: $('swiffContainer'),
        callBacks: {
         onLoad: function() {
          alert("Flash is loaded!")
         }
        }
       });
      });


     </script>
    </body>
</html>

I'm using Mootools 1.2.2 from here http://mootools.net/download

Any ideas?

+1  A: 

Don't you need a

<div id='swiffContainer'></div>

somewhere in your body?

Doh! That works, I'm still having trouble with MooSwiff though but at least its working. Sorry for the late acceptance, been away :)
Pete Duncanson