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;
}
相关文档:
绑定:
举个例子: 给下面的public变量加上[Bindable]
[Bindable]
public var name:String = "";
作为一个public变量,肯定既可以被赋值,也能赋值给别的变量。绑定的作用就是,当name改变的时候(被赋值了),可能通知其它被name影响(赋值给它们)的变量发生改变。这里的“可能” ......
PopUpEffect.as
package
{
import flash.display.DisplayObject;
import mx.core.IFlexDisplayObject;
import mx.effects.Blur;
import mx.events.TweenEvent;
import mx.managers.PopUpManager;
public class PopUpEffect
{
public function PopUpE ......
原文地址:http://www.adobe.com/cn/devnet/flex/articles/itemrenderers_pt3.html
在本系列的第 2 部分中, 我向您展示了如何使用 MXML 和 ActionScript 创建外部 itemRenderer。在我用过的示例中, 有一个调度自定事件 BuyBookEvent 的 Button-这样应用程序可以对它作出响应。本文进一步讨论与 itemRenderer 的通信。
我 ......
消息服务(Message Service )提供发布(publish)/订阅(subscribe)机制允许Flex 应用程序发布消息、订阅消息终端(messaging destination),从而实现实时数据的推和协作。
一、Message Service
Message Service 提供发布(publish)/订阅(subscribe)机制允许Flex 应用程序发布消息、订阅消息终端(messaging des ......