Flex中image控件如何添加边框
页面代码:
<?xml version="1.0"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:marsImage="mars.display.*"
backgroundColor="#000000"
layout="absolute">
<marsImage:BorderImage
borderAlpha="{aBar.value}"
borderWidth="{wBar.value}"
borderColor="{colorTool.selectedColor}"
source="@Embed('../img/panda.jpg')"
width="258" height="229" x="180" y="62"/>
<mx:Label x="180" y="327" text="请选择边框颜色" color="#FDFDFD" fontSize="16"/>
<mx:Label x="180" y="391" text="请选择边框宽度" color="#FDFDFD" fontSize="16"/>
<mx:Label x="377" y="391" text="请选择边框透明度" color="#FDFDFD" fontSize="16"/>
<mx:ColorPicker x="305" y="327" color="#FDFDFD" id="colorTool"/>
<mx:VSlider x="525" y="255" minimum="0" maximum="1" id="aBar" />
<mx:HSlider x="180" y="423" minimum="0" maximum="6" id="wBar"/>
</mx:Application>
控件代码如下:
package mars.display
{
import mx.controls.Image;
//边框颜色
[Style(name="borderColor", type="uint", format="Color", inherit="no")]
//边框宽度
[Style(name="borderWidth", type="Number", format="Length", inherit="no")]
//边框透明度
[Style(name="borderAlpha", type="Number", format="Length", inherit="no")]
public class BorderImage extends Image
{
public function BorderImage()
{
super();
}
override protected function updateDisplayList(w:Number, h:Number):void{
super.updateDisplayList(w,h);
graphics.clear();
graphics.lineStyle(getStyle('borderWidth'),getStyle('borderColor'),getStyle('borderAlpha'),false);
var x:Number=-(getStyle('borderWidth
相关文档:
Main.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:file="file.*">
<mx:Script>
<!--[CDATA[
import simPager.PagerEvent;
import mx.collections.ArrayCollection;
[Bindable]
priv ......
--------------ex2_01_solution 选取时间-----------------------
...
private function dateChangeHandler():void
{
// The Alert.show() message displays a static string plus the selected date in the startDate control
......
常用的Flex代码总结
1.刷新浏览器
navigateToURL(new URLRequest("javascript:location.reload();"),"_self")
2.关闭浏览器
navigateToURL(new URLRequest("javascript:window.close()"),"_self");
3.打开一个新浏览器窗口
navigateToURL(new URLRequest('ht ......