Carol, et al, While these solutions do work, they are not very clear about what is really going on. I've always felt that it is much more important to write code that can be read easily both by yourself and by others that may follow, than to try to write an obscure single line that works, but is unreadable. It is also a good goal to write code that is generic, that is, it will work in many cases.
You are basically talking about a "toggle" button - a button with two states. There are two parts to this, what you see on the screen, and the "internal" state of the button. First thing to do is to come up with a naming convention for the two states, for example "<Some base name> on" and "<Some base name> off". Given a naming convention like this, here is a start at the behavior (with minor testing): property pMemberOn property pMemberOff property pState -- TRUE for on, FALSE for off property spriteNum on beginSprite me -- First determine if we are starting in the on or off state -- and find the matching alternate state button theName = sprite(spriteNum).member.name theBaseName = word 1 of theName theCurrentState = word 2 of theName if theCurrentState = "on" then pMemberOn = sprite(spriteNum).member pMemberOff = member(theBaseName & " off") pState = TRUE else pMemberOff = sprite(spriteNum).member pMemberOn = member(theBaseName & " on") pState = 0 end if end on mouseUp me -- Now toggle the state and show the new button on the screen pState = not(pState) if pState then sprite(spriteNum).member = pMemberOn else sprite(spriteNum).member = pMemberOff end if -- now send out a special call to a sibling sprite to say that the toggle was hit. sendSprite(spriteNum, #mHitToggleButton, pState) end This way you can re-use this same behavior on every toggle button in your project. When you attach this behavior, then you need to attach another behavior to say what should be done when this button is hit. Something like this: on mHitToggleButton me, TrueOrFalse if TrueOrFalse -- do something here else -- do something else here end if end Hope this helps. Irv At 11:19 AM -0500 1/25/02, Carol Mahaffy wrote: >this worked perfectly! thanks guys for the input. Is this considered like a >"push" or "pop" in a list? I am asking that beasuse my strength is in >javascript and i would have never thought to use that logic for solving >this. thanks again guys >-- carol > >> ---------- >> From: Daniel Plaenitz >> Reply To: [EMAIL PROTECTED] >> Sent: Friday, January 25, 2002 6:30 AM >> To: [EMAIL PROTECTED]; Lingo List (E-mail) >> Subject: Re: <lingo-l> not statement >> >> At 18:32 24.01.2002 -0500, Carol Mahaffy wrote: >> >hey list -- >> >simple question.. i thought i saw something a while ago... a simple >> toggle >> >using a "not" to swap sprites but i am really getting the syntax wrong. >> can >> >anyone help? heres the code >> > >> >on mouseUp me >> > member("music_on").name = not member("music_off").name >> >end >> > >> >i know i am not calling the sprites right but i have spent a good portion >> of >> >the last 2 hours looking for where i saw the reference and have come up >> >empty. thanks >> >--carol >> >> Carol, >> >> supposed you have named the members "0" and "1" you might use a behavior >> like this one: >> >> ----------------------- >> property mySprite >> >> on beginsprite me >> mySprite = sprite(me.spritenum) >> end >> >> on mouseUp me >> mySprite.member = \ >> member(["0","1"][(not(["0","1"].getPos(mysprite.member.name)-1)+1)]) >> end >> ----------------------- >> >> best regards >> >> daniel plaenitz >> [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!] >> >> >[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!] -- Lingo / Director / Shockwave development for all occasions. (Home-made Lingo cooked up fresh every day just for you.) [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!]