Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

random

Posted on 2002-04-09
3
270 Views
Last Modified: 2010-04-03
dear experts
i have a little problem with a random
i have some figure i attach it to movie clip with a random color and i have some other 6 movie clip it's root deffrent than the root figure
what i want to color these movie clip with the same color
 i color the figure


0
Comment
Question by:yaco
3 Comments
 
LVL 1

Accepted Solution

by:
chill0123 earned 50 total points
ID: 6978401
I am not quite sure what you are asking, but if you want to randomly display a different color each time a movie clip loads, you need to use a "randomizer" script and some variables to display a new color each time the page has been refreshed...

start by adding the below script to the first frame of a movie clip or button (on release):

onClipEvent (enterFrame) {
x = (Math.round(Math.random()*6));
     if (x == 1) {
          objColor = new Color(_root.frameColor2);
          objColor.setRGB(0x930000);
     } else if (x == 2) {
          objColor = new Color(_root.frameColor2);
          objColor.setRGB(0x666666);
     } else if (x == 3) {
          objColor = new Color(_root.frameColor2);
          objColor.setRGB(0xCC0000);
     } else if (x == 4) {
          objColor = new Color(_root.frameColor2);
          objColor.setRGB(0x330000);
     } else if (x == 5) {
          objColor = new Color(_root.frameColor2);
          objColor.setRGB(0xFF0066);
     } else if (x == 6) {
          objColor = new Color(_root.frameColor2);
          objColor.setRGB(0x339900);
     }
}

------------- end code ----------------

frameColor2 is the instance name of the movie clip that will have the background color change...

chill




0
 
LVL 6

Expert Comment

by:rootdir
ID: 6989940
See this good example for choose random color

http://www.kirupa.com/developer/flash5/randomcolor.asp
0
 

Expert Comment

by:SpideyMod
ID: 8302626
Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question