Richie Jindal wrote:
> Yes i tried it the way u suggested also like:
> do "put list" & spritNum
>
> But it prints <VOID> as first it takes the value of
> list which is obviously void since the data is
> actually in list1, list2 and so on..
hmm, my message window shows:
-- Welcome to Director --
do "list" & 2 & "= [1,2,3,4]"
put list2
-- [1, 2, 3, 4]
do "put list" & 2
-- [1, 2, 3, 4]
perhaps your lists *are* void at that time?
> Okay more details about my goal:
>
> I parse an xml file and for every child i generate a
> sprite at runtime. Each child in my xml file has
> further subchildren with data about the child. I need
> to store this data about the child in a list which
> corresponds to the number of the sprite such as list 1
> list2 and so on.....
> Finally I store all these small lists in one main list
> so that when i click the sprite on stage i can display
> the data about it..but to do this when i click it i
> get the sprite number and from that number i need to
> retrieve the corresponding data list.
> for which i need to dynamically generate the name of
> the list by adding "list" with spritenumber.
I think I'd choose a different methodology.
I don't know if this will work for you, but what I'd do would be to have
placeholder sprites on the stage, each of which has the same behaviour
attached...
When you parse the XML file, you could use sendSprite to initialise a list
within that behaviour, eg:
sendSprite( theSpriteChannel, #setData, yourDataList )
your behaviour might look like:
--<off the top of my head>--
property pChannel
property pChildDataList
on beginSprite me
pChannel = me.spriteNum
pChildDataList = []
end
on setData me, theData
pChildDataList = theData
end
on mouseUp me
put "channel of clicked sprite:" && pChannel
put "data held by clicked sprite:" && pChildDataList
end
--</lingo>--
what happens with behaviours is that each behaviour maintains its own copy
of pChildDataList - therefore no need to generate runtime variables, and
therefore no need for 'do', which is very slow, and should be avoided if at
all possible.
hope this goes some way to helping you.
Christian
----------------------------
Christian Wach
[EMAIL PROTECTED]
----------------------------
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/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!]