raymond.chen 发表于 2013-2-7 15:21:31

Flex与JavaScript之间的交互

一、mxml文件中的源码
<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="init()"><mx:Script><!]></mx:Script><mx:Button x="27" y="28" label="Load" click="callJavaScriptMethod()"/><mx:TextArea x="27" y="58" width="450" height="143" id="txt1"/></mx:Application> 
二、在/html-template/index.template.html模板文件中添加以下代码:
<script language="javascript">function callFlexMethod(text){//${application}.flexMethod(text);document.getElementById("${application}").flexMethod(text);}function jsMethod(text){ alert("hello " + text);}</script><input type=button value="click" > 
页: [1]
查看完整版本: Flex与JavaScript之间的交互