- 浏览: 97785 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
chensong215:
无法获取到ProgressEvent中的bytesTotal
自定义DownloadProgressBar -
qq2464785999:
非常感谢。
测试后,发现要用相对路径的话,好像要这么写
va ...
Flex写XML文件
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
viewSourceURL="src/ProgrammaticSkinning/index.html"
>
<mx:VBox
borderSkin="CustomBorder"
backgroundColor="0xCCCC99"
backgroundAlpha="0.8"
cornerRadius="14"
paddingLeft="20" paddingTop="20"
paddingRight="20" paddingBottom="20"
>
<mx:Text text="The VBox has a {'\r'}programmatic skin."/>
</mx:VBox>
</mx:Application>
package itemRender
{
import flash.display.Graphics;
import flash.geom.Rectangle;
import mx.charts.ChartItem;
import mx.charts.chartClasses.GraphicsUtilities;
import mx.charts.series.ColumnSeries;
import mx.charts.series.items.ColumnSeriesItem;
import mx.collections.ArrayCollection;
import mx.controls.Text;
import mx.core.IDataRenderer;
import mx.core.UIComponent;
import mx.graphics.IFill;
import mx.graphics.IStroke;
import mx.graphics.SolidColor;
import mx.styles.StyleManager;
import mx.utils.ColorUtil;
public class MyCol extends UIComponent implements IDataRenderer
{
private var _data:Object;
private var l:Text ;
[Inspectable(environment="none")]
/**
* The chartItem that this itemRenderer is displaying.
* This value is assigned by the owning series
*/
public function get data():Object
{
return _data;
}
protected function get showOtherLabel():Boolean{
return true;
}
private function getMMvalue(arr:ArrayCollection,yField:String):Array{
var max:Number=Number.NEGATIVE_INFINITY;
var min:Number=Number.POSITIVE_INFINITY;
for each(var obj:Object in arr){
if(!isNaN(Number(obj[yField]))){
max = Math.max(max,Number(obj[yField]));
min = Math.min(min,Number(obj[yField]));
}
}
return [max,min];
}
protected function get colors():Array{
return ["#008654","#d80000","#B600CC"];
}
private function getColor(max:Boolean=false,min:Boolean=false):String{
var c:String= colors[0];
if(max)
c= colors[1];
else if(min)
c= colors[2];
return c;
}
/**
* @private
*/
public function set data(value:Object):void
{
if (_data == value)
return;
_data = value;
if(value is ColumnSeriesItem){
if(l&&this.contains(l))
this.removeChild(l);
var csi:ColumnSeriesItem = ColumnSeriesItem(_data);
var cs:ColumnSeries = ColumnSeries(csi.element);
var arr:ArrayCollection = cs.dataProvider as ArrayCollection;
var m:Array=getMMvalue(arr,cs.yField);
var max:Boolean = Number(csi.yValue)==m[0];
var min:Boolean = Number(csi.yValue)==m[1];
if(max||min||(arr.length<13&&showOtherLabel)){
l= new Text();
if(max||min)
l.setStyle("fontWeight","bold");
this.addChild(l);
if((value as ColumnSeriesItem).yValue)
l.text= (value as ColumnSeriesItem).yValue.toString();//data label 标签会截掉最后一位,临时处理
l.setStyle("color",getColor(max,min));
l.setStyle("fontSize","14");
}
}
}
//--------------------------------------------------------------------------
//
// Overridden methods
//
//--------------------------------------------------------------------------
/**
* @private
*/
override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void
{
var fill:IFill;
var state:String = "";
if(_data is ChartItem && _data.hasOwnProperty('fill'))
{
state = _data.currentState;
fill = _data.fill;
}
else
fill = GraphicsUtilities.fillFromStyle(getStyle('fill'));
var color:uint;
var adjustedRadius:Number = 0;
switch(state)
{
case ChartItem.FOCUSED:
case ChartItem.ROLLOVER:
if(StyleManager.isValidStyleValue(getStyle('itemRollOverColor')))
color = getStyle('itemRollOverColor');
else
color = ColorUtil.adjustBrightness2(GraphicsUtilities.colorFromFill(fill),-20);
fill = new SolidColor(color);
adjustedRadius = getStyle('adjustedRadius');
if(!adjustedRadius)
adjustedRadius = 0;
break;
case ChartItem.DISABLED:
if(StyleManager.isValidStyleValue(getStyle('itemDisabledColor')))
color = getStyle('itemDisabledColor');
else
color = ColorUtil.adjustBrightness2(GraphicsUtilities.colorFromFill(fill),20);
fill = new SolidColor(GraphicsUtilities.colorFromFill(color));
break;
case ChartItem.FOCUSEDSELECTED:
case ChartItem.SELECTED:
if(StyleManager.isValidStyleValue(getStyle('itemSelectionColor')))
color = getStyle('itemSelectionColor');
else
color = ColorUtil.adjustBrightness2(GraphicsUtilities.colorFromFill(fill),-30);
fill = new SolidColor(color);
adjustedRadius = getStyle('adjustedRadius');
if(!adjustedRadius)
adjustedRadius = 0;
break;
}
var stroke:IStroke = getStyle("stroke");
var w:Number = stroke ? stroke.weight / 2 : 0;
var rc:Rectangle = new Rectangle(w - adjustedRadius, w - adjustedRadius, width - 2 * w + adjustedRadius * 2, height - 2 * w + adjustedRadius * 2);
var g:Graphics = graphics;
g.clear();
g.moveTo(rc.left,rc.top);
if (stroke)
stroke.apply(g,rc,null);
if (fill)
fill.begin(g,rc,null);
//圆角矩形
g.drawRoundRect(w - adjustedRadius,
w - adjustedRadius, width - 2 * w + adjustedRadius * 2,
height - 2 * w + adjustedRadius * 2,15);
// g.lineTo(rc.right,rc.top);
// g.lineTo(rc.right,rc.bottom);
// g.lineTo(rc.left,rc.bottom);
// g.lineTo(rc.left,rc.top);
if (fill)
fill.end(g);
if(l){
l.setActualSize(l.textWidth+25,l.textHeight);
l.move(-9,0-l.height);
}
}
}
}
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
viewSourceURL="src/ProgrammaticSkinning/index.html"
>
<mx:VBox
borderSkin="CustomBorder"
backgroundColor="0xCCCC99"
backgroundAlpha="0.8"
cornerRadius="14"
paddingLeft="20" paddingTop="20"
paddingRight="20" paddingBottom="20"
>
<mx:Text text="The VBox has a {'\r'}programmatic skin."/>
</mx:VBox>
</mx:Application>
package itemRender
{
import flash.display.Graphics;
import flash.geom.Rectangle;
import mx.charts.ChartItem;
import mx.charts.chartClasses.GraphicsUtilities;
import mx.charts.series.ColumnSeries;
import mx.charts.series.items.ColumnSeriesItem;
import mx.collections.ArrayCollection;
import mx.controls.Text;
import mx.core.IDataRenderer;
import mx.core.UIComponent;
import mx.graphics.IFill;
import mx.graphics.IStroke;
import mx.graphics.SolidColor;
import mx.styles.StyleManager;
import mx.utils.ColorUtil;
public class MyCol extends UIComponent implements IDataRenderer
{
private var _data:Object;
private var l:Text ;
[Inspectable(environment="none")]
/**
* The chartItem that this itemRenderer is displaying.
* This value is assigned by the owning series
*/
public function get data():Object
{
return _data;
}
protected function get showOtherLabel():Boolean{
return true;
}
private function getMMvalue(arr:ArrayCollection,yField:String):Array{
var max:Number=Number.NEGATIVE_INFINITY;
var min:Number=Number.POSITIVE_INFINITY;
for each(var obj:Object in arr){
if(!isNaN(Number(obj[yField]))){
max = Math.max(max,Number(obj[yField]));
min = Math.min(min,Number(obj[yField]));
}
}
return [max,min];
}
protected function get colors():Array{
return ["#008654","#d80000","#B600CC"];
}
private function getColor(max:Boolean=false,min:Boolean=false):String{
var c:String= colors[0];
if(max)
c= colors[1];
else if(min)
c= colors[2];
return c;
}
/**
* @private
*/
public function set data(value:Object):void
{
if (_data == value)
return;
_data = value;
if(value is ColumnSeriesItem){
if(l&&this.contains(l))
this.removeChild(l);
var csi:ColumnSeriesItem = ColumnSeriesItem(_data);
var cs:ColumnSeries = ColumnSeries(csi.element);
var arr:ArrayCollection = cs.dataProvider as ArrayCollection;
var m:Array=getMMvalue(arr,cs.yField);
var max:Boolean = Number(csi.yValue)==m[0];
var min:Boolean = Number(csi.yValue)==m[1];
if(max||min||(arr.length<13&&showOtherLabel)){
l= new Text();
if(max||min)
l.setStyle("fontWeight","bold");
this.addChild(l);
if((value as ColumnSeriesItem).yValue)
l.text= (value as ColumnSeriesItem).yValue.toString();//data label 标签会截掉最后一位,临时处理
l.setStyle("color",getColor(max,min));
l.setStyle("fontSize","14");
}
}
}
//--------------------------------------------------------------------------
//
// Overridden methods
//
//--------------------------------------------------------------------------
/**
* @private
*/
override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void
{
var fill:IFill;
var state:String = "";
if(_data is ChartItem && _data.hasOwnProperty('fill'))
{
state = _data.currentState;
fill = _data.fill;
}
else
fill = GraphicsUtilities.fillFromStyle(getStyle('fill'));
var color:uint;
var adjustedRadius:Number = 0;
switch(state)
{
case ChartItem.FOCUSED:
case ChartItem.ROLLOVER:
if(StyleManager.isValidStyleValue(getStyle('itemRollOverColor')))
color = getStyle('itemRollOverColor');
else
color = ColorUtil.adjustBrightness2(GraphicsUtilities.colorFromFill(fill),-20);
fill = new SolidColor(color);
adjustedRadius = getStyle('adjustedRadius');
if(!adjustedRadius)
adjustedRadius = 0;
break;
case ChartItem.DISABLED:
if(StyleManager.isValidStyleValue(getStyle('itemDisabledColor')))
color = getStyle('itemDisabledColor');
else
color = ColorUtil.adjustBrightness2(GraphicsUtilities.colorFromFill(fill),20);
fill = new SolidColor(GraphicsUtilities.colorFromFill(color));
break;
case ChartItem.FOCUSEDSELECTED:
case ChartItem.SELECTED:
if(StyleManager.isValidStyleValue(getStyle('itemSelectionColor')))
color = getStyle('itemSelectionColor');
else
color = ColorUtil.adjustBrightness2(GraphicsUtilities.colorFromFill(fill),-30);
fill = new SolidColor(color);
adjustedRadius = getStyle('adjustedRadius');
if(!adjustedRadius)
adjustedRadius = 0;
break;
}
var stroke:IStroke = getStyle("stroke");
var w:Number = stroke ? stroke.weight / 2 : 0;
var rc:Rectangle = new Rectangle(w - adjustedRadius, w - adjustedRadius, width - 2 * w + adjustedRadius * 2, height - 2 * w + adjustedRadius * 2);
var g:Graphics = graphics;
g.clear();
g.moveTo(rc.left,rc.top);
if (stroke)
stroke.apply(g,rc,null);
if (fill)
fill.begin(g,rc,null);
//圆角矩形
g.drawRoundRect(w - adjustedRadius,
w - adjustedRadius, width - 2 * w + adjustedRadius * 2,
height - 2 * w + adjustedRadius * 2,15);
// g.lineTo(rc.right,rc.top);
// g.lineTo(rc.right,rc.bottom);
// g.lineTo(rc.left,rc.bottom);
// g.lineTo(rc.left,rc.top);
if (fill)
fill.end(g);
if(l){
l.setActualSize(l.textWidth+25,l.textHeight);
l.move(-9,0-l.height);
}
}
}
}
发表评论
-
flex 自定义多个命名空间以及标签名
2013-01-22 15:21 1266flex 自定义多个命名空 ... -
FLEX中使用AS动态创建DataGrid
2013-01-09 16:24 883FLEX中使用AS动态创建DataGrid 2010年2月6日 ... -
flex与flash之间相互调用
2012-12-12 12:39 610http://www.cnblogs.com/kaixuan/ ... -
Flex与Flex创建的swf通信
2012-12-12 10:16 703加载子SWF的Flex程序代码 <?xml vers ... -
[AS3]加载视频(FLV)文件
2012-12-06 15:11 847[AS3]加载视频(FLV)文件 分类: FLEX/CS3-- ... -
通过FileReference打开本地图片崩溃的解决方法
2012-12-06 14:02 705通过FileReference打开本地图片崩溃的解决方法 最近 ... -
使用FileReference的load()方法加载本地图片
2012-12-06 13:56 8951、要想使用FileReference的load()方法和da ... -
[AS3]Bitmap序列化(将BitmapData保存为原生Binary/ByteArray)
2012-12-06 13:48 748[AS3]Bitmap序列化(将BitmapData保存为原生 ... -
as3 画五角星算法
2012-12-05 16:49 2594as3 画五角星算法 阅读:10次 时间:2012-03- ... -
flex嵌入完整html
2012-11-29 11:18 797有时候我们需要在Flex应用中嵌入HTML代码,根据嵌入HTM ... -
flex4 textArea的htmlText属性
2012-11-29 11:13 3097它现在包含Text布局框架(Text Layout Frame ... -
Tooltip应用
2012-11-29 11:11 699创建ToolTip: var errorToolTip:To ... -
数据绑定显示问题
2012-10-27 12:11 629数据绑定实时变化。 XMLListCollection 可以变 ... -
待解决问题
2012-09-18 23:48 6891.仪表盘 2.渐变填充的使用 3.发光效果的完美运用 能在一 ... -
as3加载外部图片的两种方式
2012-09-09 11:46 985package net.burchin.loading { ... -
公式as3
2012-09-06 18:13 0as3 1人收藏此文章, 我要收藏 发表于1年前(2011-0 ... -
Flex中多线程的实现
2012-09-06 10:49 3465破阵子_如是我闻 如是我闻。一时佛在舍卫国,祗树给孤独园.. ... -
drowshadowFilter
2012-08-09 15:05 648DropShadowFilter 类,在Flash中为各种对象 ... -
123123
2012-08-08 17:16 0http://www.oschina.net/code/sni ... -
flex 画面快照截图与显示
2012-08-08 11:32 1036一、对指定画面进行快 ...
相关推荐
winform里面自带的menuStrip样式很难看,在网上搜集了很多资料,总算是勉勉强强写了一个,不敢独享,拿上来分享一下。菜鸟之作,还请大家见谅。
1. JSF生命周期与组件概述 1.1 JSF生命周期 1.2 概述自定义组件 2. 简单实例 2.1 编码、解码 2.2 组件标签 2.3 使用自定义组件 2.4 自定义Renderer
非常好用的插件,最新版PDF Renderer,可读取PDF文档中的文字以及图片
线渲染器 (Line Renderer) 组件采用 3D 空间中两个或多个点的数组,在每个点之间绘制一条直线。可以使用线渲染器 (Line Renderer) 来绘制从简单直线到复杂螺旋线的任何线条。 这条线始终是连续的;如果需要绘制两条...
pdf-renderer.jar
在不减慢游戏速度的情况下渲染...Nature Renderer通过替换Unity的默认地形细节系统来改善你的植被渲染质量。一切都与你现有的数据一起工作:使用相同的草地、植被和树木,并保持你现有的地形。我们只是升级你的渲染器。
core-renderer.jar core-renderer.jar
Line Renderer的位置
VR Panorama 360 PRO Renderer v2.9.zip
PDF Renderer 是迄今为止在 Unity 中渲染 PDF 文件最简单、最可靠的方法。 它经过专门的构建,能够在多个平台上的 Unity 中在运行时(游戏中)读取和可视化 PDF 文件。 它只需几秒钟即可集成到任何项目中,并且...
Unity LineRenderer 连线功能示例工程,Unity版本2020.3.16
PDFRenderer
PDFRenderer 0.9.1 full release. Includes classes jar, source, javadoc API and additional material.
Unity 读取PDF文件插件
PDFRenderer-0.9.0.jar java将pdf转换成图片工具类,稳定版本,==========本人亲试,可以放心下载O(∩_∩)O哈哈~=========
Unity-LineRenderer显示一条线
可顺利安装neural_renderer库,解决了一大串的红色错误,错误应该是库的版本导致的,各个库的版本不一致,然后这个库的作者也不太靠谱。。。
PDF Renderer v5.16
PDFRenderer插件可以在Unity中轻松读取PDF文件,功能强大,可以开发更多想要的功能