# Tween Class using the timeline

**URL:** https://forum.kirupa.com/t/tween-class-using-the-timeline/178088
**Category:** flash
**Created:** [February 7, 2006, 5:11pm UTC](https://forum.kirupa.com/t/tween-class-using-the-timeline/178088 "2006-02-07T17:11:41Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![opel](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/opel/32/199_2.png) [@opel](https://forum.kirupa.com/u/opel)
#### Post date: [February 7, 2006, 5:11pm UTC](https://forum.kirupa.com/t/tween-class-using-the-timeline/178088/1 "2006-02-07T17:11:41Z")

</div>

I am using the tween class to add an elastic FX to my nav bar. I want the FX to happen once when the page is loaded and the timeline moves over its frame. How do I alter my code so this will happen?

```auto
import mx.transitions.Tween;
import mx.transitions.easing.*;

bar.onEnterFrame = function () {
	var tw:Tween = new Tween (this,"_width",Bounce.easeOut,0,780, 1, true);
	var tw:Tween = new Tween (this,"_height",Bounce.easeOut,0,30, 1, true);
}

```

I have tried placing this code on the MC (bar) timeline and the root timeline.

Cheers

Andy
