# Tween Class, LoadMovie, and Buttons

**URL:** https://forum.kirupa.com/t/tween-class-loadmovie-and-buttons/237170
**Category:** flash
**Created:** [August 27, 2007, 8:18pm UTC](https://forum.kirupa.com/t/tween-class-loadmovie-and-buttons/237170 "2007-08-27T20:18:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![IvanDH](https://avatars.discourse-cdn.com/v4/letter/i/779978/32.png) [@IvanDH](https://forum.kirupa.com/u/IvanDH)
#### Post date: [August 27, 2007, 8:18pm UTC](https://forum.kirupa.com/t/tween-class-loadmovie-and-buttons/237170/1 "2007-08-27T20:18:01Z")

</div>

Hello,

Can someone help me out with this code? Im trying to create a menu, that initially loads an image with loadImage. Then when a menu item is clicked, it fades the initially loaded image into the next Image. Each menu item should fade into another Image.

Ive been working on this for a few days, and Im not really sure how to do it.

Anyway heres the code I have so far:

import mx.transitions.Tween;  
import mx.transitions.easing.\*;

//globs

var banners = [“banner0.jpg”, “banner1.jpg”, “banner2.jpg”];  
var b:MovieClip;  
var alpha = 100;

// create a movieclip to load the photo into  
function getImage(){  
b = \_root.createEmptyMovieClip(“img”, i);  
b.\_x = 0;  
b.\_y = 0;  
b.loadMovie(“banner0.jpg”);  
b.\_alpha = alpha;

}

function fade(){  
var mcTween:Tween = new Tween(b, “\_alpha”, Regular.easeInOut, 100, 20, 2, true);  
};

getImage();

```
menuBar.menu0.onRelease = function() { b.loadMovie(banners[0]); };
menuBar.menu1.onRelease = function() { b.loadMovie(banners[1])};
menuBar.menu2.onRelease = function() { b.loadMovie(banners[2])};

```

Thanks for any help.
