Ninna76
07-16-2008, 12:06 PM
hi,
- i created a new RectBorder (RectBorder.as & RectBorder.fla placed in the same folder, etc. following info from LiveDocs (http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=00002742.html), as corrected by MM tech writer)
- instead of creating a graphic manually, i wanted to draw RectBorder from code - done in the RectBorder.as file
- i created a new file (combo.fla), imported ComboBox from StandardComponents and replaced the original RectBorder (Themes/MMDefault/Border Classes) with my own
- then i converted the ComboBox to a compiled clip and copy-pasted that into a new file (test.fla)
having searched high & low i can't find the answer to this, among other things:
the combo instance doesn't populate with values (from var ComboList:Array = [...])
correction: the 0 index value is displayed, but not the following labels when the combo is in a dropdown state
the code i used for the RectBorder.as file:
import mx.core.ext.UIObjectExtensions;
import mx.styles.CSSStyleDeclaration;
class RectBorder extends mx.skins.RectBorder{
static var symbolName:String = "RectBorder";
static var symbolOwner:Object = RectBorder;
var className:String = "RectBorder";
var c = undefined;
var bw:Number = 0;
function RectBorder() {
}
function init(Void):Void {
super.init();
}
function drawBorder(Void):Void {
var z:CSSStyleDeclaration = _global.styles[className];
var d:Number = getStyle(backgroundColorName);
var w:Number = width;
var h:Number = height;
if (d == undefined) d = z[backgroundColorName];
draw3dBorder();
//rect7
if (d != undefined)
{
beginFill(d);
drawRect(5,5,w-5,h-5);
endFill();
}
}
function draw3dBorder(Void):Void {
var w:Number = width;
var h:Number = height;
//rect1
c = 0x483B42;
beginFill(c);
drawRect(0,0,w,h);
endFill();
//rect2
c = 0x71422A;
beginFill(c);
drawRect(1,1,w-1,h-1);
endFill();
//rect3
c = 0xFFCF53;
beginFill(c);
drawRect(2,2,w-2,h-2);
endFill();
//rect4
c = 0xB3843D;
beginFill(c);
drawRect(3,3,w-3,h-3);
endFill();
//rect5
c = 0x693B2B;
beginFill(c);
drawRect(4,4,w-4,h-4);
endFill();
//rect6
c = 0x73BDCE;
beginFill(c);
drawRect(5,5,w-5,h-5);
endFill();
}
// register ourselves as the RectBorder for all components to use
static function classConstruct():Boolean {
UIObjectExtensions.Extensions();
_global.styles.rectBorderClass = RectBorder;
_global.skinRegistry["RectBorder"] = true;
return true;
}
static var classConstructed:Boolean = classConstruct();
static var UIObjectExtensionsDependency = UIObjectExtensions;
}
i have no idea where things went wrong, so i'd really appreciate your help :confused:
regards
ninna
- i created a new RectBorder (RectBorder.as & RectBorder.fla placed in the same folder, etc. following info from LiveDocs (http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=00002742.html), as corrected by MM tech writer)
- instead of creating a graphic manually, i wanted to draw RectBorder from code - done in the RectBorder.as file
- i created a new file (combo.fla), imported ComboBox from StandardComponents and replaced the original RectBorder (Themes/MMDefault/Border Classes) with my own
- then i converted the ComboBox to a compiled clip and copy-pasted that into a new file (test.fla)
having searched high & low i can't find the answer to this, among other things:
the combo instance doesn't populate with values (from var ComboList:Array = [...])
correction: the 0 index value is displayed, but not the following labels when the combo is in a dropdown state
the code i used for the RectBorder.as file:
import mx.core.ext.UIObjectExtensions;
import mx.styles.CSSStyleDeclaration;
class RectBorder extends mx.skins.RectBorder{
static var symbolName:String = "RectBorder";
static var symbolOwner:Object = RectBorder;
var className:String = "RectBorder";
var c = undefined;
var bw:Number = 0;
function RectBorder() {
}
function init(Void):Void {
super.init();
}
function drawBorder(Void):Void {
var z:CSSStyleDeclaration = _global.styles[className];
var d:Number = getStyle(backgroundColorName);
var w:Number = width;
var h:Number = height;
if (d == undefined) d = z[backgroundColorName];
draw3dBorder();
//rect7
if (d != undefined)
{
beginFill(d);
drawRect(5,5,w-5,h-5);
endFill();
}
}
function draw3dBorder(Void):Void {
var w:Number = width;
var h:Number = height;
//rect1
c = 0x483B42;
beginFill(c);
drawRect(0,0,w,h);
endFill();
//rect2
c = 0x71422A;
beginFill(c);
drawRect(1,1,w-1,h-1);
endFill();
//rect3
c = 0xFFCF53;
beginFill(c);
drawRect(2,2,w-2,h-2);
endFill();
//rect4
c = 0xB3843D;
beginFill(c);
drawRect(3,3,w-3,h-3);
endFill();
//rect5
c = 0x693B2B;
beginFill(c);
drawRect(4,4,w-4,h-4);
endFill();
//rect6
c = 0x73BDCE;
beginFill(c);
drawRect(5,5,w-5,h-5);
endFill();
}
// register ourselves as the RectBorder for all components to use
static function classConstruct():Boolean {
UIObjectExtensions.Extensions();
_global.styles.rectBorderClass = RectBorder;
_global.skinRegistry["RectBorder"] = true;
return true;
}
static var classConstructed:Boolean = classConstruct();
static var UIObjectExtensionsDependency = UIObjectExtensions;
}
i have no idea where things went wrong, so i'd really appreciate your help :confused:
regards
ninna