RE: [Flashcoders] Transparent list component

2006-12-19 Thread Andy Stone
It's a bit of a hack but it works

-Andy Stone 

//
var backAlpha = 10;
var backColor = 0xFF;
//
_global.styles.ScrollSelectList.backgroundColor = undefined;
//
mx.controls.listclasses.SelectableRow.prototype.drawRowFill =
function(mc:MovieClip, newClr:Number):Void  {
mc.clear();
if (newClr == undefined) {
mc.beginFill(backColor,  backAlpha);
} else {
mc.beginFill(newClr);
}
mc.drawRect(1, 0, this.__width, this.__height);
mc.endFill();
mc._width = this.__width;
mc._height = this.__height;
};



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rob Coenen
Sent: Tuesday, December 19, 2006 9:25 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Transparent list component

Hello gang,

what is the current status on components-with-transparent-backgrounds?
I did search the archives but and it seems people have been working on
all sorts of patches and solutions, but is there a real definitive
solution?

Never thought that putting a background image in a list view component
would be hard... :-)


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Transparent list component

2006-12-19 Thread Matt Samet
Hi,

Try this code:


_global.styles.ScrollSelectList.backgroundColor = null;

mx.controls.listclasses.SelectableRow.prototype.drawRowFill = function
(mc:MovieClip, newClr:Number):Void 
{
mc.clear();

var bgAlpha = 100; //opaque - no alpha defined

var dg = this._parent._parent;

if(dg.className.indexOf(DataGrid) != -1) //this is a DataGrid
or derived from it
{
if(dg.backgroundAlpha != undefined  dg.backgroundAlpha
!= null  
   newClr != dg.rollOverColor  
   newClr != dg.selectionColor  
   newClr != dg.selectionDisabledColor) 
 bgAlpha = dg.backgroundAlpha;
}
//otherwise, the alpha will be 100, like before

if (newClr == null) mc.beginFill(0xFF, bgAlpha); //white -
no color defined
else mc.beginFill(newClr, bgAlpha);

mc.drawRect(1, 0, this.__width, this.__height);
mc.endFill();
mc._width = this.__width;
mc._height = this.__height;
};

//this override lets us draw the background color where there are no
valid rows (instead of alternating colors)
mx.controls.listclasses.SelectableRow.prototype.getNormalColor =
function(Void):Number
{
var col;
var o = this.owner;

if ( !o.enabled ) col = o.getStyle(backgroundDisabledColor);
else 
{
//empty rows get the background color.  backgroundAlpha
is kinda weird with this...
if(this.item == undefined  o.backgroundAlpha ==
undefined) return o.getStyle(backgroundColor); 

var itemIndex = this.rowIndex + o.__vPosition;
if (this.rowIndex == undefined) col =
o.getPropertiesOf(this.item).backgroundColor;
else col = o.getPropertiesAt(itemIndex).backgroundColor;
if (col == undefined) 
{
var colArray =
o.getStyle(alternatingRowColors);
if (colArray == undefined) col =
o.getStyle(backgroundColor);
else col = colArray[itemIndex%colArray.length];
}
}
return col;
};


The first function will let you specify that a DataGrid or List has a
transparent background.  
To set a transparent background on the list or DataGrid, do:
my_list_or_grid.backgroundAlpha = value; //value = 0-100

The second function lets you draw the list background where there are no
rows present (you can omit this function if you want).

Note: for this stuff to work, make sure NOT to set backgroundColor on
the list or grid, and make sure to DO set alternatingRowColors (you can
use anything... like [0,0]).  Note that you can even use
alternatingRowColors with 1 element to simulate backgroundColor (like
[0xFF]).

-=matt


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rob
Coenen
Sent: Tuesday, December 19, 2006 6:25 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Transparent list component

Hello gang,

what is the current status on components-with-transparent-backgrounds?
I did search the archives but and it seems people have been working on
all sorts of patches and solutions, but is there a real definitive
solution?

Never thought that putting a background image in a list view component
would be hard... :-)


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com