No, you only need to define it global if you want to share it in a larger 
scope than just this handler.  So if you want to share "myBlend" in other 
handlers, or have it keep its value between visits to this handler, then it 
would be global.  Otherwise you don't have to.

Unlike some other languages where you have to declare a variable before you 
can use it, in Lingo just using a variable makes it "come to life".  It 
won't keep its value, though, after the handler exits (goes "out of 
scope").  To avoid THAT problem, make it global, but otherwise just go 
ahead and use it.

FWIW, you could also just skip the variable all together and do:

on prepareFrame
   mySprite.blend =mySprite.blend - 10
   if (mySprite.blend < 0) then mySprite.blend =0
end

That's more of a style decision, though.  If it's not too complicated I 
don't mind changing the property directly.  If it gets more involved than 
that, though, I'll personally set up a separate variable, as you did here.

- Tab


At 12:19 AM 4/9/01 +0000, N. Taylor wrote:
>To LePhuronn:
>
>So with this script, I need to define myBlend.  I had to do this:
>
>on asteranimate me
>prepareFrame
>end
>
>
>on prepareFrame
>    myBlend = mySprite.blend
>
>    myBlend = myBlend - 10
>    if myBlend < 0 then myBlend = 0
>
>    mySprite.blend = myBlend
>end
>
>My question is this (& it's a newbie question).  I need to define myBlend 
>as a global at the top?
>
>NT


[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!]

Reply via email to