Sorry about the crappily-formatted code - I'm writing it in GMail!

FLASH:

import flash.external.ExternalInterface;

class blah
{
    var instance:Object = new Object();
    // Function alias for JavaScript
    var methodName:String = "goToCuePoint";
    // Function alias for Actionscript
    var method:Function = setPlayIndexByTrack;

    function blah() {
            ExternalInterface.addCallback(methodName, instance, method);
    }

    function setPlayIndexByTrack() {
      trace("dude, JS just called my AS!");
    }

}


JS:

<script language="JavaScript">

    function getNextTrack() {
        thisMovie("mediaPlayer").goToCuePoint();
    }

    function thisMovie( movieName ) {
        if (navigator.appName.indexOf("Microsoft") != -1) {
            return window[movieName];
        } else {
            return document[movieName];
        }
    }

</script>



hth,

Mike
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to