[AS3] Downloader class

Downloader.as code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.
 * http://creativecommons.org/licenses/by-nc-sa/3.0/
 */
 
package	hangunsworld.util{
 
	import	flash.net.FileReference;
	import	flash.net.URLRequest;
	import	flash.display.DisplayObject;
 
	/*
	 * Downloader
	 * Downloader class allows you to download a file easily.
	 *
	 * @author: Han Sanghun (http://hangunsworld.com/blog)
	 * @last modified: 2007-03-23
	 * @language version: ActionScript 3.0
	 */
 
	public class Downloader{
 
		private var file:FileReference;
		private var req:URLRequest;
 
		/*
		 * Downloader Constructor
		 */
		public function Downloader(){
			file = new FileReference();
			req = new URLRequest();
		}
 
		/*
		 * downloadSWF
		 * Download an SWF file that contains the provided DisplayObject.
		 * @param obj A DisplayObject to download.
		 */
		public function downloadSWF(obj:DisplayObject):void{
			req.url = obj.loaderInfo.url;
			file.download(req);
		}
 
		/*
		 * downloadURL
		 * Download a specific file.
		 * @param url An URL of a file to be downloaded.
		 */
		public function downloadURL(url:String):void{
			req.url = url;
			file.download(req);
		}
 
	}
 
}

1
2
3
4
5
import hangunsworld.util.Downloader;
 
var dw:Downloader = new Downloader();
dw.downloadURL("http://somedomain.com/somefile.as");
dw.downloadSWF(this);

Font.hasGlyphs() works with embeded fonts only.

Specifies whether a provided string can be displayed using the currently assigned font.

quote from Adobe® Flex™ 2 Language Reference

According to the AS3 Help, this method let you know whether a specific string can be displayed using the current font, but it didn’t work.
So I googled.
And I found that it works only with embeded fonts.
AS3 도움말에는 지정한 폰트에서 특정 문자열을 표시할 수 있는지 여부를 알려준다고 되어있는데, 실제로 해보니 안되더군요.
그래서 좀 더 구글해보니…
임베드된 폰트에서만 사용할 수 있는 메소드였네요 ㅠㅠ

Flex 2 Developer’s Guide > Setting character ranges

Webcast of the official launch of Adobe® Creative Suite® 3

An invitation from Adobe

On March 27, 2007, at 3:30 p.m. Eastern time, Adobe Systems will host a webcast of the official launch of Adobe® Creative Suite® 3, live from New York City. To participate, bookmark this page and join us back here on March 27.

Dynamic MovieClip Registration with AS3 & AS2

DYNAMIC MOVIECLIP REGISTRATION WITH AS3 – Oscar Trelles

Dynamic MovieClip Registration with AS2 – Darron Schall

Pass MouseEvent to underneath InteractiveObject

Set mouseEnabled property to false, when you want an InteractiveObject not to recieve mouse events and an underneath InteractiveObject to recieve them.

Unfortunately, this does not affect ContextMenu.

1
InteractiveObject.mouseEnabled = false;
Sprite, MovieClip 등의 InteractiveObject 밑에 숨겨진 InteractiveObject가 마우스 이벤트를 받을 수 있도록 하려면, 위에 덮고 있는 InteractiveObject의 mouseEnabled 속성을 false로 바꿔주어야 합니다.

그러나 ContextMenu에는 적용되지 안네요. ㅠㅠ

download DepthManage.as

« Newer PostsOlder Posts »