ActionScript 2.0 :: How To Create Random Red Colour
Oct 23, 2005So what I'm trying to do is create a random red colour. I thought it would be as easy as
Math.random()*0xFF0000
So what I'm trying to do is create a random red colour. I thought it would be as easy as
Math.random()*0xFF0000
I want to create a flash document that allows me to change the colous of an image using a colour palette of my own. I am a complete beginner and have no idea where to start this, hence i would need to know what to do and how to do it. I basically want the image to be a simple 2d image that i will create using different layers in photoshop and import them into flash, the layer images will all be one colour so the colour of the whole layer changes. so the colour palette will be on the side of this and when i click on an image and then a colour the image changes to the colour i clicked.
View 3 RepliesI'm currently adapting the flash file "levTextSpace" from [URL]. Everythings working fine except for one teensy weensy little problemette. I want to be able to assign a random colour to each word as it appears on stage. The generic code I have for this is:
var myColor = Math.round(Math.random()*0xFFFFFF);
myRdmColor = new Color ("target");
myRdnColor.setRGB(myColor);
"target" being the name of a movieclip. I'm assuming I need to apply this to each instance as it's created but anything I try either doesn't work at all or crashes. I'm completely stuck, I'm sure it can't be that difficult but after several days ny head hurts.
i've a movie clip (e.g. scroll_text) which is consist of 5 words (each word is an individual movie clip). an instance of 'scroll_text' movie clip placed in the main timeline with the following script:
onClipEvent (enterFrame) {
_x -= 30;
if (_x<=-2247) {
[code].......
I'm using this code for tweening:
ActionScript Code:
var myTween:Tween = new Tween(star, "alpha", Strong.easeOut, 0, 0.9, 3, true);
And I also have some extra code that spawns stars all over the place.If you view my swf, http:[url]...., you can notice that the stars appear to 'flash' first before settling down.I'm simply wondering if this is some problem of the Tween class or if I set something wrong. Something I found odd was when I removed my code that generated a random colour for my star,
ActionScript Code:
//var myColor:ColorTransform = this.transform.colorTransform;
//myColor.color = Math.random()*0xFFFFFF;
//star.transform.colorTransform = myColor;
, the flash doesn't happen. Is it a visual effect that causes it to look like it's flashing or is it really?
Making a random number between lets say 0 and 99 is relatively straight forward using the Math.random class What is the best way to create 100 unique random numbers from between 0 and 99 where no random number is repeated?Would I make a random number, chuck it into an array then the next random number created is checked against the array, and if the number has been created before try for another number?
View 2 RepliesI want to create a preloader that is essentially a block of colour moving across the whole stage (610 x 300 pixels) - i don't want it to show the percentage loaded, just the colour will move across the screen and obviously when it reaches the other end, that will indicate that it has loaded all the external swfs and goes onto play them....
View 2 RepliesI have managed to create a method which changes the colour of a line.I now...need a seperate method which changes the thickness of the line, however whatever I try messes up.[code]
View 1 RepliesHow can i create a random number without using Math.random() I think this can be done with a array... i just don't know how.
i need it for a google banner. they don't allow Math.random() of random() in the sript
I have a bitmap and it set to black and white using a colorMatrixFilter. Im trying to create an effect that will tween the bitmap from black and white to colour.
View 5 RepliesI need to allow the user to create a circle with a specific radius and colour in a certain frame (lets say frame 2), and then add that circle as a symbol to a different frame (say frame 1). First off, im simply creating a circle.. This is what ive got in frame 2 so far:
(in Frame 2 of the timeline)
Code:
stop();
import flash.display.DisplayObject;
import flash.display.Graphics;
import flash.display.Shape;
[code]....
Ive got this much working, but I dont understand how to convert the output of this function to a symbol usable in another frame..
I am parsing colour codes that I get from a Flex(Flash ActionScript) application, then creating HTML div elements with that same colour. My Problem: The colours are all only 8 digits long. So they cant be RGB colour values can they? What color value format are they in? If I can figure the format they are in I can convert them to RGB. Maybe the last/first digit signifies its 0. alpha value?
PS: Should I convert the colours to RGB or something else?
This is an example of the colour code values I getting from the flash application:
i have a background and i want to be able to change the colours of it using a colour picker... if the MC was to cover the whole stage... how could i then get a colour picker and make it so it would change to whatever colour i wanted from the colour picker?
View 5 RepliesI want to create a button with an image that i have and i want this image to make a rollover effect from greyscale to colour....how is that done?
View 0 RepliesI need to change all the elements in my movie that have the color X and change their color to color Y. Is it possible to have this in AS? like, if i press one button all the elements that have the color black (graphic, text, background, etc) change their color to yellow?
View 1 RepliesI have created a flash ad, that cycles through 3 different ads, in order, always starting at 1.
I'm trying to find script to generate a random number, say between 1 and 3. Then, based on that number, it will start playing at a predetermined frame. [code]...
I'm looking to create a random number that is between -3 and 3
View 1 RepliesHow would I create a random number that is between 0 - 360, that is also divisible by 45? I have 8 spots on a wheel that I want to stop at randomly with a button click.
View 4 RepliesI'm creating a series of banners for a website. There are 3 so far with more to be made. I have made each banner as a separate swf file.The thing I would like it to do it create a randomly ordered array of the banner swf names and then load the banners in that order. Once the banners have been played or loaded through, I would l simply like it repeat that same order again.I have managed to create an array and play through that array in an ordered loop, but how do I create a random array that will do the same thing?[code]
View 1 RepliesI need some actionscript that will give me a random number between -50 and 50. Been looking at it for a while now.
The main thing is, I need to create a random value which could be a neg or a positive number, on every frame. So far I can create a random value, but can't get it to be neg one frame and positive the next.
Yes i used the search feature and found a topic for it, but the link they said the help was on, did not work..How can i create random pictures?
View 8 RepliesI have a simple multiple question quiz with 100 questions. I want the questions to be randomly asked, without repeating a questions as the end works on a scoring system out of the 100 so it needs to ask all the questions.Question one starts on frame 5 of the timeline and the last question is on frame 105.
View 1 Replieshow to create a random name picker in flash?
View 2 RepliesI have a simple multiple question quiz with 100 questions. I want the questions to be randomly asked, without repea ting a questions as the end works on a scoring system out of the 100 so it needs to ask all the questions. Question one starts on frame 5 of the timeline and the last question is on frame 105.
how to write this script with the checks?
What's a simple way to generate random numbers with a range?
View 2 Replies[code]I follwed i tutorial the other day on how to create random bubble movement snd it works but the bubbles generate across the page, but i just want them to generate between around 300 x 500 pixels
View 8 RepliesI want to create a random name generator from a list of certain names seems simple but i'm not really sure [code]...
View 2 RepliesHow can I create a sprite with a random array?
Code:
var ball:Array = new Array();
var currentBall:Number = Math.random();
Now I want to create a sprite with ball[currentBall]
What I am trying to do is have it so that I can keep creating sprites from a random number like if i wanted every time a user pressed a spacebar to create a new sprite.Is array the best way to do this?
This seems quite easy, but I'm not that good with Flash, so it'd be really gr8 if anyone can help.I'm trying to create an array of random unique numbers from 0 to 39 so that I can list these numbers in a countdown and without repetition, ie: 25, 29, 11, 03, 17 etc.These are 40 different numbers, equal or greater than 0 and equal or less than 39.
View 7 RepliesAnyone knows how I can do a simple slot machine which can pick random names based on the names I put in the text area?
It is almost similar to this [URL]
But I want the chosen name to be in the middle instead of the top and more random.