Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User mikih's Avatar
    Join Date
    Jan 2008
    Posts
    4
    Hello,

    I'm working with Flash Lite 3 final and Developer Edition on N81, N95, N95 8GB and N73. I want to store Data to the SharedObject. Its written to the SO after flushing it. But after quitting the player and restarting the app the data stored into is undefined.

    Could it be some issue with the Security Sandbox in Player 8? Do I have to install the Flash Application as a real S60 Application?

    Security option is Network only because of external socket use. Its not working in DC with testing Local Security profile.

    Does anyone have experience with that issue?

    Cheers,
    Florian

  2. #2
    Nokia Developer Champion chall3ng3r's Avatar
    Join Date
    Feb 2005
    Location
    Karachi, Pakistan
    Posts
    275
    Hi,

    If you run the swf from Inbox, the swf will not save SO data. You need to save the swf into Others folder.

    Also double check that you fully initialize the SO and access data after getting the initialize/onload event from SO.

    Code:
    function loadNick()
    {
    	loadNick_onLoad = function(so:SharedObject)
    	{
    		// debug
    		fg.write("* SO.onload() size:" + so.getSize(), 3);
    		
    		if(so.getSize() > 0)
    			nick = so.data.nick;
    		else
    			nick = "Guest";
    	}
    	
    	SharedObject.addListener("chatMX2", loadNick_onLoad);
    	var so:SharedObject = SharedObject.getLocal("chatMX2");
    }
    
    
    function saveNick(nick:String)
    {
    	var so:SharedObject = SharedObject.getLocal("chatMX2");
    	so.data.nick = nick;
    	so.flush();
    }
    In the above code, you can see that i have an even handler set on SO, so when SO is initialized and loaded, only after that you can access its data.

    hope it helps,

    // chall3ng3r //
    Faisal Iqbal (skype: chall3ng3r)
    Flash Mobile Specialist | Orison Technologies
    _____________________________________
    blog: F·L·A·S·H·I·S·M
    swf2go: www.swf2go.com

  3. #3
    Registered User mikih's Avatar
    Join Date
    Jan 2008
    Posts
    4
    Hi,

    thanks for your reply! I've done it strict with event handling and onLoad, like you do. But the objects are undefined.

    Setup:
    Code:
    SharedObject.addListener(REGISTRATION_SO, onLoadSharedObject);
    registrationSO = SharedObject.getLocal(REGISTRATION_SO);
    
    private function onLoadSharedObject() : Void {
    		Debug.finest('registrationSO.getSize(): ' + registrationSO.getSize(), this);
    		if(registrationSO.getSize() > 0) {
    			userName = registrationSO.data.userName;
    			password = registrationSO.data.password;
    		}
    		Debug.info('onLoadSharedObject: userName=' + userName + ', password=' + password, this);
    	}
    Write:
    Code:
    registrationSO = SharedObject.getLocal(REGISTRATION_SO);
    registrationSO.data.userName = event.getUserName();
    registrationSO.data.password = event.getPassword();
    registrationSO.flush();

    My swf is located in /Others/trusted/


    Tested on n95 8GB

    Florian

  4. #4
    Registered User mikih's Avatar
    Join Date
    Jan 2008
    Posts
    4
    Crazzzzzyyy! If I write a third var called test its working ;-P

  5. #5
    Nokia Developer Champion chall3ng3r's Avatar
    Join Date
    Feb 2005
    Location
    Karachi, Pakistan
    Posts
    275
    One question,

    did onLoadSharedObject() function get called after you make call to registrationSO = SharedObject.getLocal(REGISTRATION_SO);?

    if no, it should be.

    2nd thing is, try the code this way:
    Code:
    private function onLoadSharedObject(mySO:SharedObject) : Void {
    		Debug.finest('registrationSO.getSize(): ' + mySO.getSize(), this);
    		if(mySO.getSize() > 0) {
    			userName = mySO.data.userName;
    			password = mySO.data.password;
    		}
    		Debug.info('onLoadSharedObject: userName=' + userName + ', password=' + password, this);
    	}
    
    SharedObject.addListener(REGISTRATION_SO, onLoadSharedObject);
    registrationSO = SharedObject.getLocal(REGISTRATION_SO);
    try it and let me know if it worked.

    best,

    // chall3ng3r //
    Faisal Iqbal (skype: chall3ng3r)
    Flash Mobile Specialist | Orison Technologies
    _____________________________________
    blog: F·L·A·S·H·I·S·M
    swf2go: www.swf2go.com

  6. #6
    Registered User charlotteb's Avatar
    Join Date
    Sep 2008
    Posts
    3
    I just tried to use SharedObjects on a N95 as well. It did not work either and even said SharedObjects were not supported
    (I gave out System.capabilities.hasSharedObjects in a textfield)

    I do not have any clue... why doesn't my N95 support SOs? Do I have to allow them or something?

    Would be really great to get any hints...
    Thanks!

  7. #7
    Nokia Developer Champion chall3ng3r's Avatar
    Join Date
    Feb 2005
    Location
    Karachi, Pakistan
    Posts
    275
    Hi charlotteb,

    Can you tell me which FL version your testing with, and did you checked above suggestions?

    // chall3ng3r //
    Faisal Iqbal (skype: chall3ng3r)
    Flash Mobile Specialist | Orison Technologies
    _____________________________________
    blog: F·L·A·S·H·I·S·M
    swf2go: www.swf2go.com

  8. #8
    Registered User charlotteb's Avatar
    Join Date
    Sep 2008
    Posts
    3
    I'm developing Flash Lite 2.0, actually I don't know which Flashplayer the device is running, but that should be fine, isn't it? I could check if I knew where I can find that information.

    I am using the SharedObject like this:
    PHP Code:
    // load session-id from sharedObject
    function loadSessionID (so:SharedObject) {
           
    // load last session-id
        
    if (so.getSize() == 0)   { 
            
    sessionID 0;    // initialize session-counter
        
    }    
        else {
            
    sessionID so.data.session;        
        }
        
    }
    SharedObject.addListener("Sessions"loadSessionID);
    var 
    sessionSO:SharedObject SharedObject.getLocal("Sessions");
    sessionSO.scope this
    This follows the suggestions above... and it's working fine in my device central.

    Thanks.
    Last edited by charlotteb; 2008-09-05 at 14:37.

  9. #9
    Registered User charlotteb's Avatar
    Join Date
    Sep 2008
    Posts
    3
    I saved the .swf on the devices memory in the folder /other, as well.

Similar Threads

  1. Replies: 2
    Last Post: 2006-03-11, 09:29
  2. sendRedirect not working
    By nicole_yap in forum Mobile Java General
    Replies: 0
    Last Post: 2005-09-16, 03:35
  3. Working in the emulator, not working on the mobile??
    By sabb0ur in forum Mobile Web Site Development
    Replies: 2
    Last Post: 2003-08-06, 20:27
  4. 7650 / BlueUSB Bluetooth USB dongle / PC-suite not working!
    By mahaikol in forum Bluetooth Technology
    Replies: 7
    Last Post: 2002-12-28, 06:47

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved