Lingo Dictionary > S > scale

 

scale

Syntax

member(whichCastMember).scale
the scale of member whichCastMember
sprite(whichSprite).scale
the scale of sprite whichSprite

Description

Cast member property and sprite property; controls the scaling of a QuickTime, vector shape, or Flash movie sprite.

For QuickTime, this property does not scale the sprite's bounding rectangle or the sprite's controller. Instead, it scales the image around the image's center point within the bounding rectangle. The scaling is specified as a Director list containing two percentages stored as float-point values:

[xPercent, yPercent]

The xPercent parameter specifies the amount of horizontal scaling; the yPercent parameter specifies vertical scaling.

When the sprite's crop property is set to TRUE, the scale property can be used to simulate zooming within the sprite's bounding rectangle. When the sprite's crop property is set to FALSE, the scale property is ignored.

This property can be tested and set. The default value is [1.0000,1.0000].

For Flash movie or vector shape cast members, the scale is a floating-point value. The movie is scaled from its origin point, as specified by its originMode property.

Note: This property must be set to the default value if the scaleMode property is set to #autoSize; otherwise the sprite does not display correctly.

Example

This sprite script keeps the playback head looping in the current frame while the QuickTime sprite in channel 5 is scaled down in 5% increments. When the sprite is no longer visible (because its horizontal scale value is 0% or less), the playback head continues to the next frame.

on exitFrame me
	scaleFactor = sprite(spriteNum).scale[1]
	currentMemberNum = sprite(spriteNum).memberNum
	if member(currentMemberNum).crop = FALSE then
		member(currentMemberNum).crop = TRUE
	end if 
	if scaleFactor > 0 then
		scaleFactor = scaleFactor - 5
		sprite(spriteNum).scale = [scaleFactor, scaleFactor]
		go the frame
	end if
end

Example

This handler accepts a reference to a Flash movie sprite as a parameter, reduces the movie's scale to 0% (so it disappears), and then scales it up again in 5% increments until it is full size (100%) again.

on scaleMovie whichSprite
	sprite(whichSprite).scale = 0
	updatestage
	repeat with i = 1 to 20
		sprite(whichSprite).scale = i * 5
		updatestage
	end repeat
end

See also

scaleMode, originMode