Skip navigation
Currently Being Moderated

Using AS3 to resize a movie clip (in my game it is the life bar)

Apr 10, 2013 3:50 PM

S O L V E D thanks.


In addition to my document class, I have created classes for objects in my game.


One of these is a class of a rectangle that has to scale down as the timer in my document class runs.


So far I have managed to change the following (on other mc's) with the timer in place: alpha value and the position of the movie clip.


My code for this class so far:


    import flash.display.MovieClip;

    public class TimerMiddle extends MovieClip


        public function TimerMiddle()


            x = 1242;

            y = 300;






I think the next step in this class file would be to make a new public function to manipulate the scale timer bar called TimerMiddle. I want the width to stay the same, but the height to decrease as the TimerEvent runs. I have made sure that the referance point is at the bottom of the rectangle.


How do I change the scale of the rectangle to indicate that the player's life goes down as the time runs out? I'm not sure if I change the height of the vertical bar, the scale or it I use tweening (And how to inplement any of the three.)

What should I import into my document class once the best option is picked?


Thanks for the help


Thanks it works now.


Added this to code



          public function scaleLifeBar():void


            height = height - 10;



I think my timer ran to fast to see it work before LOL. Coding brings out my inner idiot sometimes.


More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points