Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Pendulum Rotate-Alphamania
Go to URL
Reset Cursor of all sprites to Default
Flash Sprite -- Simple Controller [Play, Pause, Rewind]
RealLingo
password field
MultimediaHelp
Effector Set I for Alphamania
Show Time
TextCruncher
MediaMacros Xtras Mall
 

 

 

Behavior Image Resizer v1.0

Added on 4/20/2006

 

Compatibilities:
behavior D6_5 D7 D8 D8_5 D9 PC

This item has not yet been rated

Author: proufas

You just have to put the prefered dimensions of an image and the script resize it without stretching.

----------------------------------------------------------------------------------------
---- I M A G E  R E S I Z E R v1.0 -----------------------------------------------------
---- ::: Copyright 2006 :::  -----------------------------------------------------------
---- [ Profitakis Konstantinos (proufas@mycosmos.gr) ::: BRAIN.net ::: GREECE ::: ] ----
----------------------------------------------------------------------------------------
---- How it works:
---- You have to insert the prefered image dimensions in the parameters and then, let -
---- the script work. ------------------------------------------------------------------
----------------------------------------------------------------------------------------

property spritenum, pMaxWidth, pMaxHeight

----------

on getBehaviorDescription me
  return "IMAGE RESIZER v1.0" & RETURN & "Copyright 2006 - Profitakis Konstantinos (proufas@mycosmos.gr) - BRAIN.net - GREECE" & RETURN   & "How it works:" & RETURN   & "You have to insert the prefered image dimensions in the parameters and then, let the script work."
end


----------

on getPropertyDescriptionList me
  
  --Dimension selection
  set plist to [:]
  addprop plist, #pMaxWidth, [#comment:"Max width of image", #format:#integer, #default:0]
  addprop plist, #pMaxHeight, [#comment:"Max height of image", #format:#integer, #default:0]
  return plist
  
end

----------

on beginsprite
  
  --Gets the initial dimensions
  mySprite=sprite(spritenum)
  InitImageWidth=mySprite.width
  InitImageHeight=mySprite.height
  
  --Checks if image is landscape or portrait
  if InitImageWidth>InitImageHeight then
    ImageType="landscape"
  else
    ImageType="portrait"
  end if
  
  --Makes the calculation
  if ImageType="landscape" then
    ratio=(InitImageHeight.float)/(InitImageWidth.float)
    FinalImageWidth=pMaxWidth
    FinalImageHeight=pMaxWidth*ratio
  end if
  
  if ImageType="portrait" then
    ratio=(InitImageWidth.float)/(InitImageHeight.float)
    FinalImageWidth=pMaxHeight*ratio
    FinalImageHeight=pMaxHeight
  end if
  
  --Final step and centers the registration point of the image
  sprite(spriteNum).member.centerRegPoint=1
  mySprite.width=FinalImageWidth
  mySprite.height=FinalImageHeight
  
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