Apache flex Flex 3-更改框边框颜色
我有一个看似“基本”的问题,但我就是不知道怎么做 我有一个盒子,我想改变边框的颜色。在那之前,没有什么特别的。只是一个方框。bordercolor=xxxxxx 但是,我希望顶部和底部的边框用一种颜色,左侧和右侧的边框用另一种颜色。。。这就是我被困的地方 有什么建议吗?建议 谢谢你的帮助和时间!;) 问候,, 学士学位C3Apache flex Flex 3-更改框边框颜色,apache-flex,colors,containers,border,Apache Flex,Colors,Containers,Border,我有一个看似“基本”的问题,但我就是不知道怎么做 我有一个盒子,我想改变边框的颜色。在那之前,没有什么特别的。只是一个方框。bordercolor=xxxxxx 但是,我希望顶部和底部的边框用一种颜色,左侧和右侧的边框用另一种颜色。。。这就是我被困的地方 有什么建议吗?建议 谢谢你的帮助和时间!;) 问候,, 学士学位C3 @森茨 嗨! 不幸的是,如果不让代码变得“不可理解”,我将无法共享代码 但这是一个想法。。。我们有两个主要组件:箭头按钮和导航器 ArrowButton是一个包含标签和图像
@森茨 嗨! 不幸的是,如果不让代码变得“不可理解”,我将无法共享代码 但这是一个想法。。。我们有两个主要组件:箭头按钮和导航器 ArrowButton是一个包含标签和图像的hbox(此图像是箭头尖端,它根据ArrowButton的状态而变化) Navigator是包含一系列箭头按钮的hbox。箭头按钮与其右侧的箭头按钮重叠,以创建按钮的尖端 然后围绕这些组件创建一大堆功能 我希望这有助于。。。如果您还有其他问题,请不要犹豫=)
问候。我很确定您必须创建一个新的解决方案才能完成此任务。我相信这些都是在外部程序中创建的,比如Flash Professional;但是。我敢肯定,要实现这一点,您必须创建一个。我相信这些都是在外部程序中创建的,比如Flash Professional;但是。我不认为Flex在上/下边框和左/右边框之间有任何区别。创造一个皮肤肯定是一个很好的方法。编程方法可能是使用box.graphics手动绘制边框。首先,我会尝试覆盖updateDisplayList()函数来绘制边框…我认为Flex不会对上/下边框和左/右边框进行任何区分。创造一个皮肤肯定是一个很好的方法。编程方法可能是使用box.graphics手动绘制边框。首先,我尝试覆盖updateDisplayList()函数来绘制边界…我注意到您正在询问Flex 3 SDK。皮肤是一个很好的方法。它们在Flex4中有所改变(为了更好的IMHO)。如果您想要使用Flex绘图API,那么只需将Box类扩展为如下所示的自定义类:
public class MultiColorBorderBox extends Box
{
// You could add getters/setters or constructor parameters to be able to change these values.
private var topColor:uint = 0xFF0000;
private var rightColor:uint = 0x00FF00;
private var bottomColor:uint = 0x0000FF;
private var leftColor:uint = 0xFF00FF;
private var borderWidth:Number = 20;
public function MultiColorBorderBox()
{
super();
}
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
// This just ensures you dont have content under your border
this.setStyle("paddingLeft", borderWidth);
this.setStyle("paddingRight", borderWidth);
this.setStyle("paddingTop", borderWidth);
this.setStyle("paddingBottom", borderWidth);
var g:Graphics = this.graphics; // This creates a new Graphics object and sets it to the MultiColorBorderBox graphics object. Since Box (superclass) descends from a Sprite object, it has a graphics object automatically.
g.clear();
g.moveTo(0,0); // Moves the position to the top left corner
g.lineStyle(borderWidth, topColor); // Sets the line style with the width and color
g.lineTo(unscaledWidth, 0); // Draws the top border from top left to top right corners
g.lineStyle(borderWidth, rightColor); // Changes the line style
g.lineTo(unscaledWidth, unscaledHeight); // Draws the line from top right to bottom right
g.lineStyle(borderWidth, bottomColor); //Changes the bottom border style
g.lineTo(0, unscaledHeight); // Draws the line from bottom right to bottom left
g.lineStyle(borderWidth, leftColor); // Changes the border color
g.lineTo(0,0); // Closes the box by drawing from bottom left to top left
}
我注意到您正在询问Flex3SDK。皮肤是一个很好的方法。它们在Flex4中有所改变(为了更好的IMHO)。如果您想要使用Flex绘图API,那么只需将Box类扩展为如下所示的自定义类:
public class MultiColorBorderBox extends Box
{
// You could add getters/setters or constructor parameters to be able to change these values.
private var topColor:uint = 0xFF0000;
private var rightColor:uint = 0x00FF00;
private var bottomColor:uint = 0x0000FF;
private var leftColor:uint = 0xFF00FF;
private var borderWidth:Number = 20;
public function MultiColorBorderBox()
{
super();
}
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
// This just ensures you dont have content under your border
this.setStyle("paddingLeft", borderWidth);
this.setStyle("paddingRight", borderWidth);
this.setStyle("paddingTop", borderWidth);
this.setStyle("paddingBottom", borderWidth);
var g:Graphics = this.graphics; // This creates a new Graphics object and sets it to the MultiColorBorderBox graphics object. Since Box (superclass) descends from a Sprite object, it has a graphics object automatically.
g.clear();
g.moveTo(0,0); // Moves the position to the top left corner
g.lineStyle(borderWidth, topColor); // Sets the line style with the width and color
g.lineTo(unscaledWidth, 0); // Draws the top border from top left to top right corners
g.lineStyle(borderWidth, rightColor); // Changes the line style
g.lineTo(unscaledWidth, unscaledHeight); // Draws the line from top right to bottom right
g.lineStyle(borderWidth, bottomColor); //Changes the bottom border style
g.lineTo(0, unscaledHeight); // Draws the line from bottom right to bottom left
g.lineStyle(borderWidth, leftColor); // Changes the border color
g.lineTo(0,0); // Closes the box by drawing from bottom left to top left
}
我终于做了一件很简单的事。 我想我对规格说明不够详细 实际的目的是创建一个带有箭头形状按钮的导航器。 每个按钮在被选中时都必须高亮显示。这就是航海家的样子 每个按钮实际上都是一个HBox,包含一个框(带标签)和一个图像(用于箭头),水平间距为0 我没有想过在按钮上添加一个发光过滤器。所以我试着改变盒子顶部和底部的颜色 因此,按钮中的发光过滤器工作得很好 很抱歉没有解释上下文>\<谢谢你的回答
问候。我终于做了一件很简单的事。 我想我对规格说明不够详细 实际的目的是创建一个带有箭头形状按钮的导航器。 每个按钮在被选中时都必须高亮显示。这就是航海家的样子 每个按钮实际上都是一个HBox,包含一个框(带标签)和一个图像(用于箭头),水平间距为0 我没有想过在按钮上添加一个发光过滤器。所以我试着改变盒子顶部和底部的颜色 因此,按钮中的发光过滤器工作得很好 很抱歉没有解释上下文>\<谢谢你的回答
问候。你好!谢谢你们的回答。但是,如何使用box.graphics绘制边框?我一直在调查,但没有真正弄明白。我找到了这个:但还是…@@@@@@@@如果你能启发我,那就太好了!谢谢你们的回答。但是,如何使用box.graphics绘制边框?我一直在调查,但没有真正弄明白。我找到了这个:但还是…@@@@@@@@如果你能启发我,那就太好了