# AS3 Drawing an animation chart real time

**URL:** <https://forum.kirupa.com/t/as3-drawing-an-animation-chart-real-time/331070>\
**Category:** flash\
**Created:** [May 8, 2013, 2:27pm UTC](https://forum.kirupa.com/t/as3-drawing-an-animation-chart-real-time/331070 "2013-05-08T14:27:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_Tomas\_Zahov](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@Tom\_Tomas\_Zahov](https://forum.kirupa.com/u/Tom_Tomas_Zahov)\
**Post date:** [May 8, 2013, 2:27pm UTC](https://forum.kirupa.com/t/as3-drawing-an-animation-chart-real-time/331070/1 "2013-05-08T14:27:53Z")

</div>

Hello

–AS3 programming Beginner–

I’m trying to make a chart in AS3 like trading chart.  
It should be a pattern that known before so I could know always what is the X axis and Y axis.  
All I succeeded is to draw a line but I want it to be more interesting like zigzag or something like that go up and down…  
finally it needs to be stopped and the player should guess if it will go down or up.  
that is the whole purpose of the game.

Hope U understand what I mean…  
here is the code i did so far:

```auto

const myLine:Shape = new Shape();
myLine.graphics.lineStyle(2, 0x5D19C69);

var theX = 181;
var theY = 240;
var NextPosX;
var NextPosY;
var cycles = 200;
var i = 0;

myLine.graphics.moveTo(theX, theY);

var myTimer:Timer = new Timer(1, cycles);

myTimer.addEventListener(TimerEvent.TIMER, stretchLine); myTimer.start();

function stretchLine(e:TimerEvent):void
{
    i = i + 1;
    if((cycles-1) < i)
    {
        trace("Timer stopped at " + cycles + "th cycle.");
        myTimer.stop();
    }
        myLine.graphics.lineTo(theX + i, theY - 15);
        addChild(myLine);
        Yaxis.text = theY;
        Xaxis.text = theX;
    }

```

Thanks  
Tom
