Hey all, 

I'm trying to make a custom component which dynamically changes it's
state/appearance. Actually, it's a cell renderer/cell editor which
works with our own version of dataGrid, and creates an additional
object/changes it appearance when the cell is focused in. To this end,
I've decided to create two functions - focusInCell() and
focusOutCell() which control the creation and destruction of the
appropriate part of the components (below is an example snippet from a
component using a comboBox). This all works great, except for the fact
that it seems the player doesn't always get the size of the movie clip
right: certain components (like dateFields which have the pull down
shown) fail on hitTest() when the should pass and other components
(like combo boxes) pass on hitTest() when the should fail i.e. the
following code confuses the player regarding its size after you open
and then close the combo box ... it seems the player thinks it takes
up the expanded size and not the now-collapsed size .

To be honest, I don't know that much about createClassObject of how
Flash manages sizes and movieClips, so I could be missing something
obvious. Any help would be appreciated! Thanks!

Jim


function createChildren(Void) : Void {
super.createChildren();
createClassObject( Label, "comboLabel", 1, { styleName:this, owner:this } );
size();
}

function focusInCell() : Void {
createClassObject( ComboBox, "combo", 2, { styleName:this,
owner:this, selectable:true,editable:false, labelFunction:labelFunc }
);
combo.dataProvider = this.dataProvider;
combo.selectedIndex =
Number(ArrayUtil.linearSearchI(combo.dataProvider, valueProp,
__value));
combo.setStyle( "backgroundColor", getStyle( "selectionColor"));
combo.addEventListener( "change", this );
comboLabel.visible = false;
combo.visible = true;
size();
}

function focusOutCell() : Void { 
combo.visible = false;
comboLabel.visible = true;
destroyObject("combo");
size();
}

function size( Void ) : Void {
comboLabel.setSize( width, 20 );
combo.setSize( width, 20 );
}


Reply via email to