Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Random Function With No Repeat



Guys, I have a big problem

It is to do with randomising which one of 4 frames the movie goes to.
I have a script which randomly selects 1 of four frames.

frames = 4;
frameno = Math.ceil(Math.random()*frames);
gotoAndStop (frameno+1);

But i want it so that it only selects each frame once
If anyone has any idea on how to do this i would be so graftul.

Matt



FlashKit > Flash Help > Flash ActionScript
Posted on: 01-30-2002, 01:41 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Random Repeat
I've got the code for this random banner in my movie. problem is that every so often, the random number generated will be the same number twice in a row, thus getting the same banner, twice in a row.

Could one of you actionscripting wizzards please annotate my code to prevent a number from repeating itself twice in a row?

banners = new Array("1.swf", "2.swf","4.swf","5.swf","6.swf","7.swf","8.swf","9 .swf","10.swf","11.swf","12.swf","13.swf","14.swf" ,"15.swf");
function randomBanner() {
randomNumber = random(banners.length);
loadMovie(banners[randomNumber], "_root.slideshow");
}
randomBanner();

Thank You in advance

Random Repeat Help
Hi there,

I'm trying to repeat a randomly apearing mc. So far I have the mc duplicated 3 times, simple enough;


Code:
for (i=1;i<3;i++){
effect_mc.duplicateMovieClip("effect_mc"+i,i);
}
As for my mc I've added this to it;

Code:
onClipEvent (load) {
_x = Math.random()*750;
_y = Math.random() *460;
}
But I want the mc which contains a short animation to repeat itself in a random position and then looped continously, any help would be appreciated.
thanks - itchyjam

Random No Repeat
Hi

I am in the process of designing a photographers site with a page that randomly displays 10 images from an XML file containg about 100 images the problem is that it can occaisionaly have identical images on the same page. Is there a way of loading the ten images so that they are all different. I have included the code I am using.


Code:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
thumb1 = [];
thumb2 = [];
thumb3 = [];
thumb4 = [];
thumb5 = [];
thumb6 = [];
thumb7 = [];
thumb8 = [];
thumb9 = [];
thumb10 = [];
logo = [];
caption = [];
email = [];
menu = [];
next = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
thumb1[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
thumb2[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
thumb3[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
thumb4[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
thumb5[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;
thumb6[i] = xmlNode.childNodes[i].childNodes[5].firstChild.nodeValue;
thumb7[i] = xmlNode.childNodes[i].childNodes[6].firstChild.nodeValue;
thumb8[i] = xmlNode.childNodes[i].childNodes[7].firstChild.nodeValue;
thumb9[i] = xmlNode.childNodes[i].childNodes[8].firstChild.nodeValue;
thumb10[i] = xmlNode.childNodes[i].childNodes[9].firstChild.nodeValue;
logo[i] = xmlNode.childNodes[i].childNodes[10].firstChild.nodeValue;
caption[i] = xmlNode.childNodes[i].childNodes[11].firstChild.nodeValue;
email[i] = xmlNode.childNodes[i].childNodes[12].firstChild.nodeValue;
menu[i] = xmlNode.childNodes[i].childNodes[13].firstChild.nodeValue;
next[i] = xmlNode.childNodes[i].childNodes[14].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("../tx/wedding.xml");
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
thm1.loadMovie(thumb1[Math.floor(Math.random()*total)], 1);
thm1._rotation = -14;
thm2.loadMovie(thumb2[Math.floor(Math.random()*total)], 1);
thm2._rotation = 0;
thm3.loadMovie(thumb3[Math.floor(Math.random()*total)], 1);
thm3._rotation = 18;
thm4.loadMovie(thumb4[Math.floor(Math.random()*total)], 1);
thm4._rotation = -15;
thm5.loadMovie(thumb5[Math.floor(Math.random()*total)], 1);
thm5._rotation = 0;
thm6.loadMovie(thumb6[Math.floor(Math.random()*total)], 1);
thm6._rotation = 17;
thm7.loadMovie(thumb7[Math.floor(Math.random()*total)], 1);
thm7._rotation = 10;
thm8.loadMovie(thumb8[Math.floor(Math.random()*total)], 1);
thm8._rotation = 0;
thm9.loadMovie(thumb9[Math.floor(Math.random()*total)], 1);
thm9._rotation = -22;
thm10.loadMovie(thumb10[Math.floor(Math.random()*total)], 1);
thm10._rotation = 12;
logo_txt.text = logo[0];
caption_txt.text = caption[0];
email_txt.text = email[0];
menu_txt.text = menu[0];
next_txt.text = next[0];
}
}

Regards Barry

[F8] Random - No Repeat...
I need to get a set of random numbers into an array, but I can't have any numbers repeat. So, as a practical example I will need, say, 10 numbers that all fall between, say, 1 and 50, but I need ALL 10 numbers to be different. Order is not important (lowest to highest, highest to lowest, mixed-up, whatever - as long as there's no duplicates). Does that make sense?...

I currently can get the numbers into the array, but I can't figure out what I need to change to get them to not duplicate. Here's what I currently have:

Code:
var random_arr:Array = new Array();

function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
return randomNum;
}

for (var i = 0; i < 10; i++) {
var n:Number = randRange(1, 50);
random_arr.push(n);
trace(random_arr);
}

Random Int W/out Repeat
hi there,

can someone tell me how i should go about making a function that returns a random int w/out repeating?

i was thinking:


ActionScript Code:
function rand_norep(prev:uint):uint
{
    var pickint:uint = Math.floor(Math.random()*4);

    while(1)
    {      
        if(prev!=pickint)
        {
            break;
        }
        else
        {
            pickint = Math.floor(Math.random()*4);
        }
    }
    return pickint;
}

would this be sufficient?
i'm tracing my output and sometimes i don't see anything...
is this because it could take a while to iterate through w/out a repetition and that may cause the variable to be undefined during that call of the function?

thanks,
f_y

Random - No Repeat...
I need to get a set of random numbers into an array, but I can't have any numbers repeat. So, as a practical example I will need, say, 10 numbers that all fall between, say, 1 and 50, but I need ALL 10 numbers to be different. Order is not important (lowest to highest, highest to lowest, mixed-up, whatever - as long as there's no duplicates). Does that make sense?...

I currently can get the numbers into the array, but I can't figure out what I need to change to get them to not duplicate. Here's what I currently have:









Attach Code

var random_arr:Array = new Array();

function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
return randomNum;
}

for (var i = 0; i < 10; i++) {
var n:Number = randRange(1, 50);
random_arr.push(n);
trace(random_arr);
}

























Edited: 11/14/2006 at 11:52:56 AM by DIY_Lobotomy

Random Frame No Repeat
hello all.

how i would write a frame action that tells my movie to goto a random frame on the root timeline but not to be the one it's on at present. please help as i have NO IDEA! how to do this

thanks alot.

Random Choice, With No Repeat...
I am using Flash MX to create a script that randomly chooses a side of a cube, but has checking to prevent a repeated choice... I am having a heck of a time getting this checking to work... see the code below, maybe someone has some ideas on why it isn't working?

// choose a random cube
function uniqueRandomCube() {
while (randyCube == randyOldCube) {
randyCube = Math.ceil(Math.random()*6);
trace("this is the randycube: " + randyCube);
return randyCube;
}
}
randyOldCube = randyCube;
trace("this is the randyOldCube: " + randyOldCube);

Random Quotes With No Repeat
I have a basic dynamic text box importing random quotes from an external .txt file. How can I get the quotes to display without repeating until all of the quotes have been viewed?

Thanks in advance.

No Repeat With Random Photos
How do I create the prevents from repeating random photos? I have scripts that is working well but needs to stop the repeating...

Here's the XML code:

<!--
'timer' :: number of seconds between each image transition
'order' :: how you want your images displayed. choose either 'sequential' or 'random'
'looping' :: if the slide show is in sequential mode, this stops the show at the last image (use 'yes' for looping, 'no' for not)
'fadeTime' :: velocity of image crossfade. Increment for faster fades, decrement for slower. Approximately equal to seconds.
'xpos' :: _x position of all loaded clips (0 is default)
'ypos' :: _y position of all loaded clips (0 is default)
-->

<gallery timer="5" order="random" fadetime="2" looping="yes" xpos="0" ypos="0">

<image path="images/1.swf" />
<image path="images/2.swf" />
<image path="images/3.swf" />
<image path="images/4.swf" />
<image path="images/5.swf" />
<image path="images/6.swf" />
<image path="images/7.swf" />
<image path="images/8.swf" />
<image path="images/9.swf" />
<image path="images/10.swf" />
<image path="images/11.swf" />
<image path="images/12.swf" />
<image path="images/13.swf" />
<image path="images/14.swf" />
<image path="images/15.swf" />
<image path="images/16.swf" />
<image path="images/17.swf" />
<image path="images/18.swf" />
<image path="images/19.swf" />
<image path="images/20.swf" />
<image path="images/21.swf" />
<image path="images/22.swf" />
<image path="images/23.swf" />
<image path="images/24.swf" />
<image path="images/25.swf" />
<image path="images/26.swf" />
<image path="images/27.swf" />
</gallery>


ACTION SCRIPT:::::



// set random # variables - each must be 0 for first 'while' loop below
var randomNum = 0;
var randomNumLast = 0;

// parent container
var container_mc = this.createEmptyMovieClip("container",0);
// movie clip containers
container_mc.createEmptyMovieClip("loader1_mc",2);
container_mc.createEmptyMovieClip("loader2_mc",1);

// preload watcher
this.createEmptyMovieClip("watcher_mc",100);

// load xml
images_xml = new XML();
images_xml.ignoreWhite=true;
images_xml.onLoad = parse;
images_xml.load("images.xml");

function parse(success) {
if (success) {
imageArray = new Array();
var root = this.firstChild;
_global.numPause = Number(this.firstChild.attributes.timer * 1000);
_global.order = this.firstChild.attributes.order;
_global.looping = this.firstChild.attributes.looping;
_global.fadetime = Number(this.firstChild.attributes.fadetime);
_global.xpos = Number(this.firstChild.attributes.xpos);
_global.ypos = Number(this.firstChild.attributes.ypos);
var imageNode = root.lastChild;
var s=0;
while (imageNode.nodeName != null) {
imageData = new Object;
imageData.path = imageNode.attributes.path;
imageArray[s]=imageData;
imageNode = imageNode.previousSibling;
s++;
}
// place parent container
container_mc._x = _global.xpos;
container_mc._y = _global.ypos;
// parse array
imageArray.reverse();
imageGen(imageArray);
} else {
trace('problem');
}
}

// depth swapping
function swapPlace(clip,num) {
eval(clip).swapDepths(eval("container_mc.loader"+n um+"_mc"));
}

function loadImages(data,num) {
if (i==undefined || i == 2) {
i=2;
createLoader(i,data,num);
i=1;
} else if (i==1) {
createLoader(i,data,num);
i=2;
}
}
function createLoader(i,data,num) {
thisLoader=eval("container_mc.loader"+i+"_mc");
thisLoader._alpha=0;
thisLoader.loadMovie(data[num].path);
watcher_mc.onEnterFrame=function () {
var picLoaded = thisLoader.getBytesLoaded();
var picBytes = thisLoader.getBytesTotal();
if (isNaN(picBytes) || picBytes < 4) {
return;
}
if (picLoaded / picBytes >= 1) {
swapPlace("container_mc.loader2_mc",1);
alphaTween = new mx.transitions.Tween(thisLoader, "_alpha", mx.transitions.easing.Regular.easeOut,0,100,_globa l.fadetime,true);
timerInterval = setInterval(imageGen,_global.numPause,data);
delete this.onEnterFrame;
}
}
}
function imageGen(data) {
// random, or sequential?
if (_global.order=="random") {
// choose random # between 0 and total number of images
while (randomNum == randomNumLast) {
randomNum = Math.floor(Math.random() * data.length);
trace(randomNum);
}
loadImages(data,randomNum);
randomNumLast = randomNum;
} else if (_global.order=="sequential") {
// start at 0, increment to total number of images, then drop back to zero when done
if (p==undefined || p==data.length && _global.looping=="yes") { p=0; } else { break; }
loadImages(data,p);
p++;
} else {
trace ("order attribute in xml isn't correct - must specify either 'random' or 'sequential'");
}
clearInterval(timerInterval);
}
stop();

Help With No Repeat From Random Xml Load
I have a script I've been using on many sites that randomly loads an image from an xml file, and it works great. It loads an image, the image plays for 90 frames, goes back to frame one and repeats.

Now I'd like to enhance it so it doesn't repeat the last image, and I can't seem to get it to work. Any help would be great! Here's my original scritpt:



Code:
imgXML = new XML();
imgXML.ignoreWhite = true;
imgXML.onLoad = function(succes){
if (succes){
images = imgXML.firstChild.firstChild.childNodes;
imageIndex = Math.round(Math.random()*(images.length-1));
imageSRC = images[imageIndex].firstChild.nodeValue;
imageURL = images[imageIndex].attributes.url;
imageTARGET = images[imageIndex].attributes.target;

doMenu(this);
trace(imageSRC + " (" + imageURL + ")" + " (" + imageTARGET + ")");

}
}
imgXML.load("/images/top_banner/top_banner.xml");
function doMenu(xml:XML) {
empty_mc.loadMovie(imageSRC);
main_button.onRelease = function () {
getURL (imageURL, imageTARGET);
}
};

Random Quotes Without Repeat
I have a basic dynamic text box importing random quotes from an external .txt file. How can I get the quotes to display without repeating until all of the quotes have been viewed?

Thanks in advance.

Random Play But Not Repeat
I have a looping function that loads a random sound each time it plays. But how do I prevent a sound from playing two times in a row? I have struggled with my own solutions to this for months and never arrived at a satisfactory answer.

Here's the basic script I'm trying to modify (it's for an obnoxious soft porn e-card). Works fine (the Sound objects are defined elsewhere in the file). But I don't want the same moan to repeat twice in a row, which often occurs.

ActionScript Code:
oohBabe = function () {
    clearInterval(oohBabeID);
    ooh.attachSound("moan"+Math.ceil(Math.random()*6));
    ooh.start(0, 1);
    oohBabeID = setInterval(oohBabe, Math.random()*3000+2000);
};
oohBabe();

Another Random Swf Load Without Repeat
Hi All,
I'm not great at AS and this problem is driving me nuts so I was wondering if any of you wizards could help me out. I've seen lots of threads on this subject but I can't find a definitive solution...

Here goes...
I've got 5 movies so far called image0.swf, image1.swf etc. I'd like to load any of them randomly at the beginning of a parent movie. The time line of each movie matches that of the parent movie so when the parent movie gets to the end and goes back to the beginning, the code in frame 1 will randomly load one of the imageX.swf movies again. The code I have works but it sometimes repeats the same movie 2,3 or 4 times before loading another. How can I stop this repeat from happening?

the code is...

filename = ["image0.swf", "image1.swf", "image2.swf", "image3.swf"];
path = "images/";
i = filename.length;
k = Math.floor(Math.random()*i);
loadMovie(path+filename[k], movieTarget);

PS - there's any empty movie clip with the instance name movie target
- my imageX.swf files are in a folder images/ as shown in the path above

Example page http://www.g3m.info/arccreative/ddl/...randomload.htm

Many Thanks,
Leeg

Random Frames, No Repeat
I have a quiz that starts on frame 5 and ends on frame 14.
I'm trying to get it so when you click the next button it randomly selects a frame between 5 and 14 without repeating. Once the frames have all been done, it goes to frame 15.
I have this code below, but when I click next, the trace currentFrame selects 3 frames at a time. Example: click next button, trace output (5), hit next again,
trace output(5 8 12), hit it again, trace output (5 8 12 14 8 3). So I've only hit the next button 3 times, but it's randomly seleced 6 or more frames.(it changes every time)


Code:
var myarr=[0,1,2,3,4,5,6,7,8,9];
function findNewFrame() {
var num=Math.floor(Math.random()*myarr.length);
gotoAndStop(num+5);
myarr.splice(num,1);
if(num<=1)gotoAndStop(15);
trace(currentFrame);
}

Help anyone?

Thanks

Repeat After Random Delay?
Hello,

I have this movie clip here, except it just loops when it reaches the end of the timeline (as they normaly do :p) Anywho, I'd like it to loop after a random delay.... Between 0, and 3 seconds. I know it has somthing to do with the math.Random() function, but Im a noob to the world of actionscript.
Thanks!!

Hey, just an afterthought here, would it be possible to decrease the time it takes to loop, as it loops more and more.... Like after 10 loops, it randomly selects a number between 0, and 2.5... and after 20 loops; between 0, and 2, and so on, until it loops like a normal movie clip?

Thanks again!

Random Frames With No Repeat
Hey guys!

This time I'm trying to access random frames between 1 and 10. That bit's easy, yay for help files.

function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
return randomNum;
}

btn.onPress = function() {
n = randRange(1,10);
gotoAndStop(n);
}

Now the problem is that I want it to visit each frame only once. So, to check this, I've popped a simple Boolean at the top of each frame called f1, f2, etc, but only for frames 1-5 for checking purposes. Whether it's frames 1-5 or 1-10 doesn't really matter at this point.

My problem is that I need to check that n against the number in my f variables. It's easy to make a string, but how do I check that against a boolean?

frameCheck = "f"+n;
trace(frameCheck);

I keep feeling like I've almost got it, and then the whole concept eludes me. My immediate problem is the checking, but if anyone knows a better way to do the checking, I'd be grateful (that's the only reason I popped it up there).

Thanks heaps!

Help With No Repeat From Random Xml Load
I have a script I've been using on many sites that randomly loads an image from an xml file, and it works great. It loads an image, the image plays for 90 frames, goes back to frame one and repeats.

Now I'd like to enhance it so it doesn't repeat the last image, and I can't seem to get it to work. Any help would be great! Here's my original scritpt:



Code:
imgXML = new XML();
imgXML.ignoreWhite = true;
imgXML.onLoad = function(succes){
if (succes){
images = imgXML.firstChild.firstChild.childNodes;
imageIndex = Math.round(Math.random()*(images.length-1));
imageSRC = images[imageIndex].firstChild.nodeValue;
imageURL = images[imageIndex].attributes.url;
imageTARGET = images[imageIndex].attributes.target;

doMenu(this);
trace(imageSRC + " (" + imageURL + ")" + " (" + imageTARGET + ")");

}
}
imgXML.load("/images/top_banner/top_banner.xml");
function doMenu(xml:XML) {
empty_mc.loadMovie(imageSRC);
main_button.onRelease = function () {
getURL (imageURL, imageTARGET);
}
};

Random Images From Xml With No Repeat
I've a client using the code from source from dominey, but the images sometimes overlap/repeat - so one image may load first several times, and some images may never get to the top position. How can I have this not repeat until all have been viewed.

Here's the AS  - I'm still on MX since I do almost no Flash work.

CODE// set random # variables - each must be 0 for first 'while' loop below
var randomNum = 0;
var randomNumLast = 0;

// parent container
var container_mc = this.createEmptyMovieClip("container",0);
// movie clip containers
container_mc.createEmptyMovieClip("loader1_mc",2);
container_mc.createEmptyMovieClip("loader2_mc",1);

// preload watcher
this.createEmptyMovieClip("watcher_mc",100);

// load xml
images_xml = new XML();
images_xml.ignoreWhite=true;
images_xml.onLoad = parse;
images_xml.load("http://capegazette.com/showcaseNew/showcaseImages.xml");

function parse(success) {
    if (success) {
        imageArray = new Array();
        var root = this.firstChild;
        _global.numPause = Number(this.firstChild.attributes.timer * 1000);
        _global.order = this.firstChild.attributes.order;
        _global.looping = this.firstChild.attributes.looping;
        _global.fadetime = Number(this.firstChild.attributes.fadetime);
        _global.xpos = Number(this.firstChild.attributes.xpos);
        _global.ypos = Number(this.firstChild.attributes.ypos);
        var imageNode = root.lastChild;
        var s=0;
        while (imageNode.nodeName != null) {
            imageData = new Object;
            imageData.path = imageNode.attributes.path;
            imageArray[s]=imageData;
            imageNode = imageNode.previousSibling;
            s++;
        }
        // place parent container
        container_mc._x = _global.xpos;
        container_mc._y = _global.ypos;
        // parse array
        imageArray.reverse();
        imageGen(imageArray);
    } else {
        trace('problem');
    }
}

// depth swapping
function swapPlace(clip,num) {
    eval(clip).swapDepths(eval("container_mc.loader"+num+"_mc"));
}

function loadImages(data,num) {
    if (i==undefined || i == 2) {
        i=2;
        createLoader(i,data,num);
        i=1;
    } else if (i==1) {
        createLoader(i,data,num);
        i=2;
    }
}
function createLoader(i,data,num) {
    thisLoader=eval("container_mc.loader"+i+"_mc");
    thisLoader._alpha=0;
    thisLoader.loadMovie(data[num].path);
    watcher_mc.onEnterFrame=function () {
        var picLoaded = thisLoader.getBytesLoaded();
        var picBytes = thisLoader.getBytesTotal();
        if (isNaN(picBytes) || picBytes < 4) {
            return;
        }
        if (picLoaded / picBytes >= 1) {
            swapPlace("container_mc.loader2_mc",1);
            thisLoader.alpha(_global.fadeTime,100);
            timerInterval = setInterval(imageGen,_global.numPause,data);
            delete this.onEnterFrame;
        }
    }
}
function imageGen(data) {
    // random, or sequential?
    if (_global.order=="random") {
        // choose random # between 0 and total number of images
        while (randomNum == randomNumLast) {
            randomNum = Math.floor(Math.random() * data.length);
            trace(randomNum);
        }
        loadImages(data,randomNum);
        randomNumLast = randomNum;
    } else if (_global.order=="sequential") {
        // start at 0, increment to total number of images, then drop back to zero when done
        if (p==undefined || p==data.length && _global.looping=="yes") { p=0; } else { break; }
        loadImages(data,p);
        p++;
    } else {
        trace ("order attribute in xml isn't correct - must specify either 'random' or 'sequential'");
    }
    clearInterval(timerInterval);
}
container_mc.onPress = function(){
getURL("http://capegazette.powweb.com/listings.php", "_top");
}
stop();

Need To Create 12 Random Non-repeat Variables?
I need to create 12 random numbers (non-repeating) that I can call on one at a time as variables. (Ex. variables a1 thru a12 would be random numbers 1 thru 12). I want to use these later to tell an 12 MC instances to go to one of 12 frame labels and non of them be on the same label.

I've tried it a couple different ways and have come very close but each method has a different bug in it. Can anyone help?

Neo

Attach 5 Random Movies Without Repeat
Hei I have this card game where want to attach 5 random MC from library in diffrent positions without repeating the same MC twice.
Having problems with attatching more then one MC. Please help me!

This is what I got:

onClipEvent (load) {
Deck = new Array();
Cards = new Array();
for (i=0; i<52; i++) {
Deck[i] = ""+(i+1);
}
for (i=0; i<5; i++) {
randomNum = Math.floor(Math.random()*Deck.length);
Cards[i] = Deck[randomNum];
Deck.splice(randomNum, 1);
this.attachMovie(Cards[i], "cards"+i, i);
this._x = 100;
}
}


Thanks a lot!!

Flash Quiz Random? Repeat?
Hi,

I am building a flash test using one of the built-in flash quiz templates.

I have 15 question from which 10 are randomly asked, but the problem I have is that the built in random question function seems to be repeating questions?

This is driving me mad? Anyone ever had this problem?

Stephen

Load Random Movie (no Repeat)
Does anyone know how load non repetative random movies (swf). I want to load ten of them. Please let me know how to do this. Thanks a lot!

Random Frame Prevent Repeat
obj.gotoAndStop(random(8));


this goes to a frame number. eg. on first load, obj frame jumps to 5, next load ,another frame number but sometimes back to 5. because 5 is still within the random condition of 8. how to I prevent a repete?

Repeat Random Numbers Problem
Is there any way of preventing repeat numbers in random number generation?

I’ve tried using the pop function and the delete function on elements in an array which are randomly selected, but can’t get the effect I want. I’ve even tried making two variable values equivalent to each other to try and constrict repetition –but no joy.

Can anyone give me any more ideas? Many thanks.

meandmymachine

Repeat Random Numbers Problem
Is there any way of preventing repeat numbers in random number generation?

I’ve tried using the pop function and the delete function on elements in an array which are randomly selected, but can’t get the effect I want. I’ve even tried making two variable values equivalent to each other to try and constrict repetition –but no joy.

Can anyone give me any more ideas? Many thanks.

meandmymachine

Repeat Sounds With Random Delay
hello,
i'm new here, and not really good, and excuse me for my poor english.
I've a little probleme :

I have to repeat 4 sound with a random delay for each sound.
And those sound can play in the same time.

The movie just do that (it will be put in an HTML pages)
and a "for" bug the flashplayer

Can anyone help me?

Thank you

Load Img Via XML Scale Random Img Up/down, Repeat
Hello guru's and Flash gods. I have a different type of slideshow that I'd like to get finished by tomorrow. Yeah, I know, no time but I've got to do what I can.

Here's the desired effect:

-the movie loads all the images via XML and displays them in a grid of squares

-a random images is chosen and scales up to full size

-pause

-the large images scales back down to its original position and size

-another random image is chosen and the scaling process is repeated indefinitely.

Any ideas? My client is looking to use this for a tradeshow.

Help With Random Images So None Repeat Untill All Have Shown
Hi, I was wondering if anyone can help me with this problem.

I using the following script to randomly attach Movie clips to a empty mc;
//
clipNum = Math.floor((Math.random()*99)+1);
//
name = "img"+clipNum;
//
imageholder.attachMovie("img"+clipNum, name, 1);

I'd like to show all the photos before any of them repeat, (in other words all the photos play only once and only get repeat once all of the 99 fotos have been seen).

I've seen the script using the 'splice' method but I can't get it to work;
nums = new Array();
for (i=0;i<5 - 1;i++) {
nums[i] = i;
} //make an array we'll use for our random numbers

rand = nums.splice(random(nums.length),1)[0]; // gets a random number
//but splice also erases that number from the array so it can't be used again
//then attach that movie
_root.attachMovie("img" + rand, "img1" + rand, rand + 100);

Does anyone have any ideas?

Thanks,

Lenny.

How Do I Load Random Script With No Repeat Instances?
Hello,

I'm not sure how to go about this since I'm fairly new to ActionScript, but I have this script which displays random image and quote. It works fine as is, but how do I make it not repeat any of the items untill it has gone through all of them?

I really appreciate any help you can provide.

Here is the script I'm using now:


choice = Math.round(Math.random()*19);
switch (choice) {
case 0 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb1.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona1.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text1.txt", "_root.firstquote");
break;
case 1 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb2.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona2.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text2.txt", "_root.firstquote");
break;
case 2 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb3.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona3.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text3.txt", "_root.firstquote");
break;
case 3 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb4.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona4.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text4.txt", "_root.firstquote");
break;
case 4 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb5.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona5.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text5.txt", "_root.firstquote");
break;
case 5 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb6.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona6.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text6.txt", "_root.firstquote");
break;
case 6 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb7.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona7.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text7.txt", "_root.firstquote");
break;
case 7 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb8.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona8.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text8.txt", "_root.firstquote");
break;
case 8 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb9.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona9.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text9.txt", "_root.firstquote");
break;
case 9 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb10.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona10.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text10.txt", "_root.firstquote");
break;
case 10 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb11.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona11.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text11.txt", "_root.firstquote");
break;
case 11 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb12.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona12.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text12.txt", "_root.firstquote");
break;
case 12 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb13.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona13.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text13.txt", "_root.firstquote");
break;
case 13 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb14.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona14.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text14.txt", "_root.firstquote");
break;
case 14 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb15.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona15.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text15.txt", "_root.firstquote");
break;
case 15 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb16.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona16.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text16.txt", "_root.firstquote");
break;
case 16 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb17.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona17.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text17.txt", "_root.firstquote");
break;
case 17 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb18.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona18.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text18.txt", "_root.firstquote");
break;
case 18 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb19.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona19.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text19.txt", "_root.firstquote");
break;
case 19 :
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/personb20.jpg", "_root.personb");
loadMovie("http://www.beachbody.com/images/us/local/v3/homepage/flash01/persona20.jpg", "_root.persona");
loadVariables("http://www.beachbody.com/images/us/local/v3/homepage/flash01/text20.txt", "_root.firstquote");
break;
}

[cs3] Function Doesn't Repeat...
I'm making an up button that scrolls the'content' on the page up, the code does what it should do but it doesn't repeat, you have to keep rolling over the button to get the content to the target position. Can anyone help?


ytarget = 0;

up.onRollOver = goUp;

function goUp() {
yMC = getProperty(_root.content, _y);
moveMC = _root.ytarget - yMC;
setProperty(_root.content, _y, yMC + (moveMC/10));


}

Repeat Same Function For Add. Movieclips
Hi !

The enclosed fla-file have a script that does some things to movieclip "mc_1", but how do I repeat the script to do the same thing on other mc's, with an interval of .2 or .4 seconds?

The script:


Code:
import flash.filters.BlurFilter;
import mx.transitions.Tween;
import mx.transitions.easing.*;
//
// Tween(obj, prop, func, begin, finish, duration, useSeconds)
// BlurFilter(blurX, blurY, quality);
//
var clip_y:Number = 50;
//
// the mc starts at position "clip_y" and stays on for x seconds
//
function one_1() {
new Tween(mc_1, "_y", Elastic.easeOut, clip_y, clip_y, 2000, true);

interval_1 = setInterval(two_2, 2100);
clearInterval(interval_4);
}
//
// the mc is blured and moved to a new position
//
function two_2() {
var blur_movieclip = new Tween(mc_1, "blur", Strong.easeOut, 0, 24, .8, true);
var blur_movieclip = new Tween(mc_1, "_y", Strong.easeOut, clip_y, clip_y-80, .8, true);

blur_movieclip.onMotionChanged = function(the_movieclip:Object) {
the_movieclip.obj.filters = [new BlurFilter(0, the_movieclip.obj.blur, 3)];
}

interval_2 = setInterval(three_3, 800);
clearInterval(interval_1);
}
//
// the mc is blured and moved to a new position
//
function three_3() {
var blur_movieclip = new Tween(mc_1, "blur", Strong.easeOut, 43, 46, 1, true);
var blur_movieclip = new Tween(mc_1, "_y", Strong.easeOut, clip_y+115, clip_y-100, 1, true);

blur_movieclip.onMotionChanged = function(the_movieclip:Object) {
the_movieclip.obj.filters = [new BlurFilter(0, the_movieclip.obj.blur, 3)];
}

interval_3 = setInterval(four_4, 1000);
clearInterval(interval_2);
}
//
// the mc is un-blured and moved to a start position
//
function four_4() {
var blur_movieclip = new Tween(mc_1, "blur", Strong.easeOut, 26, 0, 1, true);
var blur_movieclip = new Tween(mc_1, "_y", Strong.easeOut, clip_y+95, clip_y, 2, true);

blur_movieclip.onMotionChanged = function(the_movieclip:Object) {
the_movieclip.obj.filters = [new BlurFilter(0, the_movieclip.obj.blur, 3)];
}

interval_4 = setInterval(one_1, 3100);
clearInterval(interval_3);
}

//
one_1();

Thank you
Ferran

How Do I Use Timers To Repeat A Function, And What Else R They For?
How can I use a timer to repeat a function, and what else do timers "do"

Button To Repeat A Function
I could really use some help, please. How would I add a Close button to a loaded swf/menu to imitate the same action that the click on the image does. I'm referring to the Carousel 3 example, Where the image slides back into position and the rotating starts up again.
I have a popup menu with a close button on it. I would like to close the menu and then the single image on the carousel would move back into position and then the rotating begins again.

Flash MX: How To Create An Array So That The Random Imports Don't Repeat?
Hi,

I have a slideshow movie that attaches, (randomly),
photo MC's at 1 second intervals.
I use the following code on the first frame,
then on the second is a timer and on the fourth
is a loop back to the first.

clipNum = Math.floor((Math.random()*199)+1);
name = "img"+clipNum;
imageholder.attachMovie("img"+clipNum, name, 1);

I would like to be able to create an array or a 'shuffle'
so that none of the images repeat until they have
all been shown, (then it goes and plays from the
start again).

Can anyone please help me do this as I cannot figure
out how to programme it.
(There are 199 images all together)

Thanks for any help.

Thai-English Audio Quiz, Random-no Repeat, ?
first time posting....tried the search box twice but it didn't work properly. (mac os x, safari?)

I already read about the mx 2004 pro quiz templates, but didn't find an answer there. Hopefully someone can point me in the right direction.

I'm creating a Thai-English instruction course. Each 'page' (which i guess will be a MC since i don't want to use 'screens') will have 4 to 8 photographs along with English and phonetic text for the Thai. (ie. 'Hello' = 'Sa-waht-dee')

When the learner clicks an image, the corresponding audio clip will play....that's the easy part I can do.

But I want to have a 'test me' button which will hide the Thai phonetic text fields (which i hope i can figure out) and randomly play from the audio clips for that page.....without repeating.....ie. choosing 1 of 4, then 1 of 3, then 1 of 2, and then playing the last audio clip, so the test gets easier as a process of elimination, but that's ok. When the learner makes a right choice, I want basic feedback ('good job') and then it plays the next random clip.....and if they make a wrong answer, i want it to repeat the audio clip until they click the right answer........

It seems like it will require actionscript unique for each page, since the number of photos and audio clips will vary somewhat,...but perhaps not....I'm a neophyte.
Any help appreciated. thanks
Mike

Call A Function To Repeat Over A Few Different Frames
I would like to be able to call a function from a movie clip so that the function repeats itself over a few different frames without having to be called again. I could have the function call itself according to an "if" statement but I believe that the movie will not go the next frame until it finishes all the cycles. So for example: The function makes the movieclip move over a few pixels but I want it to move over a bunch of pixels so as to give the illusion that it is moving slowly, I To do that the function needs to repeat until the movieclip moves the entire distance, but if that happens all within the function, at least as far as I have been able to figure out, the movie clip simply jumps to the last position without the viewer seeing each step of its movement.
Does anyone know how to fix this?

Drag+drop; 1 Element At A Time, Random Order, No Repeat
I am producing a drag and drop exercise, where the user drags a description of a word, and has to match it with the correct word.

The 7 descriptions appear at random, one at a time, each time the user clicks on the 'generate description' button.

*The problem I am having is that I only need each phrase to appear once and once it has appeared, it cannot be generated again. Instead flash should know this and instantly generate an unused number.

I have been looking at making 2 arrays, one with unused numbers and one with used numbers. However I have never created arrays before and I am stuggling with that.

I can attach the .fla as it will be easier for you to see what I am trying to do, but I am not sure if this is allowed. please advise on this, guys.

Thanks in advance if you can help,
Mark

[MX04] Getting A Function To Repeat/setInterval Problem
Hey gang... this should be the last question for a while.

After some help from the boards, I have created a function that duplicates some MCs, runs the animation, and then removes the clips when they reach a certain point on the _y axis. I need for that function to repeat every so often (let's say 5 secs for this example)... I thought it was a simple setInterval, but it's acting all wonky.

Can someone help me sort it out?

code: condensation = function () {
var condensationNum = Math.round(Math.random()*4)+1;
for (i=0; i<condensationNum; i++) {
attachMovie("drops", "dupMC"+i, i);
this["dupMC"+i]._x = Math.round(Math.random()*200)+500;
this["dupMC"+i]._y = Math.round(Math.random()*155)+195;
var scale = Math.round(Math.random()*50)+50;
this["dupMC"+i]._xscale = scale;
this["dupMC"+i]._yscale = scale;
}
this.onEnterFrame = function() {
with (this) {
for (i=0; i<condensationNum; i++) {
if (this["dupMC"+i].dropMC._y+this["dupMC"+i]._y>525) {
this["dupMC"+i].stop();
if (this["dupMC"+i]._alpha>1) {
this["dupMC"+i]._alpha -= 10;
} else {
this["dupMC"+i].removeMovieClip();
}
}
}
}
};
};
this.onEnterFrame = function() {
myInterval = setInterval(condensation(this), 5000);
};

The problem is that I have 2 onEnterFrames called from the _root, but I don't know where to put the other one. The only things I've got on the stage with instance names are the MCs created within the function, and since I suck at loops I have no idea what how change the pathing of the onEnterFrame found within the function so that I can use the _root for the other one. I hope that makes sense...

Any help is most appreciated!

-Sandy

Repeat A Function X Times? - Crazy Animation...
Hey Everyone!

I am trying to repeat a function x number of times. How do I go about doing that?

Here is the function:


Code:
function dance(){
var animspeed = .4;
var back = 0;
var delay = (animspeed);
var delay1 = (animspeed*2);
var delay2 = (animspeed*3);

body.slideTo(124,304, animspeed, "easeOutSine");
//lowerbody down
body.lowerbody.rleg.rthigh.rotateTo(-30,animspeed,"easeInOutSine");
body.lowerbody.rleg.rthigh.rfoot.rotateTo(40,animspeed,"easeInOutSine");
body.lowerbody.lleg.lthigh.rotateTo(30,animspeed,"easeInOutSine");
body.lowerbody.lleg.lthigh.lfoot.rotateTo(-40,animspeed,"easeInOutSine");
//upperbody flail
body.upperbody.rarm.rotateTo(-70,animspeed,"easeInOutSine");
body.upperbody.rarm.rhand.rotateTo(-30,animspeed,"easeInOutSine");
body.upperbody.larm.rotateTo(70,animspeed,"easeInOutSine");
body.upperbody.larm.lhand.rotateTo(30,animspeed,"easeInOutSine");


//AND BACK!
body.slideTo(124,300, animspeed, "easeOutSine", delay);
body.lowerbody.rleg.rthigh.rotateTo(back,animspeed,"easeInOutSine", delay);
body.lowerbody.rleg.rthigh.rfoot.rotateTo(back,animspeed,"easeInOutSine", delay);
body.lowerbody.lleg.lthigh.rotateTo(back,animspeed,"easeInOutSine", delay);
body.lowerbody.lleg.lthigh.lfoot.rotateTo(back,animspeed,"easeInOutSine", delay);

body.upperbody.rarm.rotateTo(back,animspeed,"easeInOutSine", delay);
body.upperbody.rarm.rhand.rotateTo(0,animspeed,"easeInOutSine", delay);
body.upperbody.larm.rotateTo(back,animspeed,"easeInOutSine", delay);
body.upperbody.larm.lhand.rotateTo(back,animspeed,"easeInOutSine", delay);
}
How could I repeat that function x number of times if I use an on(mousePress) as my event?

Thanks!

Actionscript To Load Random External Movie, Fade In, Wait, Fade Out, Repeat
Hello,
I'm trying to construct some AS3 that will load a random one of several external swf files, fade the instance in, wait 5 seconds, fade the instance out, and load a new random movie (it can be the same one; I don't want to get too complicated at this point).
I could do this with no problem using older methods, but the client insists this is written in 3.
Please help; I'm at my wits end!

Asp For No Repeat Flash For Repeat Visitors?
Hi,

I have a flash animation that I want to execute in full only for first time visitors.  I would like it to jump to the end of the animation for return visitors.  I think this is easiest to do with an asp cookie by sending a parameter such as "recent_visit=yes" to the flash tag.  However, I have no experience with cookies or vbscript.  Any help is much appreciated!

Here's what's in my object tag ...

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0"
                 ID=blue_arrow
                 WIDTH=552
                 HEIGHT=70>
 <PARAM NAME=movie VALUE="blue_arrow.swf?recent_visit=yes">
<PARAM NAME=quality VALUE=high>
 <PARAM NAME=bgcolor VALUE=#FFFFFF>
     <EMBED
                           src="blue_arrow.swf?recent_visit=yes"
     quality=high
      bgcolor=#FFFFFF  
       WIDTH=552
       HEIGHT=70
                           TYPE="application/x-shockwave-flash"
                           PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
    </EMBED></OBJECT>

Thanks!

Cheers,
Jeff

Has Anyone Tested How Random Is The Math.Random() Function?
Just wondering whether anyone out there has ever run any tests on how random the Math.Random() function is as a random number generator?

I've been asked me to test it to prove that it is random and it seems a pointless waste of time, so I'm hoping to get evidence from elsewhere to convince the powers that be that there's no need to run the tests.

I've googled for it but come up with nothing so I'm hoping there might be someone out there who has already done the research?

Random Function & Unique Random Numbers
Hello, after some searching i can't seem to find any good explanation to how and why i should use the Math.random() function so maybe i should explain how a function i need should work and someone maybe has some ideas.

I'm making a guessing program where you guess the right answer.

The function i have now randomly selects a number from 0 to 5 and then put's these five numbers into an array, the thing is that i need the numbers to be unique and i have no idea on how to make this.

Another thing i need to do is between these numbers that the random() function gets one is to be removed and instead i put the right answer there so now i also need one of the randomizes numbers to not be the right answer.

Also, how should a Math.random() function call look like so i can edit the range of numbers to randomize from?

Testing For A Repeat In A "Ranom" Function
Hello,
I have a .fla that has 40 placeholders(empty movieClips) into which I am loading random photos from a bank of 99. This is working except for when I use the random function, some of the photos are being repeated. Is there a way for me to avoid this?

Here is the AS I am using.

for (i=1; i<=40; i++) {
loadMovie("photoIcons/"+random(92)+".swf", "mc"+i);
}

Thanks,
Damien

Start Non-repeat And Then Repeat?
Hey, i would like to make an image fade into appearance and then after that do a repeat of some kind of animation...

In other words have a character appear on screen, and then have his eyes change from red to black in a repeat.

How would i accomplish this? .

How Do U Use Random Function?
i have a password field, which collects passwords from about 20 people. i need to be able to redirect these people to out of falsh movie to a new site depending on their password. for example A goes to site 1, B goes to site 2 and so on.

How is this done??

thanks in advance,
tm

Random Function
Hi,

I am trying to use the randon function to send the needle of a compass to a random position on a circle, i seem to encounter problems because of the negative numbers that inevitably come up the needle then goes crazy. Could it have something to do with the bounce motion that i have scripted into the needle?

Any ideas, here is the code i have been trying:

on (release) {
var myRandom = Math.floor(Math.random()*360)-1
_root.bounce.hand.rotdest = myRandom;
}

Please help, cheers

Richthemarine

Random Function - How?
Hello all,
Ive got this function:

theme1(){
xxx......etc
}

Similiarly ive got 7 more theme functions.

When my movie begins I want to randomly activate one of these themes. I tried but no luck.I ve tried something like:
in frame 1:
randomtheme=random(5);
in next frame:
YO="theme" add randomtheme;
"theme" add randomtheme add "()";
YO add "()";

HELP
miiz

Copyright © 2005-08 www.BigResource.com, All rights reserved