You'll need a function that calculates the width of the text. For something
Lingo-based, try:

on getTextWidth psMemberName
  liLeftH = member(psMemberName).charPosToLoc(1).locH
  liRightH =
member(psMemberName).charPosToLoc(member(psMemberName).text.length + 1).locH
  return liRightH - liLeftH
end

With that value, set the locH of the other sprite to the left of the text
sprite, plus the calculated text with, plus 10.

sprite(liOtherSprite).locH = sprite(liTextSprite).left +
getTextWidth("TextMember") + 10

Of course, this works well only if you have one line of text in the text
sprite, and that text isn't wrapping.

Christopher Watson
Sr. Software Engineer
Lightspan, Inc.


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 2:20 PM
To: [EMAIL PROTECTED]
Subject: <lingo-l> aligning sprites on the fly



Ok, so I've got this movie that does all this sprite alignment stuff;
multiple member types.

I'm running into a problem with text members. ...I don't even know how to
phrase the question...

I want to be able to get the width of the text of a text sprite,
basically. The sprite's width will always be 292 whether populated with
text or not -- I want to put another sprite to the right of it (maybe
padding 10 pixels) -- so of course I'm always getting something off as the
sprite is 292, even though it's blank...or 5 chars...etc.

So what's the best way of doing this? Char count against the fontsize?


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

[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