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




Repeat Animation



ok i have this input text box, and i need to now an action script that will repeat the animation as much as the number i type in the text box. please help.



ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 06-19-2006, 08:59 AM


View Complete Forum Thread with Replies

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

How Repeat A Part Of An Animation?
i have an animation which contains 30 frames. it has two layers. the first layer has animation till the last frame but the second layer has animation only till the 3rd frame.. now i want the second layer to repeat itself its animation(3 frames) for 10 times till the movie reaches the end(30th frame).. how to do this? do i need any technique using action script?.. please help out..

Button Animation Repeat Problem
hello there

i searched for this as i thought there would be hundreds of threads on this but i couldnt seem to find an answer

i have a movieclip inside a button for my rollover animation.

when you click on the button it plays a sound but it also replays the rollover animation.

how can i set my button up so that it will only play the animation once until the mouse has left rollover area and re-entered it again?

thanks in advance

How To Make Background Animation Repeat?
Please help me with this. Thanks.

I am trying to make the background loop again and again.
e.g. The background text "Happy Happy Happy Happy" will move from left to right again and again endlessly looking slowly and smooth.

I tried doing use tweening but as the frame start from frame 1 again, it will blink then loop again.. this is not smooth.

Is there any coding that anyone can help me with.

Thanks.

HELP How Do I Hold So Many Frames After Animation Then Loop Again (repeat)
HELP! How do I hold so many frames after animation then loop again (repeat)

I want my animation to play......hold for 20 secs or so then repeat. How do I do this in swish?

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!

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

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? .

Repeat Only Once?
Ok heres the deal. I made a Flash Footer for this site (well a new 1) and i want it to go from frame 1 to frame 40 back to frame 1 then continue ALL the way to the end (frame 60) and then repeat the WHOLE movie. I've been messing around with variables and stuff but its not working :- any help?

Repeat
Is There a action script code to reat a object in trhe middle of a movie while other stuff goes on.

Repeat .AVI Help
Hi. I am beginner and I am wondering, How do you repeat .avi files? My flash intro right now is about 783 frames, and I want it to repeat frames 716-783. Thanks alot!

Repeat Flv
Hi,
i use net stream to play flv file which i want to start over when it ends
how can i know it ended is it the netStream event or the video evet
when i tried:

videoStream = new NetStream(videoConnetion);
video = new Video();

videoListener = new Object();
videoListener.complete = onComplete;
video.addEventListener("complete",onComplete);

metaListener = new Object();
metaListener.onMetaData = onMetaData;
videoStream.client = metaListener;

videoStream.play(videoName);
video.attachNetStream(videoStream);
addChild(video);

it never entered the onComlete function ??

thanks in advance
in wonder

Repeat MC
How do I repeat movie clip a specific number of times? say 3X's

say MC is named "Roller"
has anyone done this?

Repeat A Frame?
What should I script to make a frame repeat itself? One thinks that simply putting gotoAndPlay(1); (if _currentFrame is frame 1) and that should be it. But it's not.

Randomize Without Repeat.
I may have asked this before, but lost the thread.
Is there a code to get a random number, without repeating a number twice in a row? i.e 1,8,9,3,5,6,7,4,2 not 1,1,8,9,3,5,6,7,4

Repeat Movieclip?
i have a button who has a movie clip in, the movie clip has a text, that go down and then go up with alpha effect, but i needto copy this movie clip to make many similars, but ineed the text it has be diferent, because if i duplicate the movio clip and if i change the text it change for all movie clips please helpme,

Sergio Garcia, Aguascalientes, Mexico

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

Repeat Script (FLA-REM)
I use flash remoting and I want to check my CFC every 5 or so seconds well i want it to check perpetually anyhow. Below is my script im not sure how to get this to check repeatedly. This is all on a blank layer in frame 1.

-----------------Actionscript-------------------

// Include the Required NetService class files
// Uncomment the following include for debugging purposes only:
// #include "NetDebug.as"
#include "NetServices.as"
#include "DataGlue.as"
// Connect to the Flash Remoting service
if (isGatewayOpen == null) {
isGatewayOpen = true;
// Make the Gateway connection
NetServices.setDefaultGatewayUrl("http://192.168.100.54:8500/flashservices/gateway");
gatewayConnnection = NetServices.createGatewayConnection();
// Initialize a variable to contain the data passed back through Flash_CF.cfc
topfx = gatewayConnnection.getService("wallrich.method.COM .topfx", this);
trace("Connected");
// Access the getPageAll method availble now through flash_cf
topfx.alerts();
trace("sent request");
}

function alerts_Result(result) {
trace("this is item1 of myStruct: "+result.quoteStat)
quotealt = result["quoteStat"];
_root.quoNum = result["quoteNum"];
_root.Sessions = result["Sessions"];
_root.Agent = result["currentAgent"];

if (result.quoteStat == 1){
trace ("pass");
_root.quoteAlert._x = 580;
_root.quoteAlert._y = 28;
}
else{
trace ("fail");
_root.quoteAlert._x = 580;
_root.quoteAlert._y = -32;
}

}

------------------------------------------------

thanks

Zeke

How Do I Get An Action To Repeat?
well the title pretty much speaks for itself... but i would like to know how to get something like this

on (rollOver) {
_root.slider._y += movespeed;
}

to repeat itself over and over and over again until you take your mouse off of the button...

any help would be GREAT...

thanks,
CRG

How Do I Get An Action To Repeat?
how might i go about getting something like this

on (rollOver) {
_root.slider._y += movespeed;
}

to repeat non-stop until i take my mouse off of the button it's applied to...

thanks,
CRG

While() Can It Repeat Symbols?
Is there a way to repeat a mc a certain number of times based on a variable? i assume i would use while() to do this but im not sure how i would repeat the movieclip? also, if i can do that, how could i send a set variable to each mc.

Repeat... STOP
I have a basic script that picks a random number, between (user picks), but I also want it to be able to pick 30 random numbers at once. I don't know how to go about this, what would you recomend... (the # comes from a text input field. (that can be changed.)

On(mouseDown) Needs To Repeat Or Something
I am making a game that has an automatic weapon AK47.... i want it so the user can hold down the mouse button and move the Aimer (mouse) to multiple objects and kill those objects. now i can make the gun shoot automatic, but if i hold down the mouse button it will only kill 1 object per click.. i need it to kill multiple objects per click... here is some code

onClipEvent(mouseDown) {
if (_root.currentgun == "ak47") {
_root.ak47.gstatus = "fire";
if (_root.ak47.ammo > 0) {
if (this.hitTest(_root.mark)) {
_root.mark.movespeed = 0;
_root.mark.mstatus = "dead";
}
}
}
}

so yeah that only lets me kill 1 guy even though the gun is firing like mad... now there are no bullets involved to do the hit test with, and would prefer to keep it that way.. While loops just give me an infinite loop error...

thanks

Repeat ASAP
How would i make a layer of a scene Repeat itself as many times as i like (Infiniate) please Help ASAP

Making A MC Repeat Only Twice?
I have a movie clip in my movie and when the movie plays i want the movie clip to play twice, or maybe three times then continue on through the time line i don't have a clue about actionscript so any help would be greatly appreciated.

Thanx
Mr.Brown

Making An MC Repeat
I have an MC that has a small mask affect in it.
I want it to repeat say... every 10 seconds.
Ive tried all sorts of AS to make this happen, but I am having no luck.
I know it has something to do with miliseconds, but I just cant get it.
I attacehd the .fla.
Thanks

Action Repeat
Can someone tell me how to have an action repeat itself based on the loading of the next frame? Example (action, load image, action, load image)

Thanks!

Mp3 Player Not To Repeat
I've downloaded a flash mp3 player that loads external mp3s from the movies section of this site and I'm having an issue with with initial seeting of the playback. It is automatically repeating songs as the default setting whereas I would like the tracks to play right thro just like a cd player would. I've tried reading the included instructions but they're a bit beyould my grasp at this stage any help would b much appreciated..Enclosed is code for movie clip that handles on load event...actionscript 1...thanx





Code:
onClipEvent (load) {
//set the status of player
_parent.visual.Status = "play";

//set new global sound object
snd = new Sound(_root);
_parent.bn_text = "";
_parent.artist_text = "";
_parent.title_text = "";
}

onClipEvent (enterFrame) {
//check to see if there is a rollover on the playlist
if (_parent.artist_text<>"") {
_parent.ArtistInfo = _parent.artist_text;
} else {
//add Artist value
_parent.ArtistInfo = _parent.menuItems[0].Artist;
}
if (_parent.title_text<>"") {
_parent.TitleInfo = _parent.title_text;
} else {
//add Title value
_parent.TitleInfo = _parent.menuItems[0].Title;
}

//set the current playtime text to minutes and seconds according to currentframe
_parent.playfr = _parent.music._currentframe;
playtime = int(_parent.playfr/10);
min = int(playtime/60);
sec = playtime-min*60;
sec = sec<10 ? "0" add String(sec) : String(sec);
min = min<10 ? "0" add String(min) : String(min);

//set the current scale of the playhead and buffer bar according to frames in the sound movie
_parent.playhead._xscale = (100/_parent.music._totalframes)*_parent.music._currentframe;
_parent.loadedfr = this.music._framesloaded;
_parent.loader._xscale = (100/_parent.music._totalframes)*_parent.music._framesloaded;

//set the pan and volume inital settings
snd.setPan(_parent.pan.value*2-100);
snd.setVolume(_parent.volume.value);

//set the text in the info panel and value from values on the drag clips
if (_parent.volume.drag) {
_parent.info = "volume:" add Math.round(_parent.volume.value) add "%";
} else if (_parent.pan.drag) {
_parent.info = "pan:" add Math.round(_parent.pan.value*2-100) add "";
} else if (_parent.bn_text<>"") {
_parent.info = _parent.bn_text;
} else {
//add playtime value
_parent.info = "playtime [" add min add ":" add sec add "]";
}
//tell the player what to do with different repeat settings
if (_parent.playfr == _parent.music._totalframes) {
if (_parent.repeat == "track") {
}
else if (_parent.repeat == "all") {
if (_parent.index == (_parent.menuItems.length-1)) {
_parent.index = 1;
}
else {
_parent.index++;
}

_parent.toTop(_parent.index);

}
else if (_parent.repeat == "off") {
_parent.music.gotoAndStop(1);
_parent.visual.Status = "stop";
}

}
updateAfterEvent();
}

Layer Repeat?
Man I love learning...not!lol Ok here another prob I got, I have a layer with animation i want to repeat thru the whole movie. But if i use gotoandplay then frame 1 the rest of my movie doesnt play. So what Im wondering is there away to make a layer repeat itself with the rest of the movie playing?


Im sure this is something simple with action script I just havent found the solution for it yet!


Thx for any help all!

Doesn't Repeat
I want my line to be drawn from (275, 300) to xmouse and ymouse, which I did fine. But, it only draws the line once, I want it to repeat every frame. This is one of those no-brainer answers I'm sure, I just don't have that much experience in Actionscript. Thank ya kindly!

graph = function(x, y) {
var line = this.createEmptyMovieClip("Drawline", 0);
line.lineStyle(3.5, 0xFFFFFF, 100);
line.moveTo(x,y);
line.lineTo(275,300);
}

graph(this._xmouse, this._ymouse);

Repeat Action
Attached is a fla-file with three movieclips. They perform an action which I would like to keep repeating itself. I think a for loop would do the job, but I don't know how to implement it.

This is my second attempt of creating an actionscript from scratch, so be kind when viewing the code.

Thanks
1966

Repeat AS From Frame?
Hey,
I was just wondering if it's possible to repeat an AS on frame..
I've got a MC containing several frames, and each frame calling the same function with different arguments. What I would like to do, is call that same function again, even when you're already on that frame. So it's like when you gotoAndStop on that frame.

Is this even possible or do I need to work around it?

Thanks,
~Sph

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

Repeat Problem Please Help I Needs To Be Done Soon
Hey wow every one was telling me dont rush into flash its really hard but so far its not to hard but i pick things up pretty well anywho im making this banner for a contest and it needs to be done by tomorow and im having a repeat problem

ok so I have my first cool animation at the biegging of text dropping and once the text reaches the ground i want it to STOP and never repeat again unless someone refreshes or somthing but on the background of the banner i have these cool arrows moving and i want that to keep repeating but i only want the first animation to go once

i typed stop() ; on the layer text animation that i didnt want to repeat but then that made everything stop at that point can someone please help me im pretty new to flash only had it for 5 days

thanks

im using flash pro 8

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

Avoiding Key Repeat
I'm executing stuff on keystroke, and I have a little bit of an issue with, if the key is pressed and held, the statements execute over and over again, due to auto-repeat. I've got a workaround which works like this:


Code:
// Keystroke Input
var counter:Number == 0
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
_root.counter += 1;
if _root.counter == 1) {
// Do Stuff;
}
};
keyListener.onKeyUp = function() {
_root.counter = 0;
// Stop Doing Stuff
};
Key.addListener(keyListener);
So, when you press a key, the counter starts ticking up as the keystroke auto-repeats, but "Do Stuff" only happens when you first press it. When you release the key, the counter resets to zero.

It works, but I'm trying to work latency out of the thing, and I think this might be causing some of it. Anyone think of another way to handle it?

-EdM.

[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);
}

Repeat Problem
Hi

I'm pretty new to flash, so I'm having some trouble with the test site I'm trying to create.
You can see the site here.

As you can see on the "About me" and "Photos" pages, the content keeps moving. I would like the movieclip just to be played once, and not repeat itself.

Does anybody know what to do?

Thanks

Timer And Repeat Help
ActionScript Code:
var randomsound:String;


pages_array = ["http://www.geekswithguns.com/downloads/sounds/weapons/02-%20105MMCN1_WAV.mp3", "http://www.geekswithguns.com/downloads/sounds/weapons/03-%2020MM%20MG_WAV.mp3", "http://downloads.flashkit.com/soundfx/Mayhem/Military/Artiller-Diode111-8757/Artiller-Diode111-8757_hifi.mp3", "http://downloads.flashkit.com/soundfx/Mayhem/Cannons/8MM_AT_C-BlackCow-8186/8MM_AT_C-BlackCow-8186_hifi.mp3", "http://downloads.flashkit.com/soundfx/Mayhem/Machine_-DeltaTsu-8626/Machine_-DeltaTsu-8626_hifi.mp3", "http://downloads.flashkit.com/soundfx/Ambience/Other/army_cha-rikkisch-8118/army_cha-rikkisch-8118_hifi.mp3"];
randomPage = Math.round (Math.random () * (pages_array.length - 1));

randomsound = pages_array[randomPage];


var my_sound:Sound = new Sound();
my_sound.loadSound(randomsound, true);

I am trying to repeat randomsound, any of the array randomly, every 20 seconds or so, I have tried setInterval in my own ways but not getting very far, just a massive medley of sounds!

Don't Repeat The Arraycontent
Hi,

Here i have assigned 166 string to 166 var.

var mow0="Afghanistan"
var mow1="Albania"
var mow2="Algeria"
var mow3="Angola"
var mow4="Antarctica"
var mow5="Argentina"
var mow6="Armenia"
var mow7="Australia"
var mow8="Austria"
var mow9="Azerbaijan"
var mow10="Bahrain"
var mow11="Bangladesh"
var mow12="Belarus"
var mow13="Belgium"
var mow14="Belize"
var mow15="Benin"
var mow16="Bhutan"
var mow17="Bolivia"
var mow18="Bosniaherz"
var mow19="Botswana"
var mow20="Brazil"
var mow21="Brunei"
var mow22="Bulgaria"
var mow23="Burkinafaso"
var mow24="Burma"
var mow25="Burundi"
var mow26="Cambodia"
var mow27="Cameroon"
var mow28="Canada"
var mow29="Central African Republic"
var mow30="Chad"
var mow31="Chile"
var mow32="China"
var mow33="Colombia"
var mow34="Congo"
var mow35="Costa Rica"
var mow36="Croatia"
var mow37="Cuba"
var mow38="Cyprus"
var mow39="Czech Republic"
var mow40="Dem Rep of Congo"
var mow41="Denmark"
var mow42="Djibouti"
var mow43="Dominican R."
var mow44="Egypt"
var mow45="El.Salvador"
var mow46="Equador"
var mow47="Equatorial Guinea"
var mow48="Eritrea"
var mow49="Estonia"
var mow50="Ethiopia"
var mow51="Fiji"
var mow52="Finland"
var mow53="France"
var mow54="French Guiana"
var mow55="Gabon"
var mow56="Gambia"
var mow57="Georgia"
var mow58="Germany"
var mow59="Ghana"
var mow60="Greece"
var mow61="Green Land"
var mow62="Guatemala"
var mow63="Guinea"
var mow64="Guinea Bissau"
var mow65="Guyana"
var mow66="Haiti"
var mow67="Honduras"
var mow68="Hungary"
var mow69="Iceland"
var mow70="India"
var mow71="Indonesia"
var mow72="Iran"
var mow73="Iraq"
var mow74="Ireland"
var mow75="Israel"
var mow76="Italy"
var mow77="Ivory Coast"
var mow78="Japan"
var mow79="Jordan"
var mow80="Kazakhastan"
var mow81="Kenya"
var mow82="Kuwait"
var mow83="Kyrgyzstan"
var mow84="Laos"
var mow85="Latvia"
var mow86="Lebanon"
var mow87="Lesotho"
var mow88="Liberia"
var mow89="Libya"
var mow90="Lithuania"
var mow91="Macedonia"
var mow92="Madagascar"
var mow93="Malawi"
var mow94="Malaysia"
var mow95="Maldives"
var mow96="Mali"
var mow97="Mauritania"
var mow98="Mexico"
var mow99="Moldova"
var mow100="Mongolia"
var mow101="Morocco"
var mow102="Mozambique"
var mow103="Namibia"
var mow104="Nepal"
var mow105="Netherlands"
var mow106="New Caledonia"
var mow107="New Zealand"
var mow108="Nicaragua"
var mow109="Niger"
var mow110="Nigeria"
var mow111="North Korea"
var mow112="Norway"
var mow113="Oman"
var mow114="Pakistan"
var mow115="Panama"
var mow116="Papua New Guinea"
var mow117="Peru"
var mow118="Philippines"
var mow119="Poland"
var mow120="Portugal"
var mow121="Puerto Rico"
var mow122="Qatar"
var mow123="Romania"
var mow124="Russia"
var mow125="Rwanda"
var mow126="Saudiarabia"
var mow127="Senegal"
var mow128="Sierra Leone"
var mow129="Singapore"
var mow130="Slovakia"
var mow131="Slovenia"
var mow132="Solomon Islands"
var mow133="Somalia"
var mow134="South Africa"
var mow135="South Korea"
var mow136="Spain"
var mow137="Sri Lanka"
var mow138="Sudan"
var mow139="Suriname"
var mow140="Swaziland"
var mow141="Sweden"
var mow142="Switzerland"
var mow143="Syria"
var mow144="Taiwan"
var mow145="Tajikistan"
var mow146="Tanzania"
var mow147="Thailand"
var mow148="Timor"
var mow149="Togo"
var mow150="Tunisia"
var mow151="Turkey"
var mow152="Turkmenistan"
var mow153="UAE"
var mow154="Uganda"
var mow155="UK"
var mow156="Ukraine"
var mow157="Uruguay"
var mow158="USA"
var mow159="Uzbekistan"
var mow160="Vanuatu"
var mow161="Venezuela"
var mow162="Vietnam"
var mow163="Western Sahara"
var mow164="Yemen"
var mow165="Yugoslavia"
var mow166="Zambia"
var mow167="Zimbabwe"




now i have a array also,

named contname


using this for loop -


for(i=0; i<20; i++){
contname.push(eval("mow"+random(random(166))))
trace(contname[i])
}


i am pushing 20 values randomly.


BUT HERE I AM GETTING REPEATED VALUES SOME TOME.


I DO NOT WANT THE REPEATED VALUE.


PLEASE HELP ME ANYBODY

Repeat Frames
hi all..

how to repeat a set of frames...

but this not depend on other frames.. how it possible....

Why Does My Clip Repeat?
Hi all,

I have a clip, uploaded to http://paidiasoftware.com/e-Bug/aaaargh.swf (and the fla is at http://paidiasoftware.com/e-Bug/aaaargh.fla )

Inside this clip, the two main MCs are:

3D Cells which has a couple of pink skin tones on its timeline moving apart to fake depth.
and
CellsZoom which contains the above MC and scales it.

Combined, the effect is of zooming into a few skin cells (kinda).

Anyway,

the problem is that the 3D Cells timeline always plays twice. I can't seem to force it to stop.

I have rebuilt the clip from the ground up (using the same 3DCells MC) and I don't get this behaviour so it's something quirky about the particular imlementation of this fla.

But I can't figure out what it is.

Can anyone have a quick look and give me any ideas?

Cheers

David

Mouse Over Without Repeat
hi

i'm learning flash and actionscript 3.0. i try to make an animated button.
i have this code:


ActionScript Code:
import fl.transitions.Transition; 
import fl.transitions.TransitionManager; 
import fl.transitions.*; 
import fl.transitions.easing.*;
//import fl.transitions.Tween;
//import fl.transitions.TweenEvent;
//import caurina.transitions.Tweener;


play_mc.addEventListener(MouseEvent.MOUSE_OVER,test);
                        
                        
            function test(evt:MouseEvent){
                              
            play_mc.x = -23.3;
            play_mc.y = 0.0;
           
var erste:TransitionManager = new TransitionManager(play_mc);
erste.startTransition({type:Fly, direction:Transition.IN, duration:2, easing:Elastic.easeOut, startPoint:8});

removeEventListener(MouseEvent.MOUSE_OVER,test);
                                                      };

the goal is, that the animation happens only one time on mouse over.
but if i let the mouse on the button, the animation repeats over and over again, very fast.

can somebody help me?

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

Repeat Command
Is there any way to get a frame to repeat itself if a condition of an if statement is met? I've tried gotoAndPlay, but it doesn't seem to work.

thanks

No Repeat Number
Code:
var a = ["1", "2", "3", "4"];
var ct=0;
mysearch=function(arr,p){
var i,temp,myarr=new Array();
if(p<3){
mysearch(arr,p+1);
for(i=p+1;i<4;i++){
myarr=arr.slice();
temp=myarr[p];
myarr[p]=myarr[i];
myarr[i]=temp;
mysearch(myarr,p+1);
}
}else{
ct++;
trace(arr);}
};
mysearch(a,0);
trace("COUNT="+ct);


Code:
a = ["1", "2", "3", "4"];
for (i=0; i<4; i++) {
for (j=0; j<4; j++) {
for (k=0; k<4; k++) {
for (l=0; l<4; l++) {
temp = a[i]+a[j]+a[k]+a[l];
//-----------------------------
for (m=0; m<3; m++) {
f = false;
temp1 = temp.substr(m, 1);
for (n=m+1; n<4; n++) {
if (temp.substr(n, 1)==temp1) {
f = true;
}
}
if (f) {
break;
}
}
if (m == 3) {
trace(temp);
}
//-----------------------------
}
}
}
}


Have any way to make the same result???

Repeat Mx Tween
How do I make a mx class tween to repeat itself? I tried onMotionFinished with many variations, but it doesn't work, any ideas?

Repeat, Ignore
.





























Edited: 12/11/2008 at 05:15:42 PM by drumzit

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

Disable Key Repeat
Is there a way in Flash of disabling or detecting key repeat, ie that a key is being presses as a result of it being held down rather than it actually being pushed.

Programatically doing this by waiting for a key up slows down the rate at which you can press keys.

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