# Expanding Menu Help

**URL:** <https://forum.kirupa.com/t/expanding-menu-help/21513>\
**Category:** flash\
**Created:** [May 22, 2003, 2:31pm UTC](https://forum.kirupa.com/t/expanding-menu-help/21513 "2003-05-22T14:31:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![RagingRebel](https://avatars.discourse-cdn.com/v4/letter/r/9e8a1a/32.png) [@RagingRebel](https://forum.kirupa.com/u/RagingRebel)\
**Post date:** [May 22, 2003, 2:31pm UTC](https://forum.kirupa.com/t/expanding-menu-help/21513/1 "2003-05-22T14:31:23Z")

</div>

I’m new to this forum and fairly new Flash and just now getting a crasp on ActionScript.  
What I would like to do is a menu based on the principles of the attached file, although my overall design would be quite different.

How should I go about doing this using ActionScript…I would appreciate any help anyone could give thanks…!!!

BTW, from my first impressions here at Kirupaville, I think I may have found a new home.

Wonderful site…!!!

I don’t know why the attachment didn’t work…Let’s try this…[Expanding Menu](http://langs.olascatering.com/menu.swf)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 22, 2003, 4:36pm UTC](https://forum.kirupa.com/t/expanding-menu-help/21513/2 "2003-05-22T16:36:33Z")

</div>

The attachment didn’t work…Hope the link is enough to give you an idea of what I mean.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 22, 2003, 6:38pm UTC](https://forum.kirupa.com/t/expanding-menu-help/21513/3 "2003-05-22T18:38:42Z")

</div>

Are there no takers on attemping an explaination of how this is done…???

[Expanding Menu](http://langs.olascatering.com/menu.swf)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 23, 2003, 7:55am UTC](https://forum.kirupa.com/t/expanding-menu-help/21513/4 "2003-05-23T07:55:48Z")

</div>

Cool!. May i have a look at the fla? i really wanna take a look at it.

QT

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 23, 2003, 10:24am UTC](https://forum.kirupa.com/t/expanding-menu-help/21513/5 "2003-05-23T10:24:29Z")

</div>

All right, I don’t have Flash, so I’m just spitting out code off the top of my head, but I hope you’ll get the idea. Let’s imagine that all your clips are called section0, section1, section2…

```auto
// first, the function that will make the clips move
MovieClip.prototype.easeTo = function(x,y){
  // We ease to the target position (x,y)
  var dx = x - this._x;
  var dy = y - this._y;
  this._x += dx;
  this._y += dy;
  // if we're really close, we cancel the onEnterFrame
  if (Math.abs(dx)+Math.abs(dy) < 1){
    this._x = x;
    this._y = y;
    delete this.onEnterFrame;
  }
}

// Array containing the target positions (only 4 in this example)
positionTarg_arr = [[0,0],[20,0],[40,0],[60,0]];
// Array containing the original positions
positionStart_arr = [[200,0],[220,0],[240,0],[260,0]];

// n is the number of clips we have
n = position_arr.length;

// What happens when we click on a clip?
for (var i=0 ; i < n ; i++){
  var clip = this["section"+i]; //section0, then section1...
  clip._x = positionStart_arr*[0];
  clip._y = positionStart_arr*[1];
  clip.num = i;
  clip.onPress = function(){
    // when we click on a button...
    for (var p=0 ; p <= this.num ; p++){
      // all the clips that are before that clip move to their targets
      eval("section"+p).onEnterFrame = function(){
        this.easeTo(positionTarg_arr[p][0],positionTarg_arr[p][1]);
      }
    }
    for (var p=this.num+1 ; p < n ; p++){
      // all the clips that are after that clip move to their original positions
      eval("section"+p).onEnterFrame = function(){
        this.easeTo(positionStart_arr[p][0],positionStart_arr[p][1]);
      }
    }
  }
}

```

More or less… :hangover:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 23, 2003, 10:41am UTC](https://forum.kirupa.com/t/expanding-menu-help/21513/6 "2003-05-23T10:41:05Z")

</div>

Careful is you copy/paste, some lines are broken (there’s a space after the dot, and the end of the line is on the next line).

pom 🙂
