PDA

View Full Version : List component blinking image


adydas
07-22-2006, 01:30 AM
I am loading images into list component items using a custom CellRenderer and when I rollover the items the image blinks. Just wondering if anyone knew what the cause of this could be? A list component style I can edit perhaps?

adydas
07-24-2006, 08:24 PM
No one has any insight into this? :)

Xeef
07-24-2006, 08:39 PM
we need to see how you have setup the cellrenderer

adydas
07-24-2006, 08:50 PM
Here's what I've got



import mx.controls.List;

class PlayerCell extends mx.core.UIComponent {

// Declare a text field property to display the label.
private var _tLabel:TextField;

// Declare a movie clip property to display the icon.
private var _mImage:MovieClip;

// Declare a movie clip property to display the icon.
private var _mVline:MovieClip;
private var _mHline:MovieClip;

// Declare a movie clip property to display the icon.
private var _id:String;



// Declare the "inherited" methods and properties.
private var listOwner:List;
private var owner:MovieClip;
private var getCellIndex:Function;
private var getDataLabel:Function;


function PlayerCell() {
}

function createChildren():Void
{

// Create the movie clip to display the icon.
createEmptyMovieClip("_mImage", 1);
createEmptyMovieClip("_mVline", 3);
createEmptyMovieClip("_mHline", 4);


// Create the text field to display the label.
createTextField("_tLabel", 2, 105, 0, 90, 100);

with (this._tLabel) {
autoSize = "none";
selectable = false;
multiline = true;
wordWrap = true;
}


/*
this.onRelease = function():Void{

var nIndex:Number = getCellIndex().itemIndex;
var sURL:String = listOwner.dataProvider.getItemAt(nIndex).link;
getURL(sURL,"_new");

}


this.onRollOver = function():Void{
this._alpha = 50;

}

this.onRollOut = function():Void{
this._alpha = 100;

}

*/


}


// For preferred width and height use the row's width and height.
public function getPreferredWidth():Number {
return owner.width;
}

public function getPreferredHeight():Number {
return owner.height;
}

// You don't need any implementation for setSize() since changing the
// dimensions of the parent component won't affect the cell other than to
// possibly crop it.
public function setSize(nWidth:Number, nHeight:Number):Void {

}

public function setValue(sLabel:String, oItem:Object, sState:String):Void {

// Display the label in the text field.
_tLabel.text = sLabel;

// Apply the text formatting from the List.
_tLabel.setTextFormat(listOwner._getTextFormat());

// Get the icon field value from the data provider element.
var nIndex:Number = getCellIndex().itemIndex;
var sImage:String = listOwner.dataProvider.getItemAt(nIndex).image;
var slinev:String = listOwner.dataProvider.getItemAt(nIndex).linev;
var slineh:String = listOwner.dataProvider.getItemAt(nIndex).lineh;

// Load image and move it to the left.
_mImage.loadMovie(sImage);
_mImage._x = 0;
_mImage._y = 0;

_mVline.attachMovie(slinev,"linev", 3);
_mVline._x = 99;

_mHline.attachMovie(slineh,"lineh", 4);
_mHline._x = 0;
_mHline._y = 100;



}

}

Xeef
07-24-2006, 09:03 PM
if i am not wrong (Hmmm i coud by)

is "public function setValue()" called EACH time you rollover the item or on a list refresh by any other means

so you REattaching and REloading your clips each time such an event acure
thats the blinking
put some check in there so that you load/attach it just ones