All pastes #828383 Raw Edit

Mine

public text v1 · immutable
#828383 ·published 2007-12-22 12:28 UTC
rendered paste body
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
	creationComplete="init();" styleName="plain"
    backgroundColor="white">

    <mx:Script><![CDATA[

        import flash.external.ExternalInterface;
        
        private function testfun():void
        {
            output.text += "foobar";
        }

        private function init():void
        {
            // prints true
            output.text += ExternalInterface.available + "\n";

            // prints undefined
            try
            {
                output.text += ExternalInterface.addCallback("testfun",testfun);
            } 
            catch(e:Error)
            {
                output.text += "error "+e;   
            }

            // prints out a log message from js
            ExternalInterface.call("console.log","heellllooo");
        }

    ]]></mx:Script>

    <mx:TextArea 
        id="output" 
        width="100%" 
        height="100" />

</mx:Application>