Hi, I use FlexBuilder 3 to generate HTML & JavaScript files to expose one method called "actionScriptMethod ()" in my main flex application. the generated code are shown below.
////// HMTL /////// <head> <title>Test page for the JSASTest class</title> <meta http-equiv=" Content-Type" content="text/ html; charset=utf- 8" /> <script type="text/javascri pt" src="lib/FABridge. js"></script> <script type="text/javascri pt" src="JSASTest. js"></script> </head> <body> <h1>Test page for the <code>JSASTest< /code> class</h1> <object classid="clsid: D27CDB6E- AE6D-11cf- 96B8-44455354000 0" id="JSASTestTest" width="700" height="600" codebase="http://fpdownload. macromedia. com/get/flashpla yer/current/ swflash.cab"> <param name="movie" value="../.. /bin-debug/ JSASTest. swf" /> <param name="flashvars" value="bridgeName= b_JSASTest" /> <param name="quality" value="high" /> <param name="allowScriptAc cess" value="sameDomain" /> <embed src="../../bin- debug/JSASTest. swf" quality="high" width="700" height="600" name="JSASTestTest" align="middle" play="true" loop="false" quality="high" allowScriptAccess= "sameDomain" type="application/ x-shockwave- flash" pluginspage= "http://www.adobe. com/go/getflashp layer" flashvars="bridgeNa me=b_JSASTest" > </embed> </object> <h2>Test controls</h2> <input type="button" value="Invoke ActionScript" onclick="callingAct ionScript( )" /> </body> ////// JS file //// //this method was generated code function JSASTestReady( ) { b_JSASTest_root = FABridge["b_ JSASTest" ].root(); JSASTest.actionScri ptMethod = function() { b_JSASTest_root. actionScriptMeth od(); }; } //this method was hand code function callingActionScript () { alert("js:callingAc tionScript( )"); var flexApp; try { //flexApp = FABridge.b_JSASTest .root(); flexApp = FABridge["b_ JSASTest" ].root(); } catch (err) { alert("Failed getting root: " + err.description) ; } flexApp.actionScrip tMethod() ; //actionScriptMetho d() is //defined in action script //code } /*********** ********* ********* *** When I clicked on the button in HTML, it does invoked the function callingActionScript () in JavaScript file. However, the code to get flexApp throwed an exception with err "undefine". why FABridge["b_ JSASTest" ].root() fail in function callingActionScript () but does not fail in the method JSASTestReady( )? I tried to read thru adobe documentation and various post on this forum but still couldn't figure out how to make this work. Any help would be appreciated. Doug

