Hi, Guys...
I have a setaProp question...
I have 10X5 blocks in array and the way I represent them in director is
using the list, and I have some problem now...
Two of my array is set to like this...(from the initializing function...)
Blocks list holds a value 0 being not clicked, and 1 being clicked...
spritePos list holds the number of sprite that I will need to use to swap
the images...
-----
Blocks = [\
#click00:0, #click10:0, #click20:0, #click30:0, #click40:0, #click50:0,
#click60:0, #click70:0, #click80:0, #click90:0,\
#click01:0, #click11:0, #click21:0, #click31:0, #click41:0, #click51:0,
#click61:0, #click71:0, #click81:0, #click91:0,\
#click02:0, #click12:0, #click22:0, #click32:0, #click42:0, #click52:0,
#click62:0, #click72:0, #click82:0, #click92:0,\
#click03:0, #click13:0, #click23:0, #click33:0, #click43:0, #click53:0,
#click63:0, #click73:0, #click83:0, #click93:0,\
#click04:0, #click14:0, #click24:0, #click34:0, #click44:0, #click54:0,
#click64:0, #click74:0, #click84:0, #click94:0]
spritePos = [\
#click00:1, #click10:2, #click20:3, #click30:4, #click40:5, #click50:6,
#click60:7, #click70:8, #click80:9, #click90:10,\
#click01:11, #click11:12, #click21:13, #click31:14, #click41:15,
#click51:16, #click61:17, #click71:18, #click81:19, #click91:20,\
#click02:21, #click12:22, #click22:23, #click32:24, #click42:25,
#click52:26, #click62:27, #click72:28, #click82:29, #click92:30,\
#click03:31, #click13:32, #click23:33, #click33:34, #click43:35,
#click53:36, #click63:37, #click73:38, #click83:39, #click93:40,\
#click04:41, #click14:42, #click24:43, #click34:44, #click44:45,
#click54:46, #click64:47, #click74:48, #click84:49, #click94:50]
-----
and these are functions that I am using to display the status of the blocks
either clicked or not according to the data read from the text file...(Fed
to the Symbols list)
-----
on displayButtons
global theLevel
global Symbols
global Blocks
global spritePos
x = 1
-- Clear every blocks out
repeat while x <= count(Blocks)
set varName = string(Blocks.getPropAt(x))
setBlockOff(varName, spritePos.getaProp(varName))
x = x + 1
end repeat
x = 0
-- Read the array information and put them into the Blocks array
repeat with x in Symbols[theLevel]
varName = "click" & x
setaProp Blocks, varName, 1
setBlockOn(varName, spritePos.getaProp(varName))
end repeat
end
-----
and these functions are the ones that I use to swap the members and I have a
problem with these functions...
-----
on setBlockOn varName, spriteNo
global Blocks
set the member of sprite spriteNo to member("On")
Blocks.setaProp(varName, 1) -- true
updateStage
end
on setBlockOff varName, spriteNo
global Blocks
set the member of sprite spriteNo to member("Off")
-- Blocks.setaProp(varName, 0) -- false
-- setaProp Blocks, varName, 0 -- false
Blocks[varName] = 0 -- false
updateStage
end
---
as you can see I was playing with setBlockOff function to set the value of
the Blocks list, and when I see the data from the debugger, it's actually
changing the name of the property not the value of the property...
When the process is in the second repeat loop of the displayButtons
function, it invokes setBlockOff function and the value for the Blocks list
goes like this... If you see the first item, it is written like "click00": 0
whereas the second item is written like #click10: 0
put Blocks
-- ["click00": 0, #click10: 0, #click20: 0, #click30: 0, #click40: 0,
#click50: 0, #click60: 0, #click70: 0, #click80: 0, #click90: 0, #click01:
0, #click11: 0, #click21: 0, #click31: 0, #click41: 0, #click51: 0,
#click61: 0, #click71: 0, #click81: 0, #click91: 0, #click02: 0, #click12:
0, #click22: 0, #click32: 0, #click42: 0, #click52: 0, #click62: 0,
#click72: 0, #click82: 0, #click92: 0, #click03: 0, #click13: 0, #click23:
0, #click33: 0, #click43: 0, #click53: 0, #click63: 0, #click73: 0,
#click83: 0, #click93: 0, #click04: 0, #click14: 0, #click24: 0, #click34:
0, #click44: 0, #click54: 0, #click64: 0, #click74: 0, #click84: 0,
#click94: 0]
I think these three setaProp command that I have tested are actually setting
the value of the data and the name of the data at the same time, or am I
just wasting time here with nothing??? If I am wasting time, why does
director changes #click00 into "click00"??? I don't understand...
Thank you in advance...
Jason
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
[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!]