There are a few things I wish to mention about your script, but I will deal
with the problem at hand first...
Your script does not take into consideration that the number of steps
required to get the sprite into position may differ from the number of steps
required to size the sprite, i.e. it could take 10 steps to move the sprite
but 15 to size it.
You have set up your repeat loop to check for the BOTH conditions to be true
at the same time. If you have a different number of steps involved for the
two processes it is highly unlikely that these conditions will coincide.
Therefore the best bet would be to either:
1.) check for each process individually
or
2.) work out precisely how much to move and size the sprite over a number of
steps that you specifiy and then repeat round the loop again.
However a few more things:
Firstly you only need to specify one updateStage handler. Your code will
slow down if you update the stage every time you change a sprite property.
You can move and size the sprite in code depending on the logic that you
specify and then updateStage at the end of the script.
Secondly it is wise not to use the repeat loop format at all. Repeat loops
run at your processor speed and consume all of Director's processing power,
leaving little for any other tasks. Also different speed processors will
produce different animation rates.
Based on this, it would be best to use the prepareFrame handler to size and
move the sprite. This way the animation will run at the tempo you have
specified and does not eat up Director's processor.
As I am notorious for confusing people I try to help, I have written a new
script for you based on what I have just said. This code will move and
stretch the sprite over 10 steps. Attach this code to your button.
Of course the sprite number, location and width variables have been
hard-coded but you can easily replace them with your globals, but this is
the basic script...
-- CODE START --
property mySprite
property numSteps
property counter
property stepH, stepV, stepW
property moveStatus
-- put your globals in here
on beginSprite
mySprite = sprite(1)
targetH = 100
targetV = 100
targetW = 200
numSteps = 10
stepH = (targetH - float(mySprite.locH)) / numSteps
stepV = (targetV - float(mySprite.locV)) / numSteps
stepW = (targetW - float(mySprite.width)) / numSteps
moveStatus = #halt
counter = 1
end
on mouseUp
moveStatus = #move
end
on prepareFrame
if moveStatus = #move then
if counter > numSteps then
moveStatus = #halt
else
mySprite.loc = point(mySprite.locH + stepH, mySprite.locV + stepV)
mySprite.width = mySprite.width + stepW
counter = counter + 1
end if
end if
end
-- CODE END --
Just as a final thought after all of this, why are you tweening with Lingo
anyway? Surely it would be easier to create the animation using the scre and
then jump to the specified frame when you click the button?
[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!]