B is smaller than A, and always within the rect of A.
when user resizes A, B shall resize proportionally. This code works:
Code: Select all
-- this handler is inside stack A
on resizeStack pNewWidth, pNewHeight, pOldWidth, pOldHeight
if within(me, the loc of stack "B") then
set the height of stack "B" to round((the height of stack "B")*pNewHeight/pOldHeight)
set the width of stack "B to round((the width of stack "B")*pNewWidth/pOldWidth)
end if
end resizeStack
I cannot get my head around how to do this. Any tips?
Many thanks
Olli.