View Full Version : changing background color dynamically?
anotsu1
01-21-2009, 12:30 AM
Hello everybody,
i am actually working on a portfolio website. I want the background color change each time we click on a button on the navigation bar. My problem is that when you click on a button it changes the background from the start
(white background), not from the previous one clicked.
i have attached 2 fla files. I couldn't make it work on both
can someone give me an idea or a hint please?
thanks
Deackie
01-23-2009, 03:54 AM
try this:
use a variable to store ther previous bg?
i don't have a Flash at present, would you post your scripts here.
Deackie
anotsu1
01-23-2009, 10:44 PM
hello thanks for your reply
my script is very basic, since i am a newbie in fash.
however here it is :
stop();
function chgAbout(event:MouseEvent):void
{
background_mc.gotoAndStop(1)
}
function chgPrint(event:MouseEvent):void
{
background_mc.gotoAndStop(2)
}
about_btn.addEventListener(MouseEvent.CLICK, chgAbout);
print_btn.addEventListener(MouseEvent.CLICK, chgPrint);
the number (1) and (2) refeer to the frame to play
Deackie
01-24-2009, 04:36 PM
have seen ur zip.
in my opinion,
if you wanna achieve the effect you've described.2 mcs are needed for it.
in detail
the 2 mcs are displayed in the same stage as the buttons, used as background container, so you can attach needed background mc in the library by its linkage ID.
For instance, you click about_btn, then print_btn, the codes will swap the depths of the 2 mcs so that the one attaching bg for print_btn will be over the other.
So sorry that time is so pressing for me now.
Just try this out for yourself, i guess it's a nice solution
:)
Deackie
Deackie
01-25-2009, 03:23 AM
you must be a friend from Japan?
:rolleyes:
this may not be the best solution, but i hope it will give you better thinking ands enlightenment
:)
By Deackie, From China
maybe you should make some modifications to my solution so as to get a beautiful effect, such as making buttons disabled when the background is changing, oand making, say, about_btn disabled when the background's already been made for the very button.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.