J'ai un cours comme celui-ci. La propriété "isPag" est basée sur le fichier "ecboardid", j'ai trouvé que lorsque l'ecboardid est modifié, les contrôles de l'interface utilisateur ne semblent pas capables de détecter que "isPag" est également modifié. Alors, comment faire une propriété comme celle-ci?Comment rendre une propriété lisible?
[Bindable]
public class Encoder extends EventDispatcher
{
public var ecboardid : String;
/*-.........................................Methods..........................................*/
public function copyFrom(newEncoder:Encoder):void
{
ecboardid = newEncoder.ecboardid;
this.dispatchEvent(new Event('isPagChanged'));
}
[Bindable (event="isPagChanged")]
public function get isPag():Boolean
{
if(this.ecboardid != null)
{
if(this.ecboardid.search('xxx') != -1)
{
return false;
}
return true;
}
else
{
return false;
}
}
}
Edit:
Si je change la propriété à une fonction statique,
[Bindable]
public class Encoder extends EventDispatcher
{
public var ecboardid : String;
/*-.........................................Methods..........................................*/
public function copyFrom(newEncoder:Encoder):void
{
ecboardid = newEncoder.ecboardid;
this.dispatchEvent(new Event('isPagChanged'));
}
public static function isPag(String ecboardid):Boolean
{
if(ecboardid != null)
{
if(ecboardid.search('xxx') != -1)
{
return false;
}
return true;
}
else
{
return false;
}
}
}
lierez comme ceci:
visible = {Encoder.isPag(encoder.ecboardid)}
travail? Est-ce que le changement visible changera quand encoder.ecboardid changera?