/* 这个IDE 2 AS主要是希望能很方便地利用FlashIDE本身的优势。尤其是在处理文本方面。相比TextField类的createTextField方法,IDE实在是太方便。然而IDE开发的轻量组件又不及AS动态生成来的灵活。于是考虑做这么一个“苦差事”,造福大家~ 用的flash8的JSFLAPI,因为8的API和2k4相比更加健全。 */ var elementArray = fl.getDocumentDOM().selection; for (var i in elementArray) { var e = elementArray[i]; if(e.elementType == "text") { convert2AS(e); } /*for (var m in e) { fl.trace(m+" "+e[m]); }*/ } function convert2AS(obj) { var nn = obj.name; var ww = Math.round(obj.width); var hh = Math.round(obj.height); var xx = Math.round(obj.left); var yy = Math.round(obj.top); var tt = obj.textType; fl.trace("initInputText(\""+nn+"\","+xx+","+yy+","+ww+","+hh+");"); //这里的initInputText是一个生成TextField的函数,姑且理解为createTextField... } /* 以下列出的是舞台text对象所具有的一些属性,我们可以读取,并产生AS代码。上面用到的就是最简单最基本的top、left、width、height elementType is: text textType is: dynamic border is: false embedRanges is: embeddedCharacters is: autoExpand is: false length is: 0 lineType is: single line maxCharacters is: 0 orientation is: horizontal renderAsHTML is: false scrollable is: false selectable is: true selectionStart is: 0 selectionEnd is: 0 textRuns is: [object TextRun] useDeviceFonts is: false variableName is: accName is: undefined description is: shortcut is: undefined tabIndex is: 0 silent is: false fontRenderingMode is: bitmap antiAliasThickness is: 0 antiAliasSharpness is: 0 name is: left is: 18 top is: 8.95 width is: 131 height is: 48 locked is: false matrix is: [object Object] depth is: 0 layer is: [object Layer] selected is: true */