URLRequest를 이용해서 웹개발을 할때처럼 자바스크립트를 실행시킬 방법이 없을까해서
찾아봤음.
사용법은 무지 간단해 보이더군요. ㅋ
역시 모르면 힘들지만 알면 정말 간단한것 같습니다. ^^
<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> import flash.net.*; public function callWrapper(e:Event):void { public var eType:String = String(e.type); public var eName:String =
String(e.currentTarget.id); public var u:URLRequest = new URLRequest
("javascript:catchClick('" + eName + "','" + eType + "')"); navigateToURL(u,"_self"); } </mx:Script> <mx:Button id="b1" click="callWrapper(event)" label="Call Wrapper"/> </mx:Application>The enclosing HTML page includes the following JavaScript:
<script language="JavaScript"> function catchClick(name, type) { alert(name + " triggered the " + type + " event."); } </script>You can also use the
navigateToURL()
method with basic JavaScript functions in the URLRequest itself. For example, you can launch the default e-mail client with a single line of code:public function sendMail():void {public var u:URLRequest = new URLRequest("mailto:" + ta1.text);
navigateToURL(u,"_self"); }
Datagrid에 NumericStepper를 넣는 방법 (0) | 2007.08.10 |
---|---|
flex로 구현한 RSS Reader (0) | 2007.08.10 |
The navigateToURL() method syntax (0) | 2007.08.09 |
Using an item renderer with the TileList and HorizontalList controls (0) | 2007.08.09 |
flex에서 Using the htmlText property 사용하기 (0) | 2007.08.08 |