Jayp <[EMAIL PROTECTED]> wrote:

> if its still larger than a certain size it doest repeat the
> process....do I need some dsort of repeat loop...

Hi Jayp,

Don't use a repeat loop, use a ratio.  Presumably you also want to limit the
height.  The following handler does not work off exitFrame, so you can call
it only once, and pass a member number as a parameter.


on mSetMember(me, aMember)
  tSprite = sprite(me.spritenum)
  aMember = member(aMember)
  tSprite.member = aMember
  
  maxWidth  = 350
  maxHeight = 174
  
  tWidth  = aMember.width
  tHeight = aMember.height
  
  -- Constrain width
  if tWidth > maxWidth then
    tHeight = (tHeight * maxWidth) / tWidth
    tWidth  = maxWidth -- in other words: (tWidth * maxWidth) / tWidth
  end if
  
  -- Constrain height
  if tHeight > maxHeight then
    tWidth  = (tWidth * maxHeight) / tHeight
    tHeight = maxHeight
  end if
  
  tSprite.width  = tWidth
  tSprite.height = tHeight
end


Cheers,

James

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

Reply via email to