Call JavaScript with ExternalInterface
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="horizontal" creationComplete="onStartup()">
<mx:Script>
private var myArray:Array = [];
private function onStartup() : void {
ExternalInterface.addCallback( "addItem", function( str:String ) : void {
myArray.push( str );
theList.dataProvider = myArray;
});
ExternalInterface.call( 'jsLoaded' );
}
</mx:Script>
<mx:List id="theList" width="200" height="250" />
</mx:Application>
Related examples in the same category