Be a Supporter!

sharedObject and library class

  • 271 Views
  • 2 Replies
New Topic Respond to this Topic
Arkuni
Arkuni
  • Member since: Mar. 14, 2005
  • Offline.
Forum Stats
Member
Level 20
Blank Slate
sharedObject and library class 2009-12-12 18:19:53 Reply

Hey guys

Can't sharedObjects save my classes from the library?
Here is my problem:

import flash.net.SharedObject;
import flash.display.MovieClip;

var shared_object:SharedObject;
var bomb:MovieClip;

shared_object = SharedObject.getLocal("something");
shared_object.data.bombClip = library_bombClip; // MovieClip class in my library
shared_object.flush();

shared_object = null; // To pretend that I've now closed the game down

shared_object = SharedObject.getLocal("something");
bomb = new shared_object.data.bombClip;

This does not work! shared_object.data.bombClip is now a [object Object] instead of a [object library_bombClip]
If I did this without the "shared_object = null" (closing the game) part, then it would work.

Any solution or tricks?


Okay, okay... something funny... something funny.... hmmm.... which quote am I most likely to get away with as my own?... I KNOW!!! "I eat my own shit!" - The local homeless

Arkuni
Arkuni
  • Member since: Mar. 14, 2005
  • Offline.
Forum Stats
Member
Level 20
Blank Slate
Response to sharedObject and library class 2009-12-12 18:34:10 Reply

I forgot to add:

This is the error it throws at me:
TypeError: Error #1007: Instantiation attempted on a non-constructor.

It obviously works with the [object library_bombClip]. But after having closed the game and reloaded the cookie and the path becomes a [object Object], then it throws me the error.


Okay, okay... something funny... something funny.... hmmm.... which quote am I most likely to get away with as my own?... I KNOW!!! "I eat my own shit!" - The local homeless

henke37
henke37
  • Member since: Sep. 10, 2004
  • Offline.
Forum Stats
Member
Level 30
Blank Slate
Response to sharedObject and library class 2009-12-13 07:18:52 Reply

You need to register the class for objects if you want the class to be remembered. And I am not sure about serializing display objects, I doubt that flash can restore their content.


Each time someone abuses hittest, God kills a kitten. Please, learn real collision testing.