Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 617949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:29:28+00:00 2026-05-13T18:29:28+00:00

My scrolling counter is not displaying 1-9…only zeros every ten intervals. It plays, but

  • 0

My scrolling counter is not displaying 1-9…only “zeros” every ten intervals. It plays, but the code is unfinished at line 37 in NumbersView.as. Notice Tweener is used to display the sprites. How do I finish this?

WHAT I’M TESTING “NumbersView.as”
loop error, onComplete, missing argument or function

– Tweener code, line 37?
– for loop, line 22? for (var i:Number = 0; i < 9; i++)

Thanks for the help!

alt text http://www.ashcraftband.com/myspace/videodnd/note3.jpg

numbers.fla

alt text http://www.ashcraftband.com/myspace/videodnd/note1.jpg
alt text http://www.ashcraftband.com/myspace/videodnd/note2.jpg

NumbersView.as “see Tweener part towards the bottom”

package  
{
 import flash.display.DisplayObject;
 import flash.display.MovieClip;
 import flash.utils.Dictionary;
 import flash.events.Event;
 import caurina.transitions.Tweener;


 public class NumbersView extends MovieClip
 {

  private var _listItems:Array = new Array();


  public function NumbersView() 
  {
   var item:NumberImage;
   for (var i:Number = 0; i < 9; i++) {
    item = new NumberImage();
    addChild(item);
    item.x = i * item.width;
    _listItems.push(item);
   }

  }


  public function setTime($number:String):void {
   var nums:Array = $number.split("");
   for (var i:Number = 0; i < nums.length; i++) {
    if (int(nums[i]) == 0) {
     Tweener.removeTweens(_listItems[i].moveableNumber_mc);
     if (_listItems[i].moveableNumber_mc.y < 0) {
      _listItems[i].moveableNumber_mc.y = 120;
     }
     Tweener.addTween(_listItems[i].moveableNumber_mc, { y: 0, time:.3 } );
    } else {
     Tweener.addTween(_listItems[i].moveableNumber_mc, { y: -120 * int(nums[i]), time:.3} );
    }
   }
  }
 }

}

NumberDocumentClass.as “works fine”

package {
 import flash.display.Sprite;
 import flash.utils.Timer;
 import flash.events.TimerEvent;

 public class NumberDocumentClass extends Sprite {

  private var timer:Timer = new Timer(10);
  private var count:int = 0;
  private var fcount:int = 0;
  private var numbers:NumbersView;

  public function NumberDocumentClass() {
   timer.addEventListener(TimerEvent.TIMER, incrementCounter);    
   timer.start();   
   numbers = new NumbersView();
   addChild(numbers);
  }

  function incrementCounter(event:TimerEvent) {    
   count++;    
   fcount=int(count*count/1000);//starts out slow... then speeds up   
   numbers.setTime(formatCount(fcount));
  }  

  function formatCount(i:int):String {   
   return ("000000000" + i).substr(-9, 9); 
  } 
 }
}

I got it debugged!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:29:28+00:00Added an answer on May 13, 2026 at 6:29 pm

    I noticed a few things in your code, so I edited it and it works fine.

    The main problem is that you Flash library item (mc-NumberImage) wasn’t set up for the way you were using it. You put the number graphics on frames, so I modified it so the movieclip has one frame with all the numbers on top of each other. So number_0.y = 0, and number_1.y = 120… number_2.y = 240, etc. (also In your library your “number_8.jpg” is actually a number 7).

    If you just make that change then your code runs OK. It does get slower and slower though. This is partly due to Tweener, but mostly because it is trying to update too much. I updated you code below.

    NumberDocumentClass

    Separated out the incrementCounter, and the display code. So now numbers.setTime() gets called on enterframe (no point drawing more than once a frame, Flash can’t do it). I also initiated your Timer in the constructor rather than in the variable declaration (this is best practice).

    package {
        import flash.display.Sprite;
        import flash.events.Event;
        import flash.utils.Timer;
        import flash.events.TimerEvent;
    
        public class NumberDocumentClass extends Sprite {
    
            private var timer:Timer;
            private var count:int = 0;
            private var fcount:int = 0;
            private var numbers:NumbersView;
    
            public function NumberDocumentClass() {
                timer = new Timer(10);
                timer.addEventListener(TimerEvent.TIMER, incrementCounter);    
                timer.start();   
                numbers = new NumbersView();
                addChild(numbers);
    
                addEventListener(Event.ENTER_FRAME, enterFrameHandler);
            }
    
            private function incrementCounter(event:TimerEvent) {    
                count++;    
                fcount=int(count*count/1000);//starts out slow... then speeds up
            }
    
            private function formatCount(i:int):String {   
                return ("000000000" + i).substr(-9, 9);
            }
    
            private function enterFrameHandler(e:Event):void 
            {
                numbers.setTime(formatCount(fcount));
            }
        }
    }
    

    NumberView

    I mainly edited the setTime method. I added a previousNums variable that remembers the previous numbers, that way we can use it to see if a number has changed, and if it hasn’t then you can skip it (if(nums[i] == previousNums[i]) continue;).

    package  
    {
        import flash.display.DisplayObject;
        import flash.display.MovieClip;
        import flash.utils.Dictionary;
        import flash.events.Event;
        import caurina.transitions.Tweener;
    
        public class NumbersView extends MovieClip
        {
            private var _listItems:Array;
            private var previousNums:Array;
            private const numHeight:int = 120;
    
            public function NumbersView() 
            {
                _listItems = new Array();
                previousNums = new Array();
    
                var item:NumberImage;
                for (var i:Number = 0; i < 9; i++) {
                    item = new NumberImage();
                    addChild(item);
                    item.x = i * item.width;
                    _listItems.push(item);
                }
            }
    
            public function setTime($number:String):void {
                var nums:Array = $number.split("");
    
                for (var i:Number = 0; i < nums.length; i++) {
                    if (nums[i] == previousNums[i]) continue;
                    Tweener.removeTweens(_listItems[i]);
    
                    var newY:int = int(nums[i]) * -numHeight;
                    if (_listItems[i].y < 0) _listItems[i].y = numHeight;
                    Tweener.addTween(_listItems[i], { y:newY, time:.1 } );
                }
                previousNums = nums;
            }
        }
    }
    

    So if you set up your FLA with the number graphics aligned vertically, and you use this code, then it should run really well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to disable scrolling of body? $('body').css('overflow','hidden'); only hides the scrollbars but it does
When scrolling the div the table cells move, but the cell text stays in
i need horizontal scrolling script in javascript, but don't have much time to write
While scrolling my web page a DIV which have a video is not going
I would like to create a scrolling counter and I'm wondering on how to
I'm doing programmatic scrolling in UITableViews with scrollToRowAtIndexPath, which does not trigger scrollViewDidEndDecelerating. What
I have a UIWebView displaying a page that contains a Javascript counter. This page
I am trying to execute a small piece of code on every single frame
scrollTo is not scrolling to a div that expands past the bottom of the
How can I disable scrolling of webpage when displaying a dialog box. I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.