Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Text Services API
Xtra Checker
Thumbnail Searching
Rollover Sound
Bouncing Ball
Importing Externally Linked (sound&bitmap) Files
Change the Pattern of a Shape Sprite
Find out which cast members use a given font
Blend Mode Algorithms - Imaging Lingo
Director 8 and Lingo Bible
MediaMacros Xtras Mall
 

 

 

Behavior Final text box resizer for text members

Added on 10/4/2001

 

Compatibilities:
behavior D7 D8 D8_5 Mac PC Shockwave

This item has not yet been rated

Author: psychicparrot (website)

Resizes the width and height of a text members bounding box. Faster and smoother than before. Final version. I promise.

-- Dynamic bounding text box adjustment behaviour v3final
--
-- By Jeff Murray March 14th 2001 / v2 July 12th 2001 / v3 October 4th 2001
--
-- http://www.psychicparrot.com
--
--
-- just drop this behaviour onto a text sprite that you want to resize dynamically and change the
-- TargetMem variable (make a bitmap cast member - just a single pixel will do - then use the
-- member number of your new bitmap i.e. set targetmem to equal your new bitmap member.)

-- to use : sendallsprites(#setwidth)

property maxx,mycolor,sourceMem
property sourceImage,imageWidth,imageHeight1
property imageHeight,sourceColor
property spritenum
global ed,eobj,gzfactor

on beginSprite me
  
  sprite(spritenum).member.boxtype = #fixed
  sprite(spritenum).member.alignment = #left
  
end beginSprite

on setWidth me
  
  -- set up variable default values  
  
  maxx = 0
  sourceMem = sprite(spritenum).member
  TargetMem = 6 -- temporary bitmap member for processing the bitmap
  
  -- size up text box to allow for expanding as well as cropping
  
  sourceMem.width = 1760
  
  -- get parameters for new member
  
  sourceImage = member(sourceMem).image
  imageWidth = sourceImage.width
  imageHeight = sourceImage.height
  sourceRect = sourceImage.rect
  destRect = sourceImage.rect
  
  -- turn that damn wordwrap off!
  
  member(sourceMem).wordwrap= FALSE
  
  -- copyPixels bit to copy text member into a bitmap member  
  
  newImage = image(imageWidth,imageHeight,1,0)
  (newImage).copyPixels(sourceImage, destRect, sourceRect)
  member(targetMem).image = newImage
  member(targetMem).regPoint = point(0,0)
  workingImage = member(targetmem).image.duplicate()  
  workingImage = workingImage.trimWhiteSpace()
  imageWidth = workingImage.width
  
  -- set the original text box to the new value discovered above.  
  
  sprite(spritenum).member.width = imageWidth + 5
  
  -- set the height to take the top space out
  
  sprite(spritenum).member.fixedLineSpace = sprite(spritenum).member.fontsize
  
end

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail