易截截图软件、单文件、免安装、纯绿色、仅160KB

flex 滚动条问题

flex滚动条虽然很好用,但总是会出现意想不到的问题。前几天说了,拖动后花屏的问题,今天又发现了更恶心的问题。当你把容器的宽度调为100%后 ,verticalScrollbarPolicy 用默认的auto。这是如果你缩放窗口会出现滚动条,但问题这是就出现了,只要出现了垂直滚动条,水平滚动条就是被迫出现。
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*">
<mx:Canvas width="100%" height="700"/>
</mx:Application>
这是是由于flex在计算前面的百分比时,把垂直滚动条的宽度也算上了,我一开始以为是flex的bug。使其他的官方文档中写了一句很华丽的话。
"Flex considers scroll bars in its sizing calculations only if you explicitly set the scroll policy to ScrollPolicy.ON. So, if you use an auto scroll policy (the default), the scroll bar overlaps the buttons. To prevent this behavior, you can set the height property for the HBox container or allow the HBox container to resize by setting a percentage-based width. Remember that changing the height of the HBox container causes other components in your application to move and resize according to their own sizing rules."
-- from Sizing Components in the Flex 3 help, under "Using Scroll bars"
就这样回避了这个问题。但有个办法你可以解决这个问题,重载validateSize方法
// In your Application ,module or wherever you need this workaround.
override public function validateSize(recursive:Boolean = false):void {
super.validateSize(recursive);
if (!initialized) return;
if (height < measuredHeight) verticalScrollPolicy = ScrollPolicy.ON;
else verticalScrollPolicy = ScrollPolicy.OFF;
}


相关文档:

Flex [Bindable] 以及使用方法

绑定:
 举个例子: 给下面的public变量加上[Bindable]
[Bindable]
public var name:String = "";
    作为一个public变量,肯定既可以被赋值,也能赋值给别的变量。绑定的作用就是,当name改变的时候(被赋值了),可能通知其它被name影响(赋值给它们)的变量发生改变。这里的“可能” ......

Flex 二维数组实例(二种方法)

//假设二维数组为 [5][7]
var  xn:Number = 5;
var  yn:Number = 7;
//定义一数值变量
var  temp:Number = 0; //定义我们的二维数组
var  myArray:Array = new Array(); //填充二维数组
for(var  i=0;i ......

Flex中应用程序、模块之间参数传递

·   Flex中应用程序、模块之间参数传递一般有三种方式:
·   1.通过URL携带参数进行传递
·   2.通过事件进行传递
·   3.实现接口进行传递
·   其中URL传递参数时:
·   Application之间和Module之间是有区别的 ......

flex加载外部swf文件,并且互相通讯

从网上转载的,还没时间鉴定,暂记录在这里
http://blog.csdn.net/zyjasp/archive/2008/05/16/2452175.aspx
第一步:建立加载类[CtmObjLoader],此类可以加载文件类型 [图片文件或swf文件]
package
{
import flash.display.DisplayObject;
import flash.display.Loader;
import flash.events.*;
import flash. ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号