码迷,mamicode.com
首页 > 其他好文 > 详细

EBT 道客巴巴的加密与破解 - 实用组合工具箱

时间:2015-08-05 01:09:05      阅读:2214      评论:0      收藏:0      [点我收藏+]

标签:actionscript   doc88_cracker   


本文系列共有三篇,前两篇链接在此:

 

EBT 道客巴巴的加密与破解 -免费下载器的基础

 《EBT 道客巴巴的加密与破解 序章

写到这里有点忧伤,有两点,一是CSDN在删除我之前上传的附件,二是doc88.com服务器端没有完成破解,也就是说我只解开了doc88客户端。不想说什么,纯贴个代码就走。


AIR 项目主文件:

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                       xmlns:s="library://ns.adobe.com/flex/spark"
                       xmlns:mx="library://ns.adobe.com/flex/mx"
					   creationComplete="doWindowComplete(event);"
					   showStatusBar="false" minWidth="600" minHeight="400" maxWidth="600" maxHeight="420"
					   title="DOC88DD Downloader" >
	
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	
	<fx:Script>
		<![CDATA[
		import dda.Coder;
		import dda.JSAgent;
		import dda.SmartClip;
		import flash.desktop.Clipboard;
		import flash.desktop.ClipboardFormats;
		import flash.display.*;
		import flash.events.*;
		import flash.net.*;
		import flash.ui.Keyboard;
		import flash.utils.ByteArray;
		import mx.controls.*;
		import flash.filesystem.*;
		import mx.events.*;
		import spark.components.Group;
		
		[Bindable]
		private var _lod:URLLoader = new URLLoader();
		private var _req:URLRequest = new URLRequest();
		private var _jsa:JSAgent;
		private var _clip:SmartClip;
		
		private var _headers:Array;
		private var _requestHeaders:Array = [
			new URLRequestHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"),
			new URLRequestHeader("Accept-Encoding","gzip, deflate, sdch"),
			new URLRequestHeader("Accept-Language", "zh-CN,zh;q=0.8"),
			new URLRequestHeader("Cache-Control", "no-cache"),
			new URLRequestHeader("Referer", "www.baidu.com"),
			//new URLRequestHeader("Host", "hiphotos.baidu.com"),
			//new URLRequestHeader("x-flash-version: 16,0,0,252"),
			//new URLRequestHeader("If-Modified-Since", "Mon, 01 Sep 2014 13:31:32 GMT"),
			//new URLRequestHeader("If-None-Match", "7146584707648519807"),
			new URLRequestHeader("Proxy-Connection", "keep-alive"),
			//new URLRequestHeader("Cookie",""),
			new URLRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 Safari/537.36")
			];
		
		private var _symbols:String = "※◎★☆○●■△▲◇◆□■";
		private var _tipOverlay:String = "An old file exists! Willing to update it or not?";
		private var _tipDownloaded:String = "●File downloaded. (MB) binary store in memory inside PC.";
		private var _tipDownload:String = "☆Downloading start:\n"
		private var _tipTaskKill:String = "※ Downloading cancel";
		private var _tipDisturbed:String = "A task is working. Press ESC to cancel."
		private var _tipServerStatus:String = "Server return status: ";
		private var _tipDoc88:String = "doc88.com detected and the js data distiled\n";
		private var _tipSavePath:String = "★Save to Path:";
		private var _tipDownloadClip:String = "Download smartclip URL:";
		private var _tipSaveDirectory:String = "※Error: Save file to be a directory."
		private var _tipNotDoc88:String = "※This file is not a doc88 data.";
		private var _tipEbtInQueue:String = "Doc88.com ebt files in queue.";
		private var _tipQueueFinish:String ="All files in queue has done."

		private var _WEBHOST:RegExp = /^(https?:\/\/)?([\w-]+\.)+(\w{2,4})\/?/;
		private var _DOC88REP:RegExp = /^http:\/\/www\.doc88\.com\/p-(\d+)\.html$/;
		private var _WEBREP:RegExp = /^(https?:\/\/)?.+\..+\..{2,3}\//;
		//private var _PLAINREP:RegExp = /\/|(\.html)$|(\.htm)$|(.txt)$|(js$)/;
		private var _FileNameRep:RegExp = /([^\/\\\?#]+)(\?#?.*)?$/;
		private var _ParserMap:Array = ["</head>", 0, "initWidth();", 1, "</script>", 0];
		
		private var _File:File = new File();
		private var _FileMask:Array = [
					new FileFilter("script content", "*.js;*.as,*.cpp"),
					new FileFilter("text content", "*.txt;*.log;*.inf")];
		
		private function doWindowComplete(e:FlexEvent):void 
		{
			btnOpen.addEventListener(MouseEvent.CLICK, doOpen);
			txtFilePath.addEventListener(KeyboardEvent.KEY_UP, doKeyPress);
			addEventListener(KeyboardEvent.KEY_UP, doAppKeyPress);
			
			_clip = new SmartClip(function (smart:SmartClip, finish:Boolean):Boolean 
			{
				if (_lod.hasEventListener(Event.COMPLETE)) return false;
				if ( finish ) log(_tipQueueFinish);
				log(_tipDownloadClip + smart.url);
				openWebURL(smart.url);
				return true;
			});
		}
		
		private function openBrowser():void 
		{
			_File.browseForOpen("Open", _FileMask);
			_File.addEventListener(Event.SELECT, doSelect); 
		}
		
		private function openWebURL(url:String):void 
		{
			url = !/^http/.test(url)? "http://" + url:url;

			_headers = null;
			_req.url = url;
			_req.method = URLRequestMethod.GET;
			_req.useCache = false;
			_req.cacheResponse = false;
			_req.requestHeaders = _requestHeaders;
			_req.manageCookies = false;
			
			_lod.addEventListener(Event.COMPLETE, doComplete);
			_lod.addEventListener(ErrorEvent.ERROR, doError);
			_lod.addEventListener(IOErrorEvent.IO_ERROR, doError);
			//_lod.addEventListener(HTTPStatusEvent.HTTP_STATUS, doResponse);
			_lod.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, doResponse); // AIR only
			_lod.addEventListener(ProgressEvent.PROGRESS, doProgress);
			_lod.load(_req);
			
			log( _tipDownload + url);
		}
		
		private function doAppKeyPress(e:KeyboardEvent):void 
		{
			var sentinal:Boolean = _lod.hasEventListener(Event.COMPLETE);
			switch(e.keyCode) {
			case Keyboard.ESCAPE:
				if (sentinal) {
					_lod.close();
					cleanListener();
					log(_tipTaskKill+" "+url);
				}
				break;
			default:
			}
			trace("KeyPress & keyCode = " + e.keyCode);
		}
		
		private function doKeyPress(e:KeyboardEvent):void 
		{
			var sentinal:Boolean = _lod.hasEventListener(Event.COMPLETE);
			// TextInput(e.target)==txtFilePath?
			switch (e.keyCode) 
			{
			case Keyboard.ENTER:
				if( !sentinal ){
					doOpen(new MouseEvent(MouseEvent.CLICK));
				}else Alert.show(_tipDisturbed);
				break;
				default:
			}
		}
		
		private function doProgress(e:ProgressEvent):void 
		{
			// mode may set to MANUAL to coding progressbar. EVENT for default 
			if (e.bytesTotal == 0) {
				_pgs.indeterminate = true;// no Content-Length
				//_pgs.label = "Loading(B)".replace(e.bytesLoaded);
			}else{
				_pgs.setProgress(e.bytesLoaded, e.bytesTotal);
				//trace("A/B".replace("A", e.bytesLoaded).replace("B", e.bytesTotal));
			}
		}
		
		private function doComplete(e:Event):void 
		{
			var df:String = _lod.dataFormat;
			if ( df == URLLoaderDataFormat.TEXT && _DOC88REP.test(_req.url) && _lod.bytesTotal < 1024 * 1024 ) {
				var js:String = _lod.data;
				for (var k:Number = 0; k < _ParserMap.length; k+=2 ) {
					var a:Array = js.split(_ParserMap[k])
					var i:Number = _ParserMap[k+1];
					js = a[i];
					trace("\n\n" + _ParserMap[k] + " ORDER : " + i);
					//trace("\n\nCompensated:"+a[1 - i]);
					//trace(js);
				}
				txtContent.text = "";
				txtContent.appendText(_tipDoc88);
				txtContent.appendText(js?js:"null;");
				if (js) {
					var id:String = _DOC88REP.exec(_req.url)[1];
					preSaveToFile("asts/data.id.js".replace("id",id), toByteArray(js));
					initDoc88(js);
				}
			}else { 
				var bs:ByteArray = null;
				if ( df != URLLoaderDataFormat.BINARY ) {
					bs = new ByteArray()
					bs.writeUTFBytes(_lod.data);
				}else {
					bs = _lod.data;
				}
				var KB:Number = 1024;
				var MB:Number = 1024 * 1024;
				var BS:Number = _lod.bytesTotal||_lod.bytesLoaded;
				var mbs:Number = BS > MB? BS / MB:BS / KB;
				log(_tipDownloaded.replace("MB", mbs.toFixed(2) + (BS > MB? "MB":"KB") ));
				//var ps:String = _FileNameRep.exec(_req.url)[1];
				//var d8:Array = _DOC88REP.exec(_req.url);
				var ps:String = _req.url.replace(_WEBHOST, /\.ebt/.test(_req.url)? "ebt/":"./");
				preSaveToFile(ps, bs);
			}
			cleanListener();
		}
		
		private function doResponse(e:HTTPStatusEvent):void 
		{
			if(!_headers){
				_headers = e.responseHeaders;
				for (var i:int = 0; i < _headers.length; i++) {
					var h:Object = _headers[i];
					if (h.name == "Content-Type" && String(h.value).indexOf("text/html")<0) {
						_lod.dataFormat = URLLoaderDataFormat.BINARY;
						break;
					}
				}
			}
			if (e.status != 200) {
				log(_tipServerStatus + e.status);
				_lod.close();
				cleanListener();
			}else log(e.type + "=" + e.status);
		}
		
		private function doError(e:ErrorEvent):void 
		{
			log(e.toString());
			cleanListener();
		}
		
		private function cleanListener():void 
		{
			_lod.removeEventListener(Event.COMPLETE, doComplete);
			_lod.removeEventListener(ErrorEvent.ERROR, doError);
			_lod.removeEventListener(ProgressEvent.PROGRESS, doProgress);
			_lod.removeEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, doResponse);
			_pgs.setProgress(100, 100);
			_pgs.indeterminate = false;
		}
		
		private function doOpen(e:MouseEvent):void 
		{
			var p:String = txtFilePath.text;
			if (_WEBREP.test(p))
			{
				openWebURL(p);
				return ;
			}
			if (txtFilePath.text) {
				try{
					_File = new File(txtFilePath.text);
					trace("_File.exists="+_File.exists);
					trace("_File.isDirectory=" + _File.isDirectory);
					if ( _File.exists && !_File.isDirectory ) {
						doOpenFile(_File);
						return
					}
				}catch (er:Error) {
					log(er.getStackTrace());
				}
			}
			openBrowser();
		}
		
		private function doSelect(e:Event):void 
		{
			_File = File(e.target);
			doOpenFile(_File);
			_File.removeEventListener(Event.SELECT, doSelect);
		}
		
		private function doOpenFile(file:File):void 
		{
			var s:FileStream = new FileStream();
			s.open(file, FileMode.READ);
			txtFilePath.text = _File.nativePath;
			txtContent.text = s.readUTFBytes(s.bytesAvailable);
			s.close();
			s = null; 
			initDoc88(txtContent.text);
			btnModify.addEventListener(MouseEvent.CLICK, doModify);			
		}
		
		private function initDoc88(data:String):void 
		{
			var js:String = "<script>T</script>".replace("T", data);
			_jsa = new JSAgent(js, function (o:Object):void 
			{
				var nick_name:String = o.nick_name;
				if (nick_name) {
					doDoc88Decode();
				}else {
					log(_tipNotDoc88);
				}
			});			
		}
		
		private function doDoc88Decode():void 
		{
			var MPIB:String = _jsa.win.mpib;
			var MPEBT:String = _jsa.win.mpebt;
			var MAX_PAGE:Number = _jsa.win.mtp;
			var MHI:Array = _jsa.win.mhi;
			var MHOST:String = _jsa.win.mhost;
			var KEYS:Array = Coder.decode(MPIB).split(",");
			var fs:Array = new Array();
			for ( var i:Number = 0; i < MAX_PAGE; i++) {
				var ks:Array = KEYS[i].split("-");
				var pk_size:Number = ks[4];
				var NO_IDEA:Number = ks[3];
				var height:Number = ks[2];
				var width:Number = ks[1];
				var hn:Number = ks[0];
				var ph_size:Number  = MHI[hn - 1];
				var phk:String = hn + "-0-" + ph_size + "-" + MPEBT;
				var pkk:String = hn + "-" + NO_IDEA + "-" + pk_size + "-" + MPEBT;
				var ph_URL:String = MHOST + "/getebt-" + Coder.encode(phk) + ".ebt";
				var pk_URL:String = MHOST + "/getebt-" + Coder.encode(pkk) + ".ebt";
				fs.push(ph_URL, pk_URL);
			}
			var list:String = fs.join("\n");
			_clip.enqueue(fs);
			//Clipboard.generalClipboard.setData(ClipboardFormats.TEXT_FORMAT, list);
			log(_tipEbtInQueue);
		}
		
		private function toByteArray(str:String):ByteArray
		{
			var b:ByteArray = new ByteArray();
			b.writeUTFBytes(str);
			return b;
		}
		private function preSaveToFile(path:String, data:ByteArray):void 
		{
			//var file:File = File.applicationDirectory.resolvePath(path); this very bad!
			var file:File = new File( File.applicationDirectory.resolvePath(path).nativePath );
			log(_tipSavePath + file.nativePath);
			var r:int = -1; 
			if ( file.exists ) {
				Alert.show(_tipOverlay, this.title, Alert.YES | Alert.NO, null, function(e:CloseEvent):void {
					if( Alert.YES == e.detail) postSave(file, data);
				});
			}else { postSave(file, data); }
			//if ( r == Alert.OK) ... test here is faulty
		}
		
		private function postSave(file:File, data:ByteArray):void 
		{
			if( file.isDirectory ) {
				log( _tipSaveDirectory );
				return ;
			}
			
			var s:FileStream = new FileStream();
			s.open(file, FileMode.WRITE);
			s.writeBytes(data, 0, data.bytesAvailable);
			s.close();
			s = null;
		}
		
		private function doModify(e:Event):void 
		{
			//txtContent.lineBreak = "explicit";
			var s:FileStream = new FileStream();
			s.open(_File, FileMode.WRITE);
			s.writeUTFBytes(txtContent.text);
			s.close();
			s = null;
			Alert.show("File content updated", this.name, Alert.OK);
		}
		
		private function trace(msg:String):void 
		{
			log(msg);
		}
		private function log(msg:String):void 
		{
			txtContent.text = (msg);
		}
		]]>
	</fx:Script>
	
	<fx:Style>
		@namespace s "library://ns.adobe.com/flex/spark";
		@namespace mx "library://ns.adobe.com/flex/mx";
		@namespace components "components.*";
		@namespace controls "controls.*";
		
		mx|ProgressBar {
			/*borderColor: #009999;
			trackColors: #cccccc, #999999;
			width:100%;
			*/
			color: #000033;
			paddingLeft: 46;
			paddingRight: 46;
			textIndent: 0;
			trackHeight: 10;
			verticalGap: 4;
			bottom:8;
		}
		
		s|TextInput {
			cornerRadius: 10;
		}
		
		s|Button {
			/* Style by Flex Style Explorer.swf */
			cornerRadius: 10;
			textIndent: 0;
			paddingLeft: 4;
			paddingRight: 4;
			highlightAlphas: 0.52, 0.14;
			fillAlphas: 0.45, 0.52, 0.76, 0.64;
			fillColors: #ffffff, #cccccc, #ffffff, #00ff00;
			color: #0a3944;
			textSelectedColor: #999999;
			borderColor: #aab3b3;
			fontSize: 10;
			fontWeight: bold;
		}
		
		s|Button:hover {
			background-color: white;
		}
		
		s|Label {
			font-size:12px;
			color: #849C23;
		}

	</fx:Style>
	
	<s:Label text="Hello AIR" horizontalCenter="0" verticalCenter="0"/>
	<s:Panel id="panel" x="25" y="15" width="550" height="330">
		<s:Label x="32" y="22" text="File Path" />
		<s:TextInput x="86" y="17" width="350" id="txtFilePath" />
		<s:Button id="btnOpen" x="443" y="17" height="22" label="Open..."/>
		<!-- click="...coding..online..." -->
		<s:TextArea x="33" y="45" width="480" height="197" id="txtContent" 
			horizontalScrollPolicy="off" lineBreak="toFit" >
			<s:p>http://www.doc88.com/p-8979039048413.html Developing Flex Applications 910P</s:p>
			<s:p>www.doc88.com/p-3844788415957.html CRC Standard Mathematical Tables and Formulae</s:p>
			<s:p>www.doc88.com/p-1018531060970.html The Technique of Furniture Making - lan Peters</s:p>
			<s:p>www.doc88.com/p-0901480076131.html Woodworker's Guide to Bending Wood Techniques, Projects and Expert Advice for Fine Woodworking</s:p>
			<s:p>www.doc88.com/p-372366130103.html Mathematica使用指南第2版(英文版) 374p</s:p>
			<s:p>www.doc88.com/p-900281077991.html Trott M The Mathematica Guidfor Programming 886p</s:p>
			<s:p>ryanswanson.com/regexp/RegExpExplorer.swf</s:p>
			<s:p>hiphotos.baidu.com/doc/pic/item/c8177f3e6709c93d7b0d8be29c3df8dcd1005423.jpg</s:p>
			<s:p>www.flashdevelop.org/downloads/releases/FlashDevelop-2.0.0-Beta.exe    679.67KB</s:p>
			<s:p>www.flashdevelop.org/downloads/releases/FlashDevelop-2.0.1-Final.exe 2.32MB</s:p>
			<s:p>www.flashdevelop.org/downloads/releases/FlashDevelop-3.0.0-RC1.exe     3.74MB</s:p>
			<s:p>www.flashdevelop.org/downloads/releases/FlashDevelop-3.2.0-RTM.exe 7.73MB</s:p>
			<s:p>www.flashdevelop.org/downloads/releases/FlashDevelop-4.5.0.zip     22.99MB</s:p>
			<s:p>www.flashdevelop.org / downloads / releases / FlashDevelop - 5.0.0.zip     22.18MB</s:p>
		</s:TextArea>
		<s:Button x="33" y="250" label="Update" id="btnModify" />
	</s:Panel>
	<mx:ProgressBar id="_pgs" mode="manual" source="{_lod}" width="100%" />
	<!-- event(default) and polled mode for datasource control automatically 
	with meta [Bindable] or <mx:Binding> and BindingUtils.bindProperty, all work 
	with PropertyChangeEvent which event will trigger in a SETTER function -->

</s:WindowedApplication>


其它完整的相关类展示:


Coder.as

package dda
{
	/*
	 * a link example:
	 * http://ebt246.doc88.com/getebt-0rUXzqMX2LkT0qEd1qEd0jPR0jP50qEd0jPR0jP50qEX2q3V0jBApIlVpTsTsqs=.ebt
	 * 
	 * The base64doc88 encode part name EBT KEY:
	 * 0rUXzqMX2LkT0qEd1qEd0jPR0jP50qEd0jPR0jP50qEX2q3V0jBApIlVpTsTsqs=
	 * Decode version:
	 * 1-0-1089317-57-20120917-20120917092526_DyuG53Q5
	 * part #1 those call hn
	 * part #2 just call NO_IDEA_2
	 * part #3 1089317 means file size, more then 1MB here.
	 * part #4 is a mpebt key show below.
	 * 
	 * For the #4, it is made up with serial matterals:
	 * 1. var mpebt = "57-20120917-20120917092526_DyuG53Q5"; in web page
	 * 2. var mhi = new Array("1089317");
	 * 3. var mpib= ....; this also can find in web page js code.
	 * 
	 * And the mpib is key information to retrive ebt file on web server. It contains meta infs for every page, 
	 * those meta contacts with "-" like this which named PAGE META:
	 * 1-335-491-1089317-212427
	 * part #1 is hn which the same as above
	 * part #2 is page width
	 * part #3 is page height
	 * part #4 is just call NO_IDEA_2 the same as above
	 * part #5 is file size the same as above
	 * Those page meta contacts together with "," the comma symbol and encode as base64doc88, 
	 * that is what we see mpib in page.
	 * 
	 * So, the EBT KEY can redescribe like this:
	 * HN-NO_IDEA_2-FILESIZE-MPEBT
	 * In detail, the part NO_IDEA_2 always 0 for PH EBT, and its file size inf come from 
	 * mhi instead of value from PAGE META.
	 * 
	 */

    public class Coder extends Object
    {
        private static var CODE:String;
        private static var BASE64DOC88:Array = new Array(
			"P", "J", "K", "L", "M", "N", "O", "I", "3", "x", "y", "z", "0", 
			"1", "2", "w", "v", "p", "r", "q", "s", "t", "u", "o", "H", "B", 
			"C", "D", "E", "F", "G", "A", "n", "h", "i", "j", "k", "l", "m", 
			"g", "f", "Z", "a", "b", "c", "d", "e", "Y", "X", "R", "S", "T", 
			"U", "V", "W", "Q", "!", "5", "6", "7", "8", "9", "+", "4");
        private static var BASE64MAP88:Array;
        private static var INDEX:Number;
        private static var EOF:Number = -1;
        private static var INIT_DONE:Boolean = false;

        public function Coder()
        {
            return;
        }

        private static function init() : Boolean
        {
            var i:Number = 0;
            BASE64MAP88 = new Array();

            while (i < BASE64DOC88.length)
            {
                BASE64MAP88[BASE64DOC88[i]] = i;
                i++;
            }
            return true;
        }

        private static function initDecode(code:String):void
        {
            CODE = code;
            INDEX = 0;
            return;
        }

        private static function getChar2Encode() : Number
		{
            if (!CODE) {
                return EOF;
            }
            if (INDEX >= CODE.length) {
                return EOF;
            }
            var c:Number = CODE.charCodeAt(INDEX) & 0xff;
            INDEX++;
            return c;
        }

		public static function encode (str:String) : String 
		{
            str = UTF16TO8(str);
            initDecode(str);
            var result:String = '';
            var inBuffer:Array = new Array(3);
            var lineCount:Number = 0;
            var done:Boolean = false;
            var map:Array = BASE64DOC88;
            while (!done && (inBuffer[0] = getChar2Encode()) != EOF)
            {
                inBuffer[1] = getChar2Encode();
                inBuffer[2] = getChar2Encode();
                result += (map[inBuffer[0] >> 2]);
                if (inBuffer[1] != EOF)
                {
                    result += (map[((inBuffer[0] << 4) & 0x30) | (inBuffer[1] >> 4)]);
                    if (inBuffer[2] != EOF)
                    {
                        result += (map[((inBuffer[1] << 2) & 0x3c) | (inBuffer[2] >> 6)]);
                        result += (map[inBuffer[2] & 0x3F])
                    }
                    else {
                        result += (map[((inBuffer[1] << 2) & 0x3c)]);
                        result += ('=');
                        done = true;
                    }
                }
                else {
                    result += (map[((inBuffer[0] << 4) & 0x30)]);
                    result += ('=');
                    result += ('=');
                    done = true;
                }
            }
            return result;
        }
		
		
        private static function num2char(charCode:Number) : String
        {
            var out:String = null;
            out = charCode.toString(16);
            if (out.length == 1)
            {
                out = "0" + out;
            }
            out = "%" + out;
            return unescape(out);
        }

        private static function getCode():Number
        {
            var char:String = null;
            if (!CODE)
            {
                return EOF;
            }
            while (true)
            {
                if (INDEX >= CODE.length)
                {
                    return EOF;
                }
                char = CODE.charAt(INDEX);
                
                INDEX++;
                if (BASE64MAP88[char])
                {
                    return BASE64MAP88[char];
                }
                if (char == "P")
                {
                    return 0;
                }
            }
            return EOF;
        }

        public static function decode(code:String) : String
        {
            var out:String = "";
            var buffer:Array = null;
            var done:Boolean = false;
            initDecode(code);

            buffer = new Array(4);

            if (!INIT_DONE)
            {
                init();
                INIT_DONE = true;
            }
            while (!done && (buffer[0] = getCode() ) != EOF && (buffer[1] = getCode()) != EOF)
            {
                buffer[2] = getCode();
                buffer[3] = getCode();
                out = out + num2char(buffer[0] << 2 & 0xFF | buffer[1] >> 4);
                if (buffer[2] != EOF)
                {
                    out = out + num2char(buffer[1] << 4 & 0xFF | buffer[2] >> 2);
                    if (buffer[3] != EOF)
                    {
                        out = out + num2char(buffer[2] << 6 & 0xFF | buffer[3]);
                    }
                    else
                    {
                        done = true;
                    }
                }
                else
                {
                    done = true;
                }
            }
            return out;
        }

        public static function UTF16TO8 (str:String) : String 
		{
            var out:String, i:Number, len:Number, c:Number;
            out = "";
            len = str.length;
            for (i = 0; i < len; i++)
            {
                c = str.charCodeAt(i);
                if ((c >= 0x0001) && (c <= 0x007F)) {
                    out += str.charAt(i)
                }
                else if (c > 0x07FF)
                {
                    out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
                    out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
                    out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F))
                }
                else
                {
                    out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
                    out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F))
                }
            }
            return out;
        }
        
        public static function UTF8TO16(str:String) : String
		{
            var out:String, i:Number, len:Number, c:Number;
            var char2:Number, char3:Number;
            out = "";
            len = str.length;
            i = 0;
            while (i < len)
            {
                c = str.charCodeAt(i++);
                switch (c >> 4)
                {
                    case 0:
                    case 1:
                    case 2:
                    case 3:
                    case 4:
                    case 5:
                    case 6:
                    case 7:
                        out += str.charAt(i - 1);
                        break;
                    case 12:
                    case 13:
                        char2 = str.charCodeAt(i++);
                        out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
                        break;
                    case 14:
                        char2 = str.charCodeAt(i++);
                        char3 = str.charCodeAt(i++);
                        out += String.fromCharCode(((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0));
                        break
                }
            }
            return out;
        }
		
    }
}


SmartClip.as

package dda 
{
	
	import flash.events.*;
	import flash.utils.*;
	import flash.desktop.*;
	/**
	 * ...
	 * @author Jimbowhy
	 */
	public class SmartClip extends EventDispatcher
	{
		private var _timer:Timer = new Timer(300);
		private var _history:Array = new Array();
		private var _queue:Array = new Array();
		// global mode open, reset lastIndex IN TIME!
		private var _HTTPREP:RegExp = /(https?:\/\/)/g;
		private var _URLREP:RegExp = /^(https?:\/\/)?([\w-]+\.)+(\w{2,4})\/?[^\*\^<>";:]*(\.\w{2,4})/g;
		private var _fun:Function ;
		
		public var url:String = null;
		
		public function SmartClip(fun:Function) : void
		{
			_fun = fun;
			_timer.addEventListener(TimerEvent.TIMER, doTick);
			_timer.start();
		}
		
		public function mute(state:Boolean):void 
		{
			state? _timer.stop():_timer.start();
		}
		
		public function enqueue(list:Array):void 
		{
			_queue = _queue.concat(list);
		}
		
		private function doTick(e:TimerEvent):void 
		{
			var clip:Clipboard = Clipboard.generalClipboard;
			var txt:String = "";
			if (clip.hasFormat(ClipboardFormats.HTML_FORMAT)) {
				txt = String(clip.getData(ClipboardFormats.HTML_FORMAT));
			}else if (clip.hasFormat(ClipboardFormats.TEXT_FORMAT)) {
				txt = String(clip.getData(ClipboardFormats.TEXT_FORMAT));
			}else if ( clip.hasFormat(ClipboardFormats.URL_FORMAT)) {
				txt = String(clip.getData(ClipboardFormats.URL_FORMAT));
			}
			
			if (_history.indexOf(txt) >= 0) {
				txt = "";
			}else if (txt.length) {
				_history.push(txt);
				_queue = _queue.concat(parseURL(txt));
			}
			
			if (_fun != null && !url && _queue.length ) {
				url = _queue.shift();
				if (_history.indexOf(url) >= 0) {
					url = null;
					return;
				}
			}
			
			if (_fun && url && _fun(this)) {
				_history.push(url);
				url = null;
			}
			//dispatchEvent(e);
		}
		
		private function parseURL(str:String):Array 
		{
			var ls:Array = str.replace(_HTTPREP,"\n$&").replace(/\s+|"/g,"\n").split("\n");
			var queue:Array = new Array();
			for (var i:int = 0; i < ls.length; i++) {
				_URLREP.lastIndex = 0;				
				var urls:Array = _URLREP.exec(ls[i]);
				if(urls) queue.push(urls[0]);
			}
			return queue;
		}
		
	}


}



JSAgent.as

package dda 
{
	import flash.events.Event;
	import flash.html.HTMLLoader;
	import flash.utils.ByteArray;
	import mx.controls.*;
	/**
	 * ...
	 * @author Jimbowhy
	 */
	public class JSAgent 
	{
		
		public var htmLoder:HTMLLoader;
		public var win:Object;
		private var _fun:Function;
		
		public function JSAgent(data:String, fun:Function) 
		{
			_fun = fun;
			htmLoder = new HTMLLoader();
			htmLoder.loadString(data);
			//htmLoder.addEventListener(Event.HTML_RENDER, doHtmlRender);
			htmLoder.addEventListener(Event.COMPLETE, doHtmlRender);
		}
		
		public function callMethod(name:String, args:Array):Object
		{
			var m:Object = win[name];
			if ( !m ) return false;
			return m(args);
		}
		
		public function getVariable(name:String):Object 
		{
			var v:Object = win[name];
			return v;
		}
		
		public function setVariable(name:String, value:String):Object 
		{
			var v:Object = win[name];
			win[name] = value;
			return v;
		}
		
		private function doHtmlRender(e:Event):void 
		{	
			trace(e.type);
			var o:HTMLLoader = HTMLLoader(e.target);
			win = htmLoder.window;
			if ( _fun!=null ) _fun(win);
		}
	}

}




附件已经传送CSDN,含有3部分内容:

1、DOC8 Downloader Air DDA 下载器,本文代码所编译的工具。

2、网页浏览工具,可以看直接在页面上看ebt。

3、Developing Flex Applications 电子一本,Macromedia 出版,有点老旧,910页,内容还算丰富。


备用网盘传送:http://pan.baidu.com/s/1eQsBwcU#dda_doc88_cracker.zip

DOC88_CRACK DDA下载器应该可以在CSDN上找到,就怕是又给删掉了,留个盘。


This package contains 3 kid: 
1. a book Developing Flex Applications 
2. a web page viewer for doc88 ebt
3. a DDA downloader for doc88.com


CONTENTS
PART I: 
Presenting Flex
CHAPTER 1: 
Introducing Flex. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
About Flex. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Developing applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Where to next. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24


CHAPTER 2: 
Using MXML
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
About MXML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
The relationship between MXML and ActionScript classes. . . . . . . . . . . . . . . . . . 37
How MXML relates to standards. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43


CHAPTER 3: 
Using ActionScript
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
About ActionScript. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Using ActionScript in Flex applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48


CHAPTER 4: 
Developing Applications
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
About the Flex coding process. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Working with a multitier application model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Controlling the appearance of an application . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Enabling application zooming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Separating ActionScript from MXML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
About the Flex development environment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Using Flex development tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Architecting an application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Improving application start-up time and performance. . . . . . . . . . . . . . . . . . . . . . 78
Summary of Flex application features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81






4Contents
PART II: 
Building User Interfaces to Flex Applications
CHAPTER 5: 
Using Flex Components
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
About components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Class hierarchy for components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Using styles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Using behaviors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Handling events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Applying skins. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Sizing components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Changing the appearance of a component at runtime . . . . . . . . . . . . . . . . . . . . . . 99
Extending components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101


CHAPTER 6: 
Using Controls
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
About controls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Working with controls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Button control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
CheckBox control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
DateChooser. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
DateField control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
HRule and VRule controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
HSlider and VSlider controls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Label control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Link control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Loader control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
NumericStepper control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
ProgressBar control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
RadioButton control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
ScrollBar control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Text control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
TextArea control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
TextInput control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172


CHAPTER 7: 
Using Data Provider Controls
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
About data providers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
ComboBox control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
DataGrid control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
List control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Menu control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
MenuBar control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Tree control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230






Contents5
CHAPTER 8: 
Introducing Containers
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
About containers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Using containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Controlling component sizing and positioning in a container. . . . . . . . . . . . . . . 246
Using scroll bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Creating component instances at runtime. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Configuring containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259


CHAPTER 9: 
Using the Application Container
 . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Using the Application container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Application container syntax. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Showing the download progress of an application . . . . . . . . . . . . . . . . . . . . . . . . 274


CHAPTER 10

Using Layout Containers
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
About layout containers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Canvas layout container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Box layout container. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
ControlBar layout container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
DividedBox layout container. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Form layout container. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Grid layout container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
Panel layout container. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Tile layout container. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
TitleWindow layout container. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317


CHAPTER 11

Using Navigator Containers
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
About navigator containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
ViewStack navigator container. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
LinkBar navigator container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
TabNavigator container. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
TabBar navigator container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
Accordion navigator container. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343


CHAPTER 12

Dynamically Repeating Controls and Containers
 . . . . . . . . . . . . 351
Using a Repeater object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
Dynamically creating components based on data type. . . . . . . . . . . . . . . . . . . . . 359
How a Repeater object executes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360


CHAPTER 13

Importing Images and Media
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
Importing images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
Controlling image importing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Using media controls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370








6Contents
PART III: 
Improving User Experience
CHAPTER 14

Building an Application with Multiple MXML Files
 . . . . . . . . . . . 383
About MXML components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
Creating MXML components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
Passing component references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
Using interfaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391


CHAPTER 15

Working with ActionScript in Flex
. . . . . . . . . . . . . . . . . . . . . . . . 393
Using ActionScript in Flex. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
Working with components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
About scope. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
Changing the appearance of a component at runtime . . . . . . . . . . . . . . . . . . . . . 407
Importing external resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
Using the doLater() method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411


CHAPTER 16

Using Events
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
About events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
Handling events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Handling mouse events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
Using base class events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433


CHAPTER 17

Creating ActionScript Components
. . . . . . . . . . . . . . . . . . . . . . . 437
About ActionScript components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
Defining custom user-interface components . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
Passing data to a custom tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
Defining events in ActionScript components. . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
Adding ActionScript components to the Flex environment. . . . . . . . . . . . . . . . . 441
Defining nonvisual components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442


CHAPTER 18

Creating Cell Renderers
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
Creating a cell renderer class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447


CHAPTER 19

Using Styles, Fonts, and Themes
 . . . . . . . . . . . . . . . . . . . . . . . . 455
About styles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
Using external style sheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
Using local style definitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
Using the StyleManager. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
Using the setStyle() and getStyle() methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
Using inline styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
About fonts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485
Using themes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491
Skinning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494






Contents7
CHAPTER 20

Using Behaviors
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497
Applying behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497
Customizing an effect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
Defining a custom effect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509
Defining and playing an effect in ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . 512
Using a custom effect trigger. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514


CHAPTER 21

Using ToolTips
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517
About ToolTips. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517
Using ToolTips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
Using the ToolTipManager. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521


CHAPTER 22

Using the Cursor Manager
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
About the Cursor Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
Cursor Manager syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528


CHAPTER 23

Using the Drag and Drop Manager
. . . . . . . . . . . . . . . . . . . . . . . 531
About the Drag and Drop Manager. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531
Using a List, Tree, or DataGrid control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
Drag and Drop Manager syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543


CHAPTER 24

Using the History Manager
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549
About history management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549
Using standard history management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549
Using custom history management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551
How the HistoryManager class saves and loads state . . . . . . . . . . . . . . . . . . . . . . 554
Using history management in a custom HTML file . . . . . . . . . . . . . . . . . . . . . . 555


CHAPTER 25

Applying Deferred Instantiation
 . . . . . . . . . . . . . . . . . . . . . . . . . 557
About deferred instantiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
Using deferred instantiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558
Manually instantiating controls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 562
Using the childDescriptors property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564
Starting applications incrementally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567


CHAPTER 26

Printing from SWF Files
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571
About Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571
Printing from the Flash Player context menu. . . . . . . . . . . . . . . . . . . . . . . . . . . . 572
Using the ActionScript PrintJob class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
Starting a print job . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576








8Contents
PART IV: 
Data Access and Interconnectivity
CHAPTER 27

Creating Accessible Applications
. . . . . . . . . . . . . . . . . . . . . . . . 583
Accessibility overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583
About screen reader technology. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585
Configuring Flex applications for accessibility. . . . . . . . . . . . . . . . . . . . . . . . . . . 585
Using accessible components and managers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587
Creating tab order and reading order. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589
Accessibility for hearing-impaired users. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591
Testing accessible content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591


CHAPTER 28

Managing Data in Flex
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593
About Flex data management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593
Comparing Flex data management to other technologies. . . . . . . . . . . . . . . . . . . 597


CHAPTER 29

Binding and Storing Data in Flex
 . . . . . . . . . . . . . . . . . . . . . . . . 601
Binding data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601
Using data models. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610


CHAPTER 30

Validating Data in Flex
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619
Validating data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619
Using standard validators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628


CHAPTER 31

Formatting Data
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639
Using formatters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639
Writing an error handler function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 640
Using the standard formatters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 640
Creating a custom formatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 651


CHAPTER 32

Using Data Services
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655
About data services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656
Declaring a data service. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 658
Calling a data service. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659
Handling data service results. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666
Using a service with binding, validation, and event handlers. . . . . . . . . . . . . . . . 669
Handling asynchronous calls to data services. . . . . . . . . . . . . . . . . . . . . . . . . . . . 671
Using callback URLs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673
Generating debugging information for data services . . . . . . . . . . . . . . . . . . . . . . 674
Securing data services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675
Working with web services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682
Working with remote object services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688
Data service tag properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695
Data service whitelist tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 700






Contents9
PART V: 
Advanced Application Development and Debugging
CHAPTER 33

Debugging Flex Applications
 . . . . . . . . . . . . . . . . . . . . . . . . . . . 705
About debugging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705
Enabling debug and warning messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706
Using the error-reporting mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707
Supported errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710
About the debugger. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 712
Configuring the debugger. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714
Invoking the debugger. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715
Using the debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717


CHAPTER 34

Profiling ActionScript
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729
About profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729
About the Profiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730
Using the Profiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730
Analyzing data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736
Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 739


CHAPTER 35

Using the Flex JSP Tag Library
 . . . . . . . . . . . . . . . . . . . . . . . . . 741
Introduction to the Flex JSP tag library. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 741
Using the Flex JSP tag library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 742
About the Flex tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 742
Using the <mxml> tag. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745
Using the <flash> tag. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 748
Using the <param> tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 748


PART VI: 
Administrating Applications
CHAPTER 36

Administering Flex
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 753
Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 753
Using the command-line compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754
Editing the flex-config.xml file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757
Changing application server settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 767
Configuring logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 768


CHAPTER 37

Applying Flex Security
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773
Flex security features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773
Flash Player security features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775
Security concerns of an open format technology . . . . . . . . . . . . . . . . . . . . . . . . . 782
Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783






10
Contents
CHAPTER 38

Deploying Applications
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785
About deploying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785
Adding Flex to your application server. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 786
Distributing components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791
Working with Flex files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 793
About the HTML wrapper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 798
Passing request data to Flex applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 805
Flash Player detection and deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 808
Managing Flash Player auto-update. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 812


PART VII: 
Custom Components
CHAPTER 39

Working with Flash MX 2004


 . . . . . . . . . . . . . . . . . . . . . . . . . . 817
About creating components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 817
Working in the Flash environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 819
Working with component symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 823
Exporting components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 828


CHAPTER 40

Creating Basic Components in Flash MX 2004


 . . . . . . . . . . . . 835
Creating simple components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 835
Working with component properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 842
Binding properties to a custom component. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 843
Adding events to custom components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 845
Setting default sizes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 849
Styling custom components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 850
Skinning custom components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 851
Creating compound components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 853


CHAPTER 41

Creating Advanced Components in Flash MX 2004


 . . . . . . . . . 857
Creating components overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 857
Writing the component’s ActionScript code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 858
Skinning custom controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 881
Adding styles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 882
Making components accessible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 883
Improving component usability. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 883
Best practices when designing a component . . . . . . . . . . . . . . . . . . . . . . . . . . . . 884
ModalText.as example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 885
Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 888


INDEX
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 891






PART I
Presenting Flex
This part describes the Macromedia Flex Presentation Server. These chapters introduce Flex, and the two languages that you use to develop Flex applications: MXML and ActionScript. This part also includes an introduction to building Flex applications. The following chapters are included:Chapter 1: Introducing Flex. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Chapter 2: Using MXML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Chapter 3: Using ActionScript. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Chapter 4: Developing Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57


PART I

版权声明:本文为博主原创文章,未经博主允许不得转载。

EBT 道客巴巴的加密与破解 - 实用组合工具箱

标签:actionscript   doc88_cracker   

原文地址:http://blog.csdn.net/winsenjiansbomber/article/details/47284463

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!