At 9:55 AM -0800 12/20/01, Dennis Acton wrote:
>Hello,
>
>I have several sprites lined up one under the other on
>the stage. I put various text blocks into them so if
>one is very long, the sprite winds up overlaping the
>one below as it word-wraps down.
>
>How do I set the lower sprite to move down if the
>above sprite grows in size?
>
>I was thinking of using intersect to check if they
>touch, then running a loop that adds to the locV until
>they no longer touch.
That loop technique seems like too much work & that's only moving a
pixel at a time - try the below instead - it moves by the amount of
change & it's a single behavior that can be dropped onto a range of
sprites
1. places your sprites on stage in vertically increasing order
sprite n
sprite n+1
sprite n+2
etc.
these sprites will be in a range like 20-30 or something like that
- take note of the last one's number
2. Drop the behavior below onto those sprites
------------------------------------------------------------
property pSpriteNum, pSpr, pSprH, pLast
on beginSprite me
pSpriteNum = me.spriteNum
pSpr = sprite(pSpriteNum)
pSprH = pSpr.rect[4]-pSpr.rect[2] -- grab each sprite's height
pLast = 14 -- the number of the last sprite in MY range
-- put pSpriteNum, pSpr, pSprH, pLast
end
on enterFrame
now = pSpr.rect[4]-pSpr.rect[2]
if now <> pSprH then
-- then it HAS changed so ...
amt = now - pSprH -- get the amount of the change
pSprH = now -- save the new height
repeat with i = (pSpriteNum+1) to pLast
sprite(i).locV = sprite(i).locV + amt
end repeat
end if
end
------------------------------------------------------------
3. Change pLast to be the last sprite number in YOUR range.
hth
-Buzz
>If there are many sprites,
>though this could get complicated. Is there a better
>way to do this?
>
>Thanks as always,
>Dennis Acton
>
>__________________________________________________
>Do You Yahoo!?
>Check out Yahoo! Shopping and Yahoo! Auctions for all of
>your unique holiday gifts! Buy at http://shopping.yahoo.com
>or bid at http://auctions.yahoo.com
>
>[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!]