# Expanding menu

**URL:** <https://forum.kirupa.com/t/expanding-menu/241429>\
**Category:** Uncategorized\
**Created:** [October 13, 2007, 9:39pm UTC](https://forum.kirupa.com/t/expanding-menu/241429 "2007-10-13T21:39:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreas\_h87](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@andreas\_h87](https://forum.kirupa.com/u/andreas_h87)\
**Post date:** [October 13, 2007, 9:39pm UTC](https://forum.kirupa.com/t/expanding-menu/241429/1 "2007-10-13T21:39:49Z")

</div>

Hey everybody, i’m currently working on a small flash menu which i derived from a expample by [Ladislav Zigo](http://laco.wz.cz/tween/?page=examples). The example is called scalling pages.

My prototype uses an array to get the number of the existing menue buttons and it works with six. However if i add a sevent point, the menu doesn’t work. Maybe somebody can help me.

Thats how it looks like:  
Window size is

- width 690px
- height 200px

That’s the code inside the first frame

```auto

#include "lmc_tween_as1.as"

clip = this.createEmptyMovieClip("holder", 0);
clip.onEnterFrame = update;
menue = ["01: home", "02: about", "03: ...", "04: ...", "05: ...", "06: ..."];
spalten = menue.length;
depth = 0;
pages = [];
stagewidth = Stage.width;
pagewidth = stagewidth/spalten;
minpagewidth = 20;
maxpagewidth = stagewidth-(spalten-1)*minpagewidth;

for (var j = 0; j<spalten; j++) {
    var page = clip.attachMovie("page", "page"+depth, depth++);
    pages[j] = page;

    page.j = j;

    page.transform_mc._width = pagewidth;
    page.transform_mc._height = 500;
    page._x = pagewidth*j;
    
    ///////////////////////////////////////////////////////
    /*
    page.transform_mc._alpha = (15*j);
    */
    //////////////////////////////////////////////////////
    
    myColor = Math.round(Math.random()*0xFFFFFF);
    myColoredObject = new Color(page.transform_mc);
    myColoredObject.setRGB(myColor);
    
    /////////////////////////////////////////////////////

    page.createTextField("my_txt",100,5,175,100,100);
    my_txt.multiline = true;
    my_txt.wordWrap = true;

    my_fmt = new TextFormat();
    my_fmt.font = "Verdana";
    my_fmt.color = 0xFFFFFF;
    my_fmt.bold = true;

    page.my_txt.text = menue[j];
    page.my_txt.setTextFormat(my_fmt);

    ////////////////////////////////////////////////////

    page.onPress = function() {
        zoomTo(this);
    };
}

function update() {
}

function zoomTo(page) {
    var destw, destx;
    for (var j = 0; j<spalten; j++) {
        if (j<page.j) {
            destw = minpagewidth;
            destx = j*minpagewidth;
        }else if (j>page.j) {
            destw = minpagewidth;
            destx = (j-1)*minpagewidth+maxpagewidth;
        } else {
            destw = maxpagewidth;
            destx = j*minpagewidth;
        }
        pages[j].tween(["_x", "_width"], [destx, destw],0.5,"easeinoutcircle");
    }
}

```

Furthermore I have two movieclips  
**transform\_mc** ; includes a **square size 100px x 100px centered** to all coordinates  
**page\_mc** ; includes the **transform\_mc** coordinates **x 57.5 y 50 instance name transform\_mc** , the properties of page\_mc are Identifier \*\*page  
\*\*  
Thanks Andy
