Ok, so i want the script that when you are on a stopped frame, the MC will span other "random" messages made in the libary.
Or some similer way of producing "random" messages already in the libary.
Does anyone know the script?
Ok, so i want the script that when you are on a stopped frame, the MC will span other "random" messages made in the libary.
Or some similer way of producing "random" messages already in the libary.
Does anyone know the script?
Make an array and push all the phrases you want in the array. Then just set the variable of a textbox (where you want the messages to appear), and randomize the length of the array.
At 7/30/06 01:31 PM, Darkfire_Blaze wrote: Make an array and push all the phrases you want in the array. Then just set the variable of a textbox (where you want the messages to appear), and randomize the length of the array.
Er, whats an "array"?
var aText:Array = new Array(
"text1",
"text2",
"text3");
dynamicText.text = aText[Math.round(Math.random()*aText.lengt
h)];
Arrays are a collection of values, accessed in a single variable.
AS: Arrays, by Denvish
Like what Viktor has done above me, you can use it to store a large collection of a single type of data (like, text messages) in a single variable, and access them using aText[x] where x is the value you want to access (starting at 0 going up to the length of the array).
See Denvish's topic for more info.
...
Like what Viktor has done above me, you can use it to store a large collection of a single type of data (like, text messages) in a single variable, and access them using aText[x] where x is the value you want to access (starting at 0 going up to the length of the array).
See Denvish's topic for more info.
I still dont get it.
How do i put a text into an array?
Can someone lay out what to do to make a random message to me in very clear steps.
Im a total noob when it comes to actionscript.
Its like trying to read a foreign language(without any training!)
At 7/30/06 04:41 PM, -Edward- wrote: Can someone lay out what to do to make a random message to me in very clear steps.
Im a total noob when it comes to actionscript.
Its like trying to read a foreign language(without any training!)
...anyone?
Giving people code is like giving coke addicts crack, it only solves the immediate problem.
Within whatever movieclip you're putting this in and on whatever frame you are putting this in, put a text box where ever you want it. Make it a dynamic textbox with the properties inspector. In the low corner, assign it the variable name display. Then, on the timeline in that same frame, put this code.
var messages:Array = new Array(
"Your first message",
"Put them all in double quotes",
"Follow them all with commas",
"Except the last one",
"You can do this as long as you like."
"The last one needs a close parentheses and a semicolon",
"Like this");
var timelimit:Number = The Number of Frames Before It Switches Messages
var countdown:Number = timelimit;
this.onEnterFrame = function() {
countdown--;
if(countdown<=0) {
display = messages[Math.floor(Math.random()*messages
.length)];
countdown = timelimit;
}
}
Ok, that's the code. But please note that if the movieclip you put it in already has an onEnterFrame function, this will erase it in favor of this new one.
Say thank you to the drug dealer.
Actually, change that code a little bit. Where it says
var countdown:Number = timelimit;
change that to
var countdown:Number = 0;
Ok, now say thank you to the drug dealer.
At 8/4/06 05:10 PM, Fat_Lifeguard wrote: Actually, change that code a little bit. Where it says
var countdown:Number = timelimit;
change that to
var countdown:Number = 0;
Ok, now say thank you to the drug dealer.
Thank you drug-dealer. Same time next week?
PS:thanks, the code did work this time.