1
votes

Question
How can I animate and form rows together?

Explanation
One 'for loop' is for animation, the other 'for loop' is for making rows. I want to understand how to use arrays and create a row of sprite animations. I understand how to loop through an Array and create a Sprite for each index of the Array, but I'm having trouble putting my animation in rows.

Output
I got my number animation to play in a single row. When I add the loop to multiply it across the stage, it just blinks while continuing to animate.

'for loop' for animation

//FRAMES ARRAY
//THIS SETS UP MY ANIMATION FOR TIMER EVENT
var frames:Array = [
    new Frame1(),
    new Frame2(),
    new Frame3(),
    new Frame4(),
    new Frame5(),
    new Frame6(),
    new Frame7(),
    new Frame8(),
    new Frame9(),
    new Frame0(),
    ];

for each (var frame:Sprite in frames) {
    addChild(frame);
    }

'for loop' for rows

//THIS MAKES A ROW OF DISPLAY OBJECTS
                    var numberOfClips:Number = 11;
                    var xStart:Number = 0;
                    var yStart:Number = 0;
                    var xVal:Number = xStart;
                    var xOffset:Number = 2;
            for (var $:Number=0; $<numberOfClips; $++)
                    {
//DUDE ARRAY
                    var dude:Array = frames;
                    dude.y = yStart +11;
                    dude.x = xVal +55;
                    xVal = dude.x + dude.width + this.xOffset;
                    }

timer

var timer:Timer = new Timer(100);
timer.addEventListener(TimerEvent.TIMER, countdown);
function countdown(event:TimerEvent) {
    var currentFrame:int = timer.currentCount % frames.length;
    for (var i:int = 0; i < frames.length; ++i) {
        frames[i].visible = (i == currentFrame);
    }
}
timer.start();

counter experiment
My new class I'm working on loops through 10 different display objects that are numbers. For those following, I'm trying to make something like NumbersView.


INTENT
- Single Frames
'individual sprites for each number'
- Individual behaviors for Flip, and LED


- Flip
'each object is a flip animation with a number' (can't achieve with NumbersView)
- LED
'each object is independent, allowing for 7-seg led patterns, or motions staggering walk-in effect'
- Odometer
'odometer already achieved, but could achieve the same with tweens for each number'


HOPE TO LEARN
- arrays 'understand how to use and combine arrays'
- for loops 'how to use, and how to follow in a document'
- classes 'at what point do I need to extend it as a class'

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

EXAMPLES
LED 'same behavior and layout, but vertical increments'
http://www.youtube.com/watch?v=__TLrYH8NC4

FLIP NUMBER 'great example of terminal board at airport
http://www.youtube.com/watch?v=fH0Aghm1TNE

ODOMETER 'towards the end of the clip'
http://www.youtube.com/watch?v=DKavhec9fGE

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

1
Again, your question isn't at all clear, but having seen your previous questions, and your reference to the hallowed NumbersView class you've been using, I guess you're still trying to make an Odometer. As you may remember, I wrote an example of this for you, which you could extend very easily. This code you've posted is yet again messy and convoluted, and seems like it's only serving to confuse you further. Here's a link to the example I gave you before, have another look and feel free to ask me questions about it: stackoverflow.com/questions/2389699/lost-in-strings-as3/…debu
@debu, I feel like the village idiot here, let me explain. NumbersView is a y animation. Flip numbers and LED displays don't behave like odometers.anon255058
Ok, so describe the behaviour you want this number counting display to have. In detail, and if possible with a visual example. This is probably the 5th question you've posted relating to making counters, it's about time it got solved - so please, write the question out very clearly, stating what you want to achieve, and what the code you've got so far actually does. Nobody wants to make you feel like an idiot, but the way you ask questions really needs to change. Also, like the guys at Meta said, answer people when they try to help you.debu
@debu, I'm a oaf, but I want to resolve this ignorance of mine. Please post something. I can make a programmers etiquette question if that's better. I'm serious :) meta.stackexchange.com/questions/45955/…anon255058
Ok. I'll post a response on that thread, with some advice on how to ask this question better. In the mean time, please update this question with the specific thing you're trying to achieve, explained in plain English.debu

1 Answers

0
votes

Your question is a little better now; I've modified the code I gave you for the Odometer slightly, and put in a small Tween inside an object using the Flash IDE. http://dl.dropbox.com/u/3987391/Odometer_Flip.fla

Look at how little I changed in the code, from the Odometer example. The main thing I added is inside the flipper MovieClip. Inside it is an object called digitHolder, which animates using CS4's 3D rotation tool. Inside digitHolder is the TextField which displays the number.

As for the LED alternative, I imagine you could just use a font which looks like LEDs. Your Youtube link doesn't work, so I can't see what the example is, but I imagine a font would cover you.