代码
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initUI()">

<mx:Script>
 
<![CDATA[
  import mx.events.DropdownEvent;
  import mx.controls.Alert;
  internal 
function initUI():void{
  
var info:Array=new Array();
  info.push({label:
"Book 1",data:"1"});
  info.push({label:
"Book 2",data:"2"});
  info.push({label:
"Book 3",data:"3"});
  bookList.dataProvider
=info;
  bookList.addEventListener(DropdownEvent.CLOSE,change);
  }
  
  internal 
function chooseHandler(evt:DropdownEvent):void{
  
var item:Object =bookList.selectedItem;
  tip_txt.text
="Selevt:Label:"+item.label+":data:"+item.data;
  }
  
  private 
function change(evt:DropdownEvent):void{
   
//Alert.show("关闭窗口");
  ExternalInterface.call("change()");
  }
  
   private 
function closeHandler(evt:DropdownEvent):void{  
                Alert.show(
"关闭窗口");  
            }
 ]]
>
</mx:Script>
   <mx:ComboBox id="bookList" x="30" y="86" width="160">
   
</mx:ComboBox>
   <mx:TextArea id="tip_txt"  x="30" y="129" height="182" width="178"/>
</mx:Application>

 

页面当中应用:

 

代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    
<title></title>
    
<script type="text/javascript">
        
function change() {
            alert(
"哈哈,我被调用了!!!");
        }
    
</script>
</head>
<body>

      
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
            id
="main" width="600" height="400"
            codebase
="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
            
<param name="movie" value="include/flash/main.swf" />
            
<param name="quality" value="high" />
            
<param name="bgcolor" value="#869ca7" />
            
<param name="allowScriptAccess" value="sameDomain" />
            
<embed src="include/flash/main.swf" quality="high" bgcolor="#869ca7"
                width
="600" height="400" name="main" align="middle"
                play
="true"
                loop
="false"
                quality
="high"
                allowScriptAccess
="sameDomain"
                type
="application/x-shockwave-flash"
                pluginspage
="http://www.adobe.com/go/getflashplayer">
            
</embed>
    
</object>
</body>
</html>

 

posted on 2010-04-09 12:08  钱途无梁  阅读(1305)  评论(0编辑  收藏  举报