The newer version of Image Editor released. – 2010/01/13
[카테고리:] Flash
-
Image Editor sample for the 2nd FASC Conference.
The newer version of Image Editor released. – 2010/01/13
-
URLNavigator class.
/** * URLNavigator * * The URLNavigator class extends the Flash built-in method, navigateToURL. * This class copies the Firefox browser's link-click action. * If you click on a link with the "Ctrl" key held down, the link will be opened in a new window or a new tab, depend on the browser's settings. * Or Flash Player tries to download the url, if the "Alt" key is held down. * * @author: Han Sanghun (http://hangunsworld.com, hanguns@gmail.com) * @created: 2008 04 04 * @last modified: 2008 04 04 * * Modify Histories */ package com.hangunsworld.net{ import flash.net.navigateToURL; import flash.net.URLRequest; import com.hangunsworld.net.Downloader; public class URLNavigator{ // Downloader object. var dloader:Downloader; /** * Constructor function. */ public function URLNavigator(){ dloader = new Downloader(); }// end constructor /** * Handles the URL depending on the properties provided. * * @param ur An URLRequest object. * @param target A String value specifies the target window. [OPTIONAL] * @param ctrlkey A Boolean value indicates whether the "Ctrl" key is held down. [OPTIONAL] * @param altkey A Boolean value indicates where the "Alt" key is held down. [OPTIONAL] */ public function navigateToURL(ur:URLRequest, target:String="_self", ctrlkey:Boolean=false, altkey:Boolean=false):void{ if(ctrlkey){ // If "Ctrl" key is held down, // opens the URL in a new window or a new tab, depend on the browser's settings. flash.net.navigateToURL(ur, "_blank"); }else if(altkey){ // If "Alt" key is held down, // downlaods the URL via a Downloader object. dloader.downloadURL(ur); }else{ // Otherwise, opens the URL in the window specified by the "target" parameter. flash.net.navigateToURL(ur, target); } }// end navigateToURL }// end class }// end packageUsage sample code.
import com.hangunsworld.net.URLNavigator; stage.addEventListener(MouseEvent.CLICK, clickListener); var un:URLNavigator = new URLNavigator(); function clickListener(e:MouseEvent):void{ var url:String = "http://hangunsworld.com/blog"; var ur:URLRequest = new URLRequest(url); un.navigateToURL(ur, "_self", e.ctrlKey, e.altKey); }You can download the class file here.
-
Downloader class was modified.
Downloader 클래스의 패키지를 com.hangunsworld.util 에서 com.hangunsworld.net 으로 변경하였습니다. 아무래도 util 보다는 net 패키지에 있는 것이 더 적당한 것 같아서요.그리고 addEventListener, removeEventListener 메소드를 추가하여, 다운로드 프로그래스, 완료, 취소 등 이벤트들을 사용할 수 있습니다.
Downloader class has been moved from com.hangunsworld.util to com.hangunsworld.net. I think the net is the appropriate package rather than the util.And I added addEventListener and removeEventListener methods. Now you can monitor the download progress or get comepete event, and so on.
Downloadクラスを com.hangunsworld.util から com.hangunsworld.net に移動しました。なぜならuitlよりnetクラスの方が相応しそう。また、addEventListenerとremoveEventListenerメソッドを追加しました。ダウンロードプログレス、完了、キャンセルイベントを含め、色んなイベントを使えます。
-
[JS] Copying flash object with FlashVars parameter.
IE에서 자바스크립트를 이용하여 플래시 오브젝트를 클립보드로 복사할 때, object 객체를 선택, 복사하면 FlashVars 속성이 누락되어 복사되는 문제가 있습니다. 그러나 embed 객체를 복사하면 그런 문제가 없습니다.
그러므로 아래 코드와 같이 object 객체의 altHtml 속성을 이용하여 embed 객체를 동적으로 생성, 이 embed 객체를 복사하도록 하면 됩니다.
// Gets Flash object. var obj = document.getElementById("flashObjectID"); var alt = obj.altHtml; // embed tag // Creates a temporary embed object in the "tempLayer" layer. var temp = document.getElementById("tempLayer"); temp.innerHTML = alt; // Selects and copies the temporary embed object to the clipboard. var range = document.body.createTextRange(); range.moveToElementText(temp); range.select(); range.execCommand('copy'); range.moveToPoint(0,0); range.select(); range = null; // Removes the temporary embed object. temp.innerHTML = "";IE에서 object 태그를 사용하지 않고 직접 embed 태그만 사용하는 경우나, 파이어폭스 등 비IE 브라우저에서는, 이럴 필요가 없이, 바로 embed 객체를 선택하여 복사해주면 되죠.