# Is this code bad, is there a better way?

**URL:** <https://forum.kirupa.com/t/is-this-code-bad-is-there-a-better-way/196368>\
**Category:** Uncategorized\
**Created:** [August 7, 2006, 10:33pm UTC](https://forum.kirupa.com/t/is-this-code-bad-is-there-a-better-way/196368 "2006-08-07T22:33:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Case\_Sensitive](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@Case\_Sensitive](https://forum.kirupa.com/u/Case_Sensitive)\
**Post date:** [August 7, 2006, 10:33pm UTC](https://forum.kirupa.com/t/is-this-code-bad-is-there-a-better-way/196368/1 "2006-08-07T22:33:35Z")

</div>

Hi

I was looking for a way to do simple shape tween to draw a line from point a to point b. I looked at the tweening class and couldn’t see anything that could help me.

So I did this: It works, but is there another easier way?? Will this type of code slow down swf playback?

this.createEmptyMovieClip(“line2”, this.getNextHighestDepth());  
line2.lineStyle(1, 0xFF0000, 100);  
line2.moveTo(17, 219);  
line2.lineTo(18, 219);

```auto

var i:Number = 18;
onEnterFrame = function()
{
   if(i < 100)
   {
      line2.lineTo(i, 219);
      i++;
   }
   else if(i > 100)
   {
      line2.stop();
   }
}
setInterval(onEnterFrame, 1000);

```

Does anyone have suggestions or am I making a non existent mountain out of a non existent anthill??

cheers for any ideas.
