It looks like you are using a flashComponent for your checkbox. Those are not controllable by the member... only the sprite. You can name the sprite, so your references are not numeric... When you click on the sprite, at the top of the Property Inspector (sprite tab), there is a Name field. Enter a name there and you can refer to the sprite like:
That worked just fine for me, Mike. Thanks alot!
I need to do something similar and though this was the best thread for it.
I have multiple sprites displayed and need to carry out the same task on all off them, depending on which one is 'selected'
When a sprite is clicked I need to do these:
1 -> 'Deselect' all other sprites.
-> Change the style of them like this: (I think can only be done individually)
-> Clear the contents of a list.
2. -> Change the style of only the selected sprite and add items to the list.
Is there a way to do something like this (I know this returns an error but I can't find how to do it):
Does anyone have a solution as I'd really prefer to have as few lines as possible to keep things tidier and simpler in my Lingo.
Worked out how to change labels. Pretty simple really
sprite("llist_name").labels = ["1st Item","2nd Item"]
sprite("list_name").data = ["1st Item","2nd Item"]
Try this at the top of the code:
on beginSprite me
pMemberName = sprite(spriteNum).member.name
-- then make all the sprites 'inactive' as you say. I'm not sure if you can do them all in 1 line
sprite(pMemberName).color = RGB(255,0,0) -- This will now be red
sprite(pMemberName).lineSize = 2 -- and the line will be thicker
--you can then use if and else if to have unique code run depending on which sprite is selected
if pMemberName = "Sprite1" then
--it will do the code her
else if pMemberName = "Sprite1" then
--it will do code her
Hope all that helps
You say you've got your list working to change values? Do you know how to set a default value? Thanks
Using "sendAllSprites" and a behavior is the proper way to do what you want. Paste the code below into a behavior script and attach it to all the sprites that are part of your group of sprites.
-- Group Highlight Behavior
On GetBehaviorDescription me
return "Group Highlight Behavior. "
On GetPropertyDescriptionList me
Props = [:]
Props[#pMyGroupName] = [#default:"Group01", #format:#String, #comment:"Group Name"]
Props[#pSelectColor] = [#default:rgb(255,0,0), #format:#Color, #comment:"Select color"]
Props[#pSelectLineSize] = [#default:2, #format:#integer, #Range:[#min:1, #max:10], #comment:"Select line size"]
Props[#pDeSelectColor] = [#default:rgb(0,0,0), #format:#Color, #comment:"Unselect color"]
Props[#pDeSelectLineSize] = [#default:1, #format:#integer, #Range:[#min:1, #max:10], #comment:"Unselect line size"]
on beginSprite me
pSprite = sprite(me.spriteNum)
-- setup default values
on mouseDown me
sendAllSprites(#deselect, pMyGroupName) -- 'Deselect' all other sprites with the same "Group Name".
me.select() -- Change the style of this sprite to selected.
on deselect me, GroupName
if GroupName = pMyGroupName then -- make sure this sprite is part of the group
pSprite.color = pDeSelectColor
pSprite.lineSize = pDeSelectLineSize
on select me
pSprite.color = pSelectColor
pSprite.lineSize = pSelectLineSize