>Just wondering - vList says it supports saving of an instance (ie 'obj =
>new(script "parent")) but it doesn1t' support saving a script to a vlist -
>so how exactly does an instance object get saved with vlist? Can it be
>instantiated again from a vlist?
You can save a script via member("somescript").media. When you save an
instance, as Christoffer guessed, you save a reference to the parent
script and the values of instance property variables. The parent script
has to exist when you retrieve the instances. But try this:
Original movie
-- parent script "parent"
property myProp
on new me,int
myProp = int
return me
end
on whatsYourProp me
return myProp
end
-------
Store the instances in one vList file and the parent script in another:
a = new(script "parent",8)
b = new(script "parent",10)
scr = member("parent").media
scrname = "parent"
inst = new(xtra "vlist","saveObjects.lst")
inst.write(list(a,b))
inst = new(xtra "vlist","saveParentScript.lst")
inst.write(list(scr,scrname))
-----------------------------------
Quit Director, restart, and open a brand new movie. Now read in the
vlist files, recreate the parent script first, and then read your instances
back in, with their saved property states:
inst = new(xtra "vlist","saveParentScript.lst")
var = inst.read()
scr = var[1]
scrname = var[2]
-- recreate parent script
par = new(#script)
par.media = scr
par.name = scrname
inst = new(xtra "vlist","saveObjects.lst")
var = inst.read()
-- retrieve the saved instances
a = var[1]
b = var[2]
put a.whatsYourProp()
-- 8
put b.whatsYourProp()
-- 10
----------------------------------------
Gretchen Macdowall
updateStage, inc.
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL
PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping
with programming Lingo. Thanks!]