>>>>on mouseUp me
>>>>global  gMoveAmt
>>>>set myIndex  = 1
>>>>repeat while not the mouseDown
>>>>setMoveAmt  =  setAt (gMoveAmt, myIndex)
>>>>set myIndex  = myIndex +1
>>>>if myIndex > 100 then exit  repeat
>>>>end repeat
>>>>end
>>>
>>>That's a repeat loop. Not optimum, but better than the first.
>>
>>May I know where my mistake lies?
>
>Sure. I'm not sure why you're checking for the mouseDown.

The purpose of using �repeat while not the mouse Down� is so that a 
mouseDown event would interrupt the repeat  loop.

I mustn�t do this?



>If that's not relevant, this would be a bit faster:
>
>repeat with myIndex = 1 to 100
>   setMoveAmt = setAt(gMoveAmt, myIndex)
>end repeat
>



You mean write it like this:

On MouseUp me
repeat with myIndex = 1 to 100
   setMoveAmt = setAt(gMoveAmt, myIndex)
end repeat
end



>A couple of comments. You do realize that you're building a list, right?

I�m not trying to build a list, I�m trying to move sprites. Many times, I 
have difficulty trying to create what I want. It�s tough.


>Actually, that code won't work, because setAt requires 3 parameters--the
>list, the position, and the value. setMoveAmt will contain only TRUE or
>FALSE, the result of the setAt operation. Did you mean to use getAt?

Thanks for explaining. The getAt function is used to retrieve a particular 
value from a list
by specifying the position the value occupies  in that list?

I checked both  the lingo dictionary as well as Special Edition using 
Macromedia Director 8 but  they use it only in this context::

(from the Lingo Dictionary)
Example This statement causes the Message window to display the third item 
in the answers list, which consists of [10, 12, 15, 22]:

put getAt(answers, 3)
-- 15


However, I don�t think this is what you mean?


Is this the way to use the getAt function?

On MouseUp me
Repeat with myIndex = 1 to 100
gMoveAmt .getAt( )
end repeat
end



>property pMyLocH
>
>on beginSprite
>   pMyLocH = sprite(me.spriteNum).locH
>end
>
>on getMyLocH
>   return pMyLocH
>end
>
>In that example, you have one behavior, but 100 different values for
>pMyLocH--one for each sprite.



In Lingo in a Nutshell,  Pg 331, Bruce Epstein has thoroughly confused me:

�Property variables  ( beginning with the letter �p� for clarity ) are used 
instead
of  global variables. Properties are declared with the keyword  property, 
and can  contain a different value for each instance of the object (that is, 
each timer). If we used global, multiple timers would trample the values 
held in the globals.�

Do you understand what he is writing?


What is the meaning of the last line? i.e. �if we used global,�held in  the 
globals�?


Can I safely say that a property is a characteristic of an object and in 
your example  above MyLocH  is the property?


>Globals, on the other hand, are not inherently bad unless used to excess.

When is it used to excess?

>Just remember that their value will be the same no matter where you are.


Yes.
>
>>>>1.      What is the meaning of [:] ?  I notice it is used in
>>>>getPropertyDescriptionLists.
>>>
>>>That declares an empty property list.
>>
>>The purpose of declaring an  empty property list is to add items to the
>>list.  You didn't do that, you just defined  it immediately?
>
>It's always best to initialize variables.

on getPropertyDescriptionList
  if the currentSpriteNum = 0 then exit

  return \
[ \
#pMoveAmt: \
[ \
  #comment: "Distance to move? ", \
  #format:  #integer, \
  #default:  5 \
] \
]
end getPropertyDescriptionList

The [:] ensures that the variable is a property list, and that it is empty. 
If you try to add a
>property and value to an uninitialized variable, it will return an error 
>because it's not a property list.

I�m sorry, but I don�t think  you initialized variables in the example 
above?

A variable is created the first time you assign a value to it, this is  
known as initializing a variable.

When I use the getPropertyDescriptionList handler, am I going into Object 
Oriented programming?



Thanks very much

Genevieve


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


[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