`

个人FLex知识库之工作笔记

阅读更多
[size=large]1、
 private function resizeComponent():void
			{
				if(detail.textHeight > detail.minHeight)
				{	
					var newHeight:int = height + detail.textHeight - detail.minHeight;
					if(newHeight <= maxHeight && newHeight >= minHeight)
						detail.height = newHeight-20;
					else
					{
						height = maxHeight-50
;
						width = maxWidth;
					}
				}
				
				PopUpManager.centerPopUp(this); 
			}

此方法是处在一个弹出窗体TileWindows中。
如果不指定TitleWindows的maxWidth与maxHeight时那么它的最大值将铺满整个屏幕;
   设置了页面的minHeight与maxHeight, 那么页面默认地实际高度并非一定是页面minHeight;但TextArea控件的默认高度确实是TextArea中指定的minHeight。

2、 数据库中查询的一个时间段为00:11:34
   然而查询到了Flex界面却变成24:11:34.Flex的时间格式...

3、 遗留问题:
使用Flex as代码来控制效果?
  一个还不错的参考网址: http://www.dnbcw.com/biancheng/flash/lxyn189059.html

另外请参考《Flex3 cookbook》中的特效章节... ...

4、
<s:HGroup width="100%" height="100%">
					<mx:Image width="56" height="56" source="@Embed('/assets/images/56/appPlatform.png')" y="20"/>
					<s:VGroup width="100%" height="100%" paddingLeft="5" paddingTop="5" paddingRight="5" paddingBottom="5" horizontalAlign="center">
						<s:Label width="100%" height="100%" verticalAlign="middle" text="{'应用平台:'+_datacenterProfile.totalApplicationPlatformCount+'个'}"/>
						<s:Label width="100%" height="100%" verticalAlign="middle" text="{'当前运行:'+_datacenterProfile.totalRunningApplicationPlatformCount+'个'}"/>
					</s:VGroup>
				</s:HGroup>

此种布局中指定Image的top属性没用... ...

尝试使用<mx:Spacer>空间, 结果发现其只是左右移动而不能上下移动,spacer是根据其组件的布局来确定是占据纵向的空间还是横向空间的吗?

  解决的办法:
<s:VGroup>
<mx:Spacer height="2"/>
<mx:Image width="56" height="56" source="@Embed('/assets/images/56/appPlatform.png')" y="40"/>
</s:VGroup>
注意此Group不设height属性或者属性值大于等于其包含的空间高度之和时, 对每一个TileGroup中元素(采用HGroup布局)右边的那个<V:Group>布局的位置会产生影响, 都会拉长... ...
寻找更好的解决方法中, 上述解决方法并非最佳的,因为空间嵌套得太深对渲染速度是有一定的影响的... ...

5、 如何监听键盘事件
  使用KeyboardEvent; 事件类型有:
KeyboardEvent.KEY_DOWN 和 KeyboardEvent.KEY_UP. 可以使用&的方式来监听组合
事件。

6、 控件双击事件无效?(记得指定doubleClickEnabled属性为true)

7、 怎么在TextArea的光标位置插入字符?
<mx:TextArea id="textEditor"  x="11" y="366" width="399"/>
private function insertString(insertStr:String):void 
{ 
    if (this.textEditor.selectionBeginIndex == 

this.textEditor.selectionEndIndex) 
    { 
        var startPart:String=this.textEditor.text.substring(0, 

this.textEditor.selectionBeginIndex); 
        var endPart:String=this.textEditor.text.substring

(this.textEditor.selectionEndIndex, this.textEditor.text.length); 
        startPart+=insertStr; 
        startPart+=endPart; 
        this.textEditor.text=startPart; 
    } 
    else 
    { 
        this.textEditor.text=insertStr; 
    } 
}

8、实现TextArea等控件时使滚动条始终保持在最下面
txt_content.verticalScrollPosition=txt_content.maxVerticalScrollPosition;

[/size]
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics