A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: local shared object...work on CD?

  1. #1
    Senior Member
    Join Date
    Feb 2000
    Posts
    119

    local shared object...work on CD?

    Hello,
    I was asked today about possibility of developing a flash based quiz elearning type deal for kids to be distributed on cdrom. The main criteria is that the guy wants to be able to input the questions and answers himself, I can use xml for that but the real issue is that the quiz app needs to be able to store some data on the local machine, like username, score, etc. My guess is there is 2 or 3 ways to approach this.

    1. local shared object
    2. write to a text file
    3. write to a cookie(ok, another kind of text file)

    now, i have knocked up an example and it works great, except I just burned it to CD, and although it works fine at first glance....once I eject the CD and then pop it back in, the data gets 'lost' it seems.

    Is this a known issue or am I overlooking something. any suggestions or other ideas welcomed.

  2. #2
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    The location where shared objects are stored is mostly controlled by Flash. To avoid name collisions, Flash looks at the location of the movie that is creating the shared object (normally the host domain and directory). This is done so that shared objects with the same name will not conflict with another object with the same name created by a different movie.

    If you're using a third party projector tool, then you'll need to specify a value for the optional localpath parameter to the getLocal method. For example, use foo = sharedObject.getLocal("objectName", "/"); instead of foo = sharedObject.getLocal("objectName");.

    The localPath is an optional parameter that specifies the full or partial path to the SWF file that created the shared object. This string is used to determine where the object will be stored on the user's computer. The default value is the full path of the movie.

    With third party projector tools, your SWF file is usually unpacked to the Windows temp directory in a random directory or with a randomly chosen name. If you don't include the localpath, each instance of the exe will be looking for the shared object at a different location (because Flash uses the movie location as part of the retrieval path if you don't provide one).

    By specifying a value for the localPath (for example, using "/") you get consistent paths and each time you run the projector it will be looking for the shared object at the same location.

  3. #3
    Senior Member
    Join Date
    Feb 2000
    Posts
    119
    thanks for that insightful reply Northcode. I see what you mean now and have a better idea of why it was losing the data, I guess it was looking on the path to the cd rom.

    I thought some more about it last night after my post and ended up creating a windows installer .exe that installs the flash quiz.exe and the xml file that it dynamically loads to the %program% dir and this seemed to have solved the problem with out any further fuss and no 3rd party flash tools.

    I will experiment with your suggestion though and see how I fare. Thanks a lot for the help, by the way you have one of the finest 3rd party flash tools in my opinion, someday I will be a customer

    cheers

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