Jump to content

Recommended Posts

Guest scopes
Posted

Hey everyone,

 

I am just beginning to learn the basics of creating web sites in flash.

 

I have been following a tutorial and have it done pretty well, but they only cover one main button, and I am at the point where I need several more, but I am doing something wrong.

 

What I want to do specifically is to add probably 4 other main buttons that can also have drop down menus. Please be as specific as possible because the extent of my code knowledge isn't very far.

 

I attatched the .fla

 

Thanks in advance

 

The code for the main page is as follows:

 

menu = ["About", "Bio", "Contact"];

this.createEmptyMovieClip("content", 1000);

this.attachMovie("sectionBackground","mask",1001);

mask._y = content._y=208;

mask._x = target=68;

content.setMask(mask);

content._x = -1000;

imageScrollSpeed = 5;

xStart = 125;

yStart = 51;

bWidth = 79;

bHeight = 17;

interval = 50;

countDown = menu.length;

menuOpen = false;

theTime = 0;

buttonScrollSpeed = 2;

for (var i = 0; i<menu.length; i++) {

var section = content.attachMovie("section_"+menu, "section_"+menu, i+100);

section._x = section._width*i;

var b = this.attachMovie("subButton", "subButton"+i, countDown);

countDown--;

b.stop();

b._x = xStart;

b._y = ySwtart;

b.interval = interval*i;

b.target = yStart+(bHeight*i);

b.txt = menu;

b.pos = target+(i*-section._width);

b.onPress = function() {

target = this.pos;

closeMenu();

this.gotoAndStop(1);

};

b.onRollOver = function() {

this.gotoAndStop(2);

};

b.onRollOut = function() {

this.gotoAndStop(1);

};

b._visible = false;

}

function closeMenu() {

for (var i = 0; i<menu.length; i++) {

var b = this["subButton"+i];

b._visible = false;

b._x = xStart;

b._y = yStart;

}

menuOpen = false;

}

mainButton.onPress = function() {

if (!menuOpen) {

theTime = getTimer();

menuOpen = true;

for (var i = 0; i<menu.length; i++) {

_root.main["subButton"+i]._visible = true;

}

} else {

closeMenu();

}

};

mainButtoncopy.onPress = function() {

if (!menuOpen) {

theTime = getTimer();

menuOpen = true;

for (var i = 0; i<menu.length; i++) {

_root.main["subButton"+i]._visible = true;

}

} else {

closeMenu();

}

};

function scrollButtons() {

if (menuOpen) {

for (var i = 0; i<menu.length; i++) {

var b = this["subButton"+i];

if ((theTime+b.interval)<getTimer()) {

b._y += (b.target-b._y)/buttonScrollSpeed;

}

}

}

}

this.onEnterFrame = function() {

content._x += (target-content._x)/imageScrollSpeed;

scrollButtons();

};

FLA.zip

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...