Urme
05-25-2007, 02:16 PM
Hi I have a Viewstack that looks like this:
<mx:ViewStack id="myViewStack" width="100%" height="100%" x="0" y="47">
<mx:Canvas id="loginUser" label="User Login" width="100%" height="100%">
<ns1:login id="compLogin" horizontalCenter="0" verticalCenter="-28.5">
</ns1:login>
</mx:Canvas>
<mx:Canvas id="start" label="Customer Info" width="100%" height="60%" borderStyle="none">
<ns1:home id="myHome" left="10" right="10" y="10" height="100%">
</ns1:home>
</mx:Canvas>
<mx:Canvas id="admin_users" label="List all users" width="100%" height="60%" borderStyle="none">
<ns1:adm_users id="admusers" left="10" right="10" y="10" height="100%">
</ns1:adm_users>
</mx:Canvas>
<mx:Canvas id="listnews" label="List news" width="100%" height="60%" borderStyle="none">
<ns1:news_list id="newslist" left="10" right="10" y="10" height="100%">
</ns1:news_list>
</mx:Canvas>
<mx:Canvas id="createnews" label="Create News" width="100%" height="60%" borderStyle="none">
<ns1:news_create id="newscreate" left="10" right="10" y="10" height="100%">
</ns1:news_create>
</mx:Canvas>
<mx:Canvas id="editnews" label="Create News" width="100%" height="60%" borderStyle="none">
<ns1:news_edit id="newsedit" left="10" right="10" y="10" height="100%">
</ns1:news_edit>
</mx:Canvas>
<mx:Canvas id="imagesnews" label="Add images" width="100%" height="60%" borderStyle="none">
<ns1:news_images id="newsimages" left="10" right="10" y="10" height="100%">
</ns1:news_images>
</mx:Canvas>
<mx:Canvas id="page4" label="Customer Info" width="100%" height="60%" borderStyle="none">
<mx:Label x="10" y="10" text="Page4" fontSize="17"/>
</mx:Canvas>
</mx:ViewStack>
My problem is that when I for example go to "List news", I load stuff from my mySQL database. With this: initialize="getNews()".
But that only happens the first time I view that page ofc, how can I get that function to run each time I switch to "List news"?
<mx:ViewStack id="myViewStack" width="100%" height="100%" x="0" y="47">
<mx:Canvas id="loginUser" label="User Login" width="100%" height="100%">
<ns1:login id="compLogin" horizontalCenter="0" verticalCenter="-28.5">
</ns1:login>
</mx:Canvas>
<mx:Canvas id="start" label="Customer Info" width="100%" height="60%" borderStyle="none">
<ns1:home id="myHome" left="10" right="10" y="10" height="100%">
</ns1:home>
</mx:Canvas>
<mx:Canvas id="admin_users" label="List all users" width="100%" height="60%" borderStyle="none">
<ns1:adm_users id="admusers" left="10" right="10" y="10" height="100%">
</ns1:adm_users>
</mx:Canvas>
<mx:Canvas id="listnews" label="List news" width="100%" height="60%" borderStyle="none">
<ns1:news_list id="newslist" left="10" right="10" y="10" height="100%">
</ns1:news_list>
</mx:Canvas>
<mx:Canvas id="createnews" label="Create News" width="100%" height="60%" borderStyle="none">
<ns1:news_create id="newscreate" left="10" right="10" y="10" height="100%">
</ns1:news_create>
</mx:Canvas>
<mx:Canvas id="editnews" label="Create News" width="100%" height="60%" borderStyle="none">
<ns1:news_edit id="newsedit" left="10" right="10" y="10" height="100%">
</ns1:news_edit>
</mx:Canvas>
<mx:Canvas id="imagesnews" label="Add images" width="100%" height="60%" borderStyle="none">
<ns1:news_images id="newsimages" left="10" right="10" y="10" height="100%">
</ns1:news_images>
</mx:Canvas>
<mx:Canvas id="page4" label="Customer Info" width="100%" height="60%" borderStyle="none">
<mx:Label x="10" y="10" text="Page4" fontSize="17"/>
</mx:Canvas>
</mx:ViewStack>
My problem is that when I for example go to "List news", I load stuff from my mySQL database. With this: initialize="getNews()".
But that only happens the first time I view that page ofc, how can I get that function to run each time I switch to "List news"?