Hi Tyagi, The information stored inside a Singleton class will be accessible in any section inside that particular application. But if you try to access it from a different SWF, it would depend on how you are loading the other SWF. Are you loading it using SWFLoader or as a module? (should be accessible here) Or are you loading it as a separate HTML object (wont work in this case)?
Read this.. maybe of some use to you... http://raghuonflex.wordpress.com/2007/08/31/swfloader-loading-multiple-apps-and-using-the-same-singletons-generates-a-rte/ Regards, Venkat www.venkatv.com On Wed, Mar 11, 2009 at 3:12 PM, tyagi <[email protected]> wrote: > > Hi.. > Regarding using a singleton class for storing information.. > I wanted to know if the values stored in a singleton are accessible > across different swf files.. > > Regards, > Tyagi > > On Mar 9, 9:01 pm, vageesh hg <[email protected]> wrote: > > Hi, > > Sorry, its still giving me zero. > > The updated value is what I get if I access the variable in the same mxml > > file in which I update the value. But if I use it in any other file I get > 0. > > > > //code I am currently using to update the uid and name value in > login.mxml > > private var myauth:LoginAuth = LoginAuth.getInstance(); > > myauth.UserName=evt.result.name; > > myauth.Userid=evt.result.userid; > > navigateToURL(new URLRequest('welcome.html'),'_self'); > > //where evt result is got by PHP > > > > //welcome.html contains > > private var auth:LoginAuth = LoginAuth.getInstance(); > > Alert.show(auth.Userid+" "+auth.UserName+""); > > > > I am getting the values 0 and NULL( ie, "") in the Alert. > > > > //LoginAuth.as declaration statements > > private static var instance:LoginAuth = new LoginAuth(); > > [Bindable] > > private var uid:Number; > > private var name:String; > > > > > > > > On Mon, Mar 9, 2009 at 6:53 PM, Flexian_me <[email protected]> > wrote: > > > > > make uid as Bindable like this - > > > > > [Bindable] > > > private var uid:Number; > > > > > I hope it'll solve .Try and reply if it works . > > > > > On Mar 9, 11:59 am, tyagi <[email protected]> wrote: > > > > Hi all, > > > > I am a newbie to flex and am currently doing a project using flex.. > > > > It involves a login module and I am using a singleton class to store > > > > the logged in user details for further reference.. But the problem I > > > > am facing is that the values of attributes of the class are not > > > > getting updated.. > > > > The singleton class code is: > > > > > > package classes{ > > > > import mx.controls.Alert; > > > > > > public final class LoginAuth{ > > > > private static var instance:LoginAuth = new > LoginAuth(); > > > > private var uid:Number; > > > > private var name:String; > > > > > > public function LoginAuth(){ > > > > uid=0; > > > > name=""; > > > > } > > > > public static function getInstance():LoginAuth{ > > > > if(instance==null){ > > > > Alert.show("wrong"); > > > > } > > > > return instance; > > > > } > > > > > > public function get Userid():Number{ > > > > return uid; > > > > } > > > > public function set Userid(value:Number):void{ > > > > uid = value; > > > > } > > > > public function get UserName():String{ > > > > return name; > > > > } > > > > public function set UserName(value:String):void{ > > > > name=value; > > > > } > > > > } > > > > > > } > > > > > > and the variable created in one of the mxml file is: > > > > private var auth:LoginAuth = LoginAuth.getInstance(); > > > > > > But the problem is if I update the 'uid' value by using > auth.Userid=2; > > > > and access that value in a different mxml page then it gives the > value > > > > as 0.. > > > > Can you please help me out with this.. > > > > Thanks in advance > > > > > > Regards, > > > > Tyagi > > > > > > On Mar 2, 11:58 am, Ramesh A <[email protected]> wrote: > > > > > > > Dear sudhi > > > > > > > declare popup file . public var PopIpSample pop; > > > > > > > create the popup window in some method when u call popup window. > > > > > > > pop= > > > > > PopIpSample (PopUpManager.createPopUp(this, PopIpSample , > > > false)); > > > > > > > then check whether the popup is open or not.. > > > > > if(pop==null) > > > > > create and open > > > > > else > > > > > nothing.. > > > > > > > try this and let me know any problem. > > > > > > > On Mon, Mar 2, 2009 at 9:37 AM, sudhi <[email protected]> wrote: > > > > > > > > Dear Anand, > > > > > > > > Thanks a lot for your reply... > > > > > > But you didn tell me why i am geting the error when i click on > > > > > > the datapoint which has already opened a nonModal popup window.. > > > > > > > > Thanks and Regards > > > > > > Sudhi > > > > Regards, > > -- > > Tyagi > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---

