Solved

random

Posted on 2002-04-09
3
273 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
[X]
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
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
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…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

724 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