A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Help needed about shared object

  1. #1
    Member
    Join Date
    Nov 2007
    Posts
    83

    Help needed about shared object

    hi, i've a problem with shared objects. i m trying to make popup window to appear only once. one of my files contains popup window's codes, other is main window's...

    popup.swf:
    Code:
    import flash.net.SharedObject;
    
    var userData:SharedObject=SharedObject.getLocal("music");
    userData.data.isOpen=1;
    userData.flush();
    userData.close();
    
    trace (userData.data.isOpen);
    main_window.swf:
    Code:
    import flash.net.URLRequest;
    import flash.net.SharedObject;
    
    var userData:SharedObject = SharedObject.getLocal("music");
    var url:String="http://www.karadenizmobilya.com.tr/swf/popup.html";
    var request:URLRequest=new URLRequest(url);
    
    
    if (userData.data.isOpen!=1) {
    	try {
    		navigateToURL (request, '_blank');
    	} catch (e:Error) {
    		trace ("error occured");
    	}
    }
    
    var_txt.text="isOpen = " + userData.data.isOpen;
    here main window file always shows "undefined" and keeps opening new window. can anyone help me?

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    You should remove the line:
    Actionscript Code:
    userData.close();
    As this method is not used for Local Shared Objects.

    And try
    Actionscript Code:
    SharedObject.getLocal("music", "/");
    (in both sWF files)
    to make sure the LSO is stored in the root folder and also accessed there as well.

  3. #3
    Member
    Join Date
    Nov 2007
    Posts
    83
    woow thanks a lot

  4. #4
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center