Hey everybody, i’m currently working on a small flash menu which i derived from a expample by Ladislav Zigo. 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
#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