random color code in navigation menu
#include "lmc_tween.as"
menuCount = 3;
menuTitleArray = ["", "John", "Tim", "Michael"];
function decToHex(dec) {
var hexStr = "0123456789ABCDEF";
var low = dec%16;
var high = (dec-low)/16;
hex = ""+hexStr.charAt(high)+hexStr.charAt(low);
return hex;
}
function getRandomColorCode() {
var colorCode = "0x"+decToHex(random(255));
colorCode += decToHex(random(255));
colorCode += decToHex(random(255));
return colorCode;
}
function colorDice(mc:MovieClip) {
mc.colorTo(getRandomColorCode(), 1.5, "easeOutCubic", 0);
}
for (var k = 0; k<menuCount+1; k++) {
var target = eval("menu"+k);
target.title.shows.text = menuTitleArray[k];
target.id = k;
target.onRollOver = function() {
this.bg.tween("_width", 300, 0.5, "easeOutBounce", 0);
this.bg.colorTo("0xffff00", 0.5, "easeOutBounce", 0);
};
target.onRollOut = function() {
this.bg.tween("_width", 104, 0.5, "easeOutBounce", 0);
this.bg.colorTo("0x000000", 0.5, "easeOutBounce", 0);
};
target.onRelease = function() {
trace("menu "+this.id+" pressed!");
};
target.rollColorDice = setInterval(colorDice, 2000, target.bg);
target.rollColorDice = setInterval(colorDice, 2000, target.title);
}
get random color code in hex, and attach that color code to navigation menu.
About this entry
You’re currently reading “random color code in navigation menu,” an entry on multiplicité
- Published:
- Friday, August 26th, 2005 at 4:33 pm
- This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0 Korea.
- Author:
- vizualizer
- Category:
- techne
- Tags:
- actionscript 2.0, color, flash
Similar Posts
- links on color
- 10진수를 16진수로 변환
- delete
- kill the drawing of focus border on any component
- random number in specific range
- What’s new in action script v2_Button.menu
- print special characters in random
- variablization of aesthetic subject in the computer-based media art
- 랜덤한 컬러코드의 생성
- MovieClip tweening prototypes 1.1.8
No comments
Jump to comment form | comments rss