我正在使用带有自定义ImageCell类的tileList,我想隐藏M15&amp ;;背后的灰色背景。 M19按钮。我试过设置background.alpha& ImageCell类上的opaqueBackground&没有运气的TileList ......
任何帮助都将不胜感激。
edit2:为清晰起见,添加tilelist设置和整个自定义单元格渲染器......
//TileList Settings in main class
tilelist.width = 235.53;
tilelist.height = 592;
tilelist.move(14, 118);
tilelist.columnWidth = 220.53;
tilelist.rowHeight = 53;
tilelist.visible = true;
tilelist.direction = ScrollBarDirection.VERTICAL;
tilelist.setStyle("cellRenderer", UserListRenderer);
tilelist.setStyle("contentBackgroundAlpha", 0);
//Custom CellRenderer
package {
import fl.controls.listClasses.ICellRenderer;
import fl.controls.listClasses.ImageCell;
import fl.controls.TileList;
import flash.text.*;
public class UserListRenderer extends ImageCell implements ICellRenderer {
public function UserListRenderer() {
//inherit the variables from the parent
super();
//we don't want to stretch our images to fit the size of the box
loader.scaleContent = true;
//change the cursor as if this was a button
useHandCursor = true;
}
override public function set data(data:Object):void
{
super.data = data;
// Set the default skin to be invisible. This is a bit
// easier than creating a new skin, if your goal is
// to hide the white background.
this.setStyle("contentBackgroundAlpha", 0);
}
/**
* Now we override the function that draws the layout
* so we can move the image beside the text
**/
override protected function drawLayout():void
{
//adjust the icon for any existing padding
var imagePadding:Number = getStyleValue("imagePadding") as Number;
//offset the image in the box so it's not touching the top of it
loader.move(1, 0);
var h:Number = height-(imagePadding*2);*/
var w:Number = width + (imagePadding*2);
var h:Number = height + (imagePadding*2);
if (loader.width != w && loader.height != h) {
loader.setSize(w,h);
}
//re-draw the image
loader.drawNow();
//hide the original cellImage textField so we can display our new one later
textField.visible = false;
//adjust the background
background.width = width;
background.height = height;
}
}
}
答案 0 :(得分:1)
For Flex:
list.setStyle("contentBackgroundAlpha", 0)
或者如果应用程序性能至关重要,请构建自定义皮肤
对于Flash Pro:
双击舞台上的列表以更改当前外观,或创建新外观并使用
进行分配list.setStyle("skin", SkinName) //SkinName is a MovieClip in the library