Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
cXtraTransitions
Diffusion Effect - Imaging Lingo
Deleting a range of frames
Sending a e-mail with attachment using CDO and VbScriptXtra
Move To Top
ToolTip Behavior
A shooting game
Tony's Quick Script Maker
Animated Cursor
PC Mac Lan
MediaMacros Xtras Mall
 

 

 

Behavior Returns Rect of visible PDF doc within an Impressario sprite

Added on 7/25/2004

 

Compatibilities:
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.

  pdfSprite=sprite(spriteNum)
  
  img=(the activeWindow).image
  centreX=pdfSprite.left+pdfSprite.width/2
  centreY=pdfSprite.top+pdfSprite.height/2
  bkdCol=(the activeWindow).bgcolor
  
  --traverse from left until color change...
  x=pdfSprite.left
  repeat while img.getPixel(x,centreY)=bkdCol
    x=x+1
  end repeat
  
  --traverse from top until color change...
  y=pdfSprite.top
  repeat while img.getPixel(centreX,y)=bkdCol
    y=y+1
  end repeat
  
  return rect(x,y,pdfSprite.right-(x-pdfSprite.left),pdfSprite.bottom-(y-pdfSprite.top))
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