Solved

Scaling a flash movie clip on roll over

Posted on 2006-06-18
1
670 Views
Last Modified: 2008-02-01
Hi, I am using the following code to scale a flash movie clip which is working but I wish to scale the movie clip by only 20%.

myMC.onRollOver = function() {
    this._x -= this._width/2;
    this._y -= this._height/2;
    this._xscale = 200;
    this._yscale = 200;
};
myMC.onRollOut = function() {
    this._xscale = 200;
    this._yscale = 200;
    this._x += this._width/2;
    this._y += this._height/2;
};

If I try changing the numbers as below it dose not work.

myMC.onRollOver = function() {
    this._x -= this._width/1.5;
    this._y -= this._height/1.5;
    this._xscale = 150;
    this._yscale = 150;
};
myMC.onRollOut = function() {
    this._xscale = 150;
    this._yscale = 150;
    this._x += this._width/1.5;
    this._y += this._height/1.5;
};

How do I adjust the figures to change the percentage to enlarge the myMc by 20% and return to its original size and possition on mouse over?

Thanks for any help.
0
Comment
Question by:surfjoe
1 Comment
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 500 total points
Comment Utility
Hi,

here is the update code to scale movieClip to 120% on rollOver and scaleBack to 100% on rollOut
------------
myMC.onRollOver = function() {
      currentX = this._x;
      currentY = this._y;
      currentWidth = this._width;
      currentHeight = this._height;
      this._xscale = 120;
      this._yscale = 120;
      this._x -= (this._width-currentWidth)/2;
      this._y -= (this._height-currentHeight)/2;
};
myMC.onRollOut = function() {
      this._xscale = 100;
      this._yscale = 100;
      this._x = currentX;
      this._y = currentY;
};
-------------

Rgds
Aneesh
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now