I have a class, "Player" that with a "selectPlayer" method.
I want "selectPlayer" to automatically deselect the last selected Player
that stored in
the static variable "LAST_SELECTED".
It's imperative that I keep LAST_SELECTED data type as "Player".
I don't want give it the dynamic datatype.
Normally in AS2, I would just declare it null in class variables and
later define it during a selectPlayer like:
function selectPlayer()
{
}
[CODE]
import mx.core.UIComponent;
import mx.controls.Alert;
class Player extends UIComponent
{
private static var LAST_SELECTED:Player
public function Player():void
{
/*****
Whenever I create a new Player defining LAST_SELECTED here fixes
the Error
But I purposely don't want each new created Player to be set as
LAST_SELECTED.
******/
//I don't want this so I comment it out.
//--->Player.LAST_SELECTED=new Player();
}
private function selectPlayer():void
{
try
{
if(Player.LAST_SELECTED != this){
//Restore the last selected Player to normal scale.
Player.LAST_SELECTED.scaleX=100;
Player.LAST_SELECTED.scaleY=100;
//Assign this current Instance as the LAST_SELECTED Player.
Player.LAST_SELECTED=this;
//Set the scale to show the new selected instance .
scaleX=150;
scaleY=150;
}
}catch(e:Error){
Alert.show(e.message,e.name);
}
}
}
[/CODE]
--Keith H--
begin:vcard
n:HAIR;KEITH
fn:KEITH HAIR
version:2.1
email;internet:[EMAIL PROTECTED]
end:vcard