GiveMeCoffee
July 17th, 2008, 08:59 AM
Hi everyone, attached is an xml gallery that I am working with.
I was wondering if anyone could help me out. I want the background color to change for each category. For instance, when the user clicks on 'nature' the background becomes red, with 'people' the background becomes 'purple', etc...
Please see attached.(I had to eliminate some of the images due to file size)
Thanks everyone.
rmcnaugh2
October 16th, 2008, 12:21 AM
A) -the attachment mc_tween2.as file has functions to change the color and tween movieclips.
-make sure to call the mc_tween2.as file in the 1st frame of you fla with this #include "mc_tween2.as" line
1) create an new instance of a movieclip, for example call it bg_mc
2)to get the full screen effect make sure to set bg_mc._width= Stage.width; and bg_mc._height= Stage.height; . Also set the Stage.scale mode with this.
//Define the full scale stage
Stage.scaleMode = "noScale";
Stage.align = "TL";
3) to tween the color, when the user clicks on 'nature' the background becomes red, add this code to fire nature button.
-nature.onRelease = function(){
bg_mc.tintTo(0xFF0000,50,2.5,"easeOutSine");
}
B) Following example changes tint of bg_mc to red (0xFF0000) by 50% in 2.5 seconds with easeOutSine effect
-bg_mc.tintTo(0xFF0000,50,2.5,"easeOutSine");
C) these are the parameters that the tinTo tween has.
Usage
-my_mc.tintTo(color, percent, seconds, animtype, delay, callback, extra1, extra2);
Parameters
-color A number in 0xRRGGBB format.
-percent Amount from 0-100 that a movieclip or textfield's colors are tinted, like in the properties inspector.
D) (0xFF0000) is a hex color change this to change the color
the full code should look like this:
/////// Stage
#include "mc_tween2.as"
//Define the full scale stage
Stage.scaleMode = "noScale";
Stage.align = "TL";
//bg_mc fills the stage
bg_mc._width= Stage.width;
bg_mc._height= Stage.height;
//wherever you want this to fire
nature.onRelease = function(){
bg_mc.tintTo(0xFF0000,50,2.5,"easeOutSine");
}
good luck
rmcnaugh
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.