A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Flash thermometer AS3

  1. #1
    Junior Member
    Join Date
    Apr 2010

    Flash thermometer AS3

    I'm trying to figure how to make something happen with an animated thermometer.

    The thermometer has to go up and down by one degree according to a score (it's a game), between 10 and 100 degrees. Right now, I have a movie clip changed into a graphic, with 100 frames in it. The first 10 frames are static, while the 11-100 frames are a tweened animation of the mercury rising to 100.

    The only way I know to change it outside the MC is to make it a graphic and change the Single Frame option to whatever frame I want. What I really need to be able to do is make it able to be animated, backwards and forwards, according to, preferably, an internal source or an external source. I don't know anything about AS3 (I know a little AS2 but not enough to code it and I'd prefer to keep it AS3) and I don't know how to make an XML to load in the data. Straight up animator here.

    If anyone could help me with this, I'd be most appreciative.

  2. #2
    Join Date
    Dec 2002
    On stage,

    animated thermometer movie clip, instance name 'mc_thermo'
    input text field, instance name 'score'
    button, instance name 'btn'

    mc_thermo.addEventListener(Event.ENTER_FRAME, doPlay);
    var newScore:uint=1;
    btn.addEventListener(MouseEvent.CLICK, doUpdate);
    function doUpdate(e:Event):void {
    function doPlay(e:Event):void {
    	var mc:MovieClip=MovieClip(e.target);
    	if (mc.currentFrame!=newScore) {
    		var dir:int = (mc.currentFrame > newScore)? -1 : 1;
    		mc.gotoAndStop(mc.currentFrame + dir);
    Type in a number and click the button.

    Last edited by dawsonk; 05-25-2010 at 09:59 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center