View comments | RSS feed

MovieClip._xscale

Availability

Flash Player 4.

Usage

my_mc._xscale:Number

Description

Property; determines the horizontal scale (percentage) of the movie clip as applied from the registration point of the movie clip. The default registration point is (0,0).

Scaling the local coordinate system affects the _x and _y property settings, which are defined in whole pixels. For example, if the parent movie clip is scaled to 50%, setting the _x property moves an object in the movie clip by half the number of pixels as it would if the movie were set at 100%.

Example

The following example creates a movie clip at runtime called box_mc. The Drawing API is used to draw a box in this instance, and when the mouse rolls over the box, horizontal and vertical scaling is applied to the movie clip. When the mouse rolls off the instance, it returns to the previous scaling.

this.createEmptyMovieClip("box_mc", 1);
box_mc._x = 100;
box_mc._y = 100;
with (box_mc) {
   lineStyle(1, 0xCCCCCC);
   beginFill(0xEEEEEE);
   moveTo(0, 0);
   lineTo(80, 0);
   lineTo(80, 60);
   lineTo(0, 60);
   lineTo(0, 0);
   endFill();
}
box_mc.onRollOver = function() {
   this._x -= this._width/2;
   this._y -= this._height/2;
   this._xscale = 200;
   this._yscale = 200;
};
box_mc.onRollOut = function() {
   this._xscale = 100;
   this._yscale = 100;
   this._x += this._width/2;
   this._y += this._height/2;
};

See also

MovieClip._x, MovieClip._y, MovieClip._yscale

Comments


No screen name said on Aug 8, 2004 at 7:02 AM :
Isn't there any way to find out the complete info of a movie clip using action script ? I mean I wanna determine the size of a movie clip instance (_xscale and _yscale) not in percentages but actual pixels. Please help.
live cabbage said on Aug 8, 2004 at 5:42 PM :
Use MovieClip._width and MovieClip._height to find out the pixel values.
scoobeeDogg said on Aug 2, 2005 at 12:25 PM :
It is possible to flip a movie clip about the x and y axes by using a negative scale value. ie. clip._yscale = -100; will cause a clip to be flipped upside-down.
No screen name said on Sep 12, 2005 at 2:41 PM :
I want to be able to find out the amount of xscaling on the clip... so

"if (my_mc._xscale=100) {
}"

what it does for me is make the movie clip have that xscaling... not see if it
has it
Rich Dougherty said on Feb 2, 2006 at 7:56 PM :
Hi no screen name

You've missed an "=" from your code.

"if (my_mc._xscale=100) {
}"

should be

"if (my_mc._xscale==100) {
}"
authcode said on Feb 3, 2006 at 8:00 AM :
^^^
The reason "if(my_mc._xscale=100){}" doesn't work as expected is because "=" is the assignment operator i.e. _xscale is being set to 100 even though it appears within the if statement. If you want to test whether something is equal to something you need to use the equality operator "==" which returns true or false. So... try "if(my_mc._xscale==100){}" instead.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00001570.html