counter and displaylist AS3

Posted by VideoDnd on Stack Overflow See other posts from Stack Overflow or by VideoDnd
Published on 2010-03-02T21:45:12Z Indexed on 2010/04/19 15:03 UTC
Read the original article Hit count: 335

Filed under:
|

How can I connect my counter to my display list?
I've got a counter and a displaylist working, but I need help with everything in between.

Try to explain
I finished a Snowflake tutorial. The snowballs are children that are called to the stage. When connected to a dynamic variable, they move around and look like snow. I want my counter to move numbers around. I've got a counter, and I've got a 'for loop' to add children to the stage.

alt text

link to file http://sandboxfun.weebly.com/

actionscript-3

                 //DISPLAYLIST "puts stuff on stage"
        for (var i:int = 0; i < 9; i++) {
        var t:MovieClip = new Tee();
        t.x = 105 + i * 111;
        addChild(t);100
        }


//ARRAY 
//var o:Object = new Object(); <br>
//var TeeProps:Dictionary= new Dictionary(true); <br>
//var Tees:Array = new Array(); <br>
//TeeProps[t] = o; <br>
//addChild(t); <br>
//Tees.push(t); <br>
//} <br>



                 //COUNTER drop in "mytext" text field to see it work
    var timer:Timer = new Timer(10);  
    var count:int = 0; //start at -1 if you want the first decimal to be 0  
    var fcount:int = 100; 

    timer.addEventListener(TimerEvent.TIMER, incrementCounter);  
    timer.start();  

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

    function formatCount(i:int):String { 
         var fraction:int = i % 100; 
         var whole:int = i / 100;  

        return ("0000000" + whole).substr(-7, 7) + "." + (fraction < 10 ? "0" + fraction : fraction); 
    }

I'm rebuilding a earlier version for learning purposes.

© Stack Overflow or respective owner

Related posts about flash

Related posts about actionscript-3