rwilson
12-14-2008, 04:13 AM
I have several views and I currently transition using the visibility attribute. My question is how and where do I set the attribute back to false? My code sets all views to false which seems rather inelegant.
<node id="gController">
<attribute name="appstate" type="string"/>
<attribute name="currstate" type="string"/>
<handler name="onappstate" args="state">
about.setVisible(false);
home.setVisible(false);
support.setVisible(false);
switch(state)
{
case "about":
about.setVisible(true);
this.setAttribute("currstate", "about");
break;
case "home":
home.setVisible(true);
this.setAttribute("currstate", "home");
break;
case "support":
forum.setVisible(true);
this.setAttribute("currstate", "forum");
break;
default:
//Display an error message
break;
}
</handler>
</node>
<node id="gController">
<attribute name="appstate" type="string"/>
<attribute name="currstate" type="string"/>
<handler name="onappstate" args="state">
about.setVisible(false);
home.setVisible(false);
support.setVisible(false);
switch(state)
{
case "about":
about.setVisible(true);
this.setAttribute("currstate", "about");
break;
case "home":
home.setVisible(true);
this.setAttribute("currstate", "home");
break;
case "support":
forum.setVisible(true);
this.setAttribute("currstate", "forum");
break;
default:
//Display an error message
break;
}
</handler>
</node>