ActionScript-3 – Add a border to the group when running in Flex

I am trying to create a group of spark types in flex at runtime. I have several buttons as children of the group at runtime. I want to add borders to all groups. However, When I use the border container, it hides all other children and things in the group container, and only shows the border container screen. How to add a border to the group.

Please note that I add it at runtime The border container serves as a sub-container of the group container.

Best wishes

You can add s: Rect sub-item as a border at a specific index.

< br /> xmlns:s="library://ns.adobe.com/flex/spark" < br /> xmlns:mx="library://ns.adobe.com/flex/mx">


import mx.graphics.SolidColorStroke; import spark.primitives.Rect; protected function addNewBorderButtonClick(event:MouseEvent):void
{
var borderRect :Rect = new Rect();
var solidStroke:SolidColorStroke = new SolidColorStroke(0, 3);
borderRect.stroke = solidStroke;
borderRect.percentWidth = borderRect.pe rcentHeight = 100; targetGroup.addElementAt(borderRect, 0);
}
]]>



width="100" height="100"
horizontalCenter="0" verticalCenter="0">

label="Add Border"
horizontalCenter="0" verticalCenter="0"
click="addNewBorderButtonClick(event)" />

Hope this helps,

Flame

I am trying to create a set of spark types in flex at runtime. I am running When using several buttons as children of the group. I want to add a border to all groups. However, when I use the border container, it hides all other children and things in the group container and only displays the border container screen. How to Add a border to the group.

Please note that I add the border container as a child container of the group container at runtime.

Best wishes

You can add s: Rect sub-item as a border at a specific index.


xmlns:s="library://n s.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">


import mx.graphics.SolidColorStroke; import spark.primitives.Rect; protected function addNewBorderButtonClick(event:MouseEvent):void
{
var borderRect:Rect = new Rect();
var solidStroke:SolidColorStroke = new SolidColorStroke(0, 3);
borderRect.stroke = solidStroke;
borderRect.percentWidth = borderRect.percentHeight = 100; targetGroup.addElementAt(borderRect, 0);
}
]]>
< br />

width="100" height= "100"
horizontalCenter="0" verticalCenter="0">

label="Add Border "
horizontalCenter="0" verticalCenter="0"
click="addNewBorderButtonClick(event)" />

< /pre>

Hope this helps,

Flame

Leave a Comment

Your email address will not be published.