Monday, June 11, 2012

[Action Script] button click problem June,2012

Hi everybody,

New to flash/actionscript so forgive me if I am not following protocol and/or standards. Here is my problem:

layer: buttons
..
..
layer: curtains
layer: content
..
..
layer: stage

Curtains (already opened) are loaded with the home page content behind it.
When a button is clicked it needs to close the curtains (with the current content behind it), switch content with target content and then reopen the curtains.

This is what I have in code:

[AS]home_btn.addEventListener(MouseEvent.CLICK, loadAbout);
bio_btn.addEventListener(MouseEvent.CLICK, loadBio);
films_btn.addEventListener(MouseEvent.CLICK, loadFilms);
pics_btn.addEventListener(MouseEvent.CLICK, loadPics);

function loadAbout(evt:MouseEvent):void
{
curtains_mc.gotoAndPlay(1);
curtains_mc.gotoAndPlay(1);
content_mc.gotoAndPlay(1);
}
function loadBio(evt:MouseEvent):void
{
curtains_mc.gotoAndPlay(1);
curtains_mc.gotoAndPlay(1);
content_mc.gotoAndPlay(2);
}
function loadFilms(evt:MouseEvent):void
{
curtains_mc.gotoAndPlay(1);
curtains_mc.gotoAndPlay(1);
content_mc.gotoAndPlay(3);
}
function loadPics(evt:MouseEvent):void
{
curtains_mc.gotoAndPlay(1);
curtains_mc.gotoAndPlay(1);
content_mc.gotoAndPlay(4);
}[/AS

Problem(s):

When button is clicked, it loads target content immediatley, and then closes/open curtains.
When same button is clicked again, it loads unrelated content.

I need it to show current content then load new content after curtain is closed. Also, I need it to not do anything if current content is the target content.

Hope this makes sense. Any help would greatly be appreciated.
button click problem

Related Post



0 comments: