Solved

random

Posted on 2002-04-09
3
268 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Can't see Flash on IE Windows Apps - Windows 8.1 4 393
EMET 5.2 / Adobe Flash 2 229
Missing Plugin for Firefox - Can't View Content 7 165
Adobe Flash Player ActionScript error 6 60
I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
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.
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.

895 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now