在用Flex做项目的时候,一些小经验

阅读更多

http://hi.baidu.com/intercessor/blog/item/9584d84457bfbb41500ffe69.html
intercessor 写道
第一问: 如何在FLEX中做竖式导航?

答:  

 direction="horizontal" 横          direction="vertical" 竖

第二问:ToggleButtonBar时鼠标怎么变手形?

答: useHandCursor="true"

第三问:如何做一个矩形二个角圆二个角方?

答:CustomBorder.as
package
{

import mx.skins.RectangularBorder;
import flash.display.Graphics;
import mx.graphics.RectangularDropShadow;

public class CustomBorder extends RectangularBorder
{

private var dropShadow:RectangularDropShadow;

override protected function updateDisplayList
(unscaledWidth:Number, unscaledHeight:Number):void
{

super.updateDisplayList(unscaledWidth, unscaledHeight);
var cornerRadius:Number = getStyle("cornerRadius");
var backgroundColor:int = getStyle("backgroundColor");
var backgroundAlpha:Number = getStyle("backgroundAlpha");
graphics.clear();

// Background

            drawRoundRect
(
0, 0, unscaledWidth, unscaledHeight,
{tl: 0, tr:0, bl: cornerRadius, br:  cornerRadius},
backgroundColor, backgroundAlpha
);

// Shadow

            if (!dropShadow)
dropShadow = new RectangularDropShadow();

dropShadow.distance = 8;
dropShadow.angle = 45;
dropShadow.color = 0;
dropShadow.alpha = 0.4;
dropShadow.tlRadius = 0;
dropShadow.trRadius = 0;
dropShadow.blRadius = cornerRadius;
dropShadow.brRadius = cornerRadius;

dropShadow.drawShadow(graphics, 0, 0, unscaledWidth, unscaledHeight);
}

}
}

        borderSkin="CustomBorder"   MXML文件中这样

第三问:关于一些朋友问到如何通过CSS平铺背景.

答:background-image: Embed("图形", scaleGridTop="1", scaleGridBottom="2", scaleGridLeft="3", scaleGridRight="4");
backgroundSize:"100%";
注意:TOP>BOTTOM    LEFT>RIGHT
通过这个就可以实现各种需要的背景。微妙之处就在于如果针对图形设置top bottom left right的值。
 

你可能感兴趣的:(Flex,CSS,Flash,Blog,HTML)