Director News
Director Web Sites
Mailing Lists
News Groups
Project Examples
Useful Web Sites

Don't miss these
Draw a line with lingo
DM ChangeRes
keyboard input control
Field Entry Dialog Box
Director 8.5 Shockwave Studio: The Complete Reference
Toggle Button
Page turn
Generic Slider w/Text
Ripple Rain-Alphamania
Smooth / transparent windows and more! (odd shape windows part2)



Behavior Returns Rect of visible PDF doc within an Impressario sprite

Added on 7/25/2004


behavior D8_5 D9 Mac PC

Required Xtras:
INM's Impressario

This item has not yet been rated

Author: peterh

I'm came up with this when creating an application where "sticky notes" were to be attached to locations within PDFs. In order to track locations where the users placed notes on a document I needed to know where the visible rect of the PDF document sits within the sprite when the scrollH = 0 and scrollV = 0 (view of pdf document is smaller than the sprite). Currently there is no property that exposes this information, so I wrote this behaviour. Use: (Impressario sprite).getRectOfView() returns a rect of the boundary of the current view of the document contained within the sprite, even if it's smaller than the sprite. Rect is relative to the stage (or activeWindow).

Property spriteNum
on getRectOfView()  --Returns the rect of document visible within an Impressario sprite, relative to the current stage...
  --Note: No sprites must exist underneath the Impressario sprite because the routine compares the color of pixels on the stage in the sprite's rect to the stage's bgColor. If you do place an sprite underneath, it must be all one color and you must change the value of in the 5th line from (the activeWindow).bgcolor to the color of that sprite.
  --Use of (the activeWindow) instead of (the stage) ensures the routine is suitable for MIAWs.

  img=(the activeWindow).image
  bkdCol=(the activeWindow).bgcolor
  --traverse from left until color change...
  repeat while img.getPixel(x,centreY)=bkdCol
  end repeat
  --traverse from top until color change...
  repeat while img.getPixel(centreX,y)=bkdCol
  end repeat
  return rect(x,y,pdfSprite.right-(x-pdfSprite.left),pdfSprite.bottom-(



36 South Court Sq
Suite 300
Newnan, GA 30263

Send e-mail