• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1009
  • Last Modified:

How do I set a checkbox to be checked through Lingo in Director 11.5?

I've added a checkbox (the built in flash component) to the stage in my Director 11.5 movie and I can correctly test through script whether the checkbox has been checked or not through the sprite(checkbox).selected property but whenever I display this checkbox again it doesn't remember the last state.

I can set it to be checked or not checked by default in the property inspector but can't find the correct way to update the "selected" property through the script.

I have tried sprite(checkbox).selected = true/1 but this throws a syntax error since .selected is not a valid property of the sprite object.

I assume there must be a way to specify that I wish to update the .selected property of the flash object, but this is my first time using a flash object in my movie and I have been unable to figure this out.

Could somebody please point me in the right direction?

Thanks,
LLMorrisson.
0
LLMorrisson
Asked:
LLMorrisson
1 Solution
 
Chris-ChambersCommented:
Hi,

You have to wait a frame for the sprite to be initialised before setting this property.

Try the code below:

Chris.
property spriteNum
property pSprite
property pInitialized
property pLoaded

on beginSprite(me)
  pSprite = sprite(spriteNum)
  pInitialized = false
  pLoaded = false
  (the actorList).add(me)
end

on stepFrame(me)
  if (pLoaded) then
    if not(pInitialized) then
      (the actorList).deleteOne(me)
      pInitialized = true
      pSprite.selected = true
    end if
  else
    pLoaded = true
  end if
end

Open in new window

0
 
LLMorrissonAuthor Commented:
Hey Chris,

Sorry for the delay getting back to you about this, been very busy moving!

This has helped me out a great deal. Thank you for the reply.

Regards,
LLMorrisson.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now