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




Please Help Pause A Loop For



hi there, may be it's an easy prb :i just want to pause a loop for example 1 second and then continue looping. here is an example:for (i=0; i<10; i++){attachMovieClip("test",temp+i, i);// what i want is to pause the loop here, before it attach another clip}any suggestions are welcomethnx



KirupaForum > Flash > Flash 8 (and earlier) > Flash MX
Posted on: 09-16-2005, 06:46 AM


View Complete Forum Thread with Replies

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

Pause In A FOR Loop?
Hi,

This is killing me:
I'm trying to pause a FOR loop so that a certain amounts of milliseconds pass before it loops.

This is the code I've been trying:

Code:
for(i=0;i<10;i++){
trace ("hello");
initTime = getTimer();
while (getTimer()-initTime<=1000){
//do nothing
}
}
When I run this code, rather than performing 10 traces, one every second as I'd expect, the swf seems to pause for ten seconds and then show all ten traces at once.

I've tried a couple of similar solutions using setInterval, but they do pretty much the same thing.

The code I'm writing is parsing XML into menu items, with one FOR loop creating a whole menu - so the pause has to happen within a FOR loop, and not spread over frames or anything.

EDIT: Any code has to work in version mx6, as I can't afford mx2004

Anybody got any ideas?

Thanks,
Tom

Pause For 20 Sec In A For Loop
Is there a way to do this.

I am looping through an array like this

PHP Code:




_root.targets = new Array(1,2,3);
for (i=0;i<3;i++) {
    //get random number location to select from array
    ran = random(_root.targets.length);
    //trace("ran is " + ran);
    _root.targetCell=_root.cells["load" + _root.targets[ran]];
    
    //wait 20 seconds right here
        _root.controller.play();
    
    //remove the random element from the array.
_root.targets.splice(ran, 1);
}







The controller movie accesses the targetcell variable.

Is there a way that I can add a 20 second wait right before it? Everything I can find loops through frames to chack duration but Im not sure how to loop through frames within my for loop?

Am I going about this all wrong?

Loop Pause?
I need to pause a movie for 5 seconds, but at the same time be able to use a if/else function in case someone clicks a button during those 5 seconds to get out of the pause.

So far I'm using Set Interval, but I can't figure out how to make the if/else function work while the movie is paused. I then thought about making a loop that goes back and forth for 5 seconds while checking the if/else function, but I can't figure that out either.

Thanks for any help.

A Pause Loop?
Hi all,

Got a quick question. How can I create a loop that either 1) creates a pause of specified length, or 2) fades an object over time. I tried creating a "pause loop" as follows:

Code on first frame of movie:

fps = 24;
pause = 0;
seconds = 0;
waitfor = seconds * fps;

Code on frame that I want to pause on:

seconds = 3;

if (pause < waitfor)
{
pause = pause + 1;
gotoAndPlay (_currentframe);
}
else
{
pause = 0;
}


I was hoping that this dropping this code into a frame would allow me to specify a pause in seconds. I know I could pump a whole lot of frames into the timeline to get this effect, but when you want to pause every few seconds for a few seconds, a timeline can get really big, fast. I tried a similar loop for the alpha value, but to no avail. Anyways, any help would be appreciated.

Ken

Pause A For Loop
Hi

I have a script where I duplicate a movieClip several times using the for loop statement.
Now, between every duplication I want flash to wait for 1 second, befor duplicating the next one.

Does anybody knows how tot do this?


tx
Tom

Pause Before Loop
At the end of my timeline I currently have a 'stop();' action so that the timeline doesn't loop. Now, I'd like to loop, but only after 5 seconds. I'm trying to get away from relying heavily on the timeline for this. Is there a way to set an action in the current last frame of the actions layer for me to tell the movie to pause 5 seconds before restarting?

Thanks!

-B

While Loop And Time Pause
Hey guys and gals.

I am using this code to perform a pause on a frame for 10 seconds.

Code:
stop ();
// get the time when entering this frame
timeThen = getTimer();
// get the current time
timeNow = getTimer();
// set a value for the pause
pause = timeNow - timeThen;
// loop while the value of 'pause' is less than 1000 milliseconds
while (pause<10000) {
timeNow = getTimer();
pause = timeNow - timeThen;
}
gotoAndPlay (48);



Now it works fine EXCEPT that the whole movie freezes (this isnt because of the actually paus cuz thats in a MC) The roll over on the buttons wont even respond whilst the while loop is running, plus the browser just hangs too.

so i need a way to do the above, without comprimising the rest of my movie!

Thanx
[Edited by pottypotsworth on 02-28-2002 at 05:54 PM]

Pause Inside A Loop... Possible?
Hello everyone,

i'm trying to do a "fade" function,
everything is ok, it fades, but i need to do it gradualy, so i thought about a loop,
function fade(MC) {
for (x=100;x>=1;x--) {
set property([MC],_alpha,x);
i need a pause here!
};
}

How may i handle this?

Sound Loop Pause
Hi, I am trying to create a simple banner for my site. It is just an image, and a sound loop.

The problem is that no matter how large, or small the sound loop is, there is always a pause between the start and end of the loop. I must have tried over 30 mp3's and wavs, and no luck.

Please help! Thank you!

Brief Pause In Sound Loop
I have inserted a sound loop in several ways in flash, but everytime it hits the end of the track there is a brief delay before it loops again, maybe a quarter of a second, but still enough to be noticeable. How do I fix this?

-Thanks

How To Pause The Increment In For Loop?
I have a for loop and I want to increment the counter only after the code in the for loop has executed once. This is what I am trying to do:

for (i = 0; i <16; i++)

{
// do something one time;
// The, I want to use the getTimer () or setInterval fucntion to increment "i" after waiting for 5 seconds
// Then, contiue with the other iterations of the loop, pausing for 5 seconds after each iteration
}

Or perhaps >>

while (i < 16)
{
// do my action once,
// then pause for 5 seconds
// then increment i, then continue with the other iterations, pausing for 5 seconds after each iteration.
}

How Do You Insert A Pause Into A Loop?
I have a for loop that puts thumbnails on the stage.

What I want is like a half second pause between each time the loop runs so that everything doesnt show up at once. Any easy way to do this?

Strange 3 Second Pause In An If Loop
I have a function on the main timeline being called by a movie clip that fades in a second movieclip. The frame rate is 12fps. The function works exactly as it should, but there is this strange 3 second pause before it fades the alpha in the last amount. I was wondering if anyone had any idea why this pause might occur.

Thanks


Code:
fadeInText = function () {
_root.a = 0;
if ((getTimer()-fadeInTextClipHolder.timeInit)>3000) {
trace("text fade in running, text alpha is "+_root.textLoader._alpha+" at time "+getTimer());
if ((_root.textLoader._alpha<100) && (_root.textLoader.getBytesLoaded() == _root.textLoader.getBytesTotal())) {
_root.textLoader._alpha += 5;
}
if (_root.textLoader._alpha>=100) {
_root.a = (-1);
_root.fadeInTextClipHolder.gotoAndStop(1);
}
}
};
Here is what the trace outputs (the last few steps)


Quote:




text fade in running, text alpha is 75 at time 9527
text fade in running, text alpha is 79.6875 at time 9577
text fade in running, text alpha is 84.375 at time 9627
text fade in running, text alpha is 89.0625 at time 9677
text fade in running, text alpha is 93.75 at time 9732
text fade in running, text alpha is 98.4375 at time 9782
text fade in running, text alpha is 103.125 at time 12811

Problem Getting It To Pause And Loop
Well here is the problem . i have a flash 8 text that is all actionscript . it has 3 layers 1 for actionscript 1 for the background and 1 for the dinamic text box and all are only 1 frame each , the actionscript does all the work and it works well , it goes throught the alphabet till it finds the right letter it needs and when it does it puts it there and then moves to the next letter until it gets to the end and then stops, but what i am after if some one can help me is at the end of the script playing i want it to pause say for 10 seconds and then start from the beginning again, i don't want to put a button in there .. , i just want it to pause at the end and then start playing again so it auto loops, here is a copy of the script. here is what it does and you will see how it stops at the end



Code:
desiredText = "This is Just a Test to see how it all works and to replay..!";
dt.text = "";
i = 0;
j = 0;
function randomtext() {
(i<desiredText.length) ? go() : clr();
function go() {
if (dt.text.charAt(i) != desiredText.charAt(i)) {
j++;
dt.replaceText(i, i+1, String.fromCharCode(j));
} else {
i++;
j = 0;
}
}
function clr() {
clearInterval(intID);
}
}
intID = setInterval(randomtext, 10);
i have it set for multi lines so it will auto wrap the text .. if some one can help with this it would be greatly apreciated...

Building A Pause Into A Loop
If I have a loop
for(var i=0;i<N;i++)
{
do something
}
and wanted that a pause of, say 1 sec between every step in the loop, how do
I do that?

How To Pause A Loop In Actionscript
I have a loop that dups MCs to my stage and then plays them. The problem is i want the mcs to come in one after another. The loop i created only pause the first 5 seconds, then just dumps them onto the stage at the same time. So i am looking for a way to pause the loop after each iteration for 5 second before it duplicates another MC. Pls help...










Attach Code

for (var j = 0; j < total; j++) {
rePos(j,5); // pause 5 secs on each loop
}

function rePos(j,n) {
var myInterval = setInterval(function (obj) {
duplicateMovieClip (wheel_thumbs.thumb00, ["thumb0" + (j+1)], j+1);
w = wheel_thumbs["thumb0"+j].thumb0.b0;
img_mcl.loadClip(image[p+j], w);

// paused 5 secs on the first images but after that it just put all the images at the same time...

if (j >= total) {clearInterval(myInterval);}
}, n * 1000);// stop for n seconds
}

























Edited: 06/15/2008 at 02:15:07 PM by ibrubru

Audio Loop & Pause
Hi everyone,

I have a small challenge.

Goal:
I’m trying to loop audio 3 times then stop.
But while audio is playing, I want to click on a button to pause the audio then re-click to restart it. (sounds simple huh)

Challenge:
I can do them separately meaning (I can loop audio 3 times or I can click pause and re-click to continue playing audio) but I'm having trouble doing them together.

Every time I change the following code from:

var myChannel:SoundChannel=mySound.play();
To:
var myChannel:SoundChannel=mySound.play(0,3);

there is a buzz or some sort of feed back.

I think it’s because the:
“0” in mySound.play (0,3)
is trying to start the audio from the beginning but the code of ;
myChannel=mySound.play(pausedposition);
is trying to play from the paused position.

So I think it’s freezing up and giving me audio feed back buzz.

Bottom line:
Does anyone know how to loop audio yet pause it then un-pause it and continue the audio loop playing. My code is below:

Thanks









Attach Code

1.var myRequest:URLRequest=new URLRequest ("Scenic Land.mp3")
2.var mySound:Sound = new Sound()
3.mySound.load(myRequest);

4.var myChannel:SoundChannel=mySound.play(0,3);
5.var pausedposition:int;
6.//
7.pausedposition = myChannel.position;
8.myChannel.stop();
9.
10.function pause1 (evt:MouseEvent):void {
11.
12.SoundMixer.stopAll();
13.myChannel=mySound.play(pausedposition);
14.gotoAndPlay("portfolio_to_home");
15.}
16.pause_btn.addEventListener(MouseEvent.CLICK, pause1);

For Loop With A Pause Before Running Again
Hi, I'm trying to run a for loop for my game that runs once, waits a certain amount of time, then runs again. I'm trying it with setInterval but so far no luck. Could someone please give me an example of some code that would cause this to happen. Thanks in advance

Pause And Loop In Actionscript
Well here is the problem . i have a flash 8 text that is all actionscript . it has 3 layers 1 for actionscript 1 for the background and 1 for the dinamic text box and all are only 1 frame each , the actionscript does all the work and it works well , it goes throught the alphabet till it finds the right letter it needs and when it does it puts it there and then moves to the next letter until it gets to the end and then stops, but what i am after if some one can help me is at the end of the script playing i want it to pause say for 10 seconds and then start from the beginning again, i don't want to put a button in there .. , i just want it to pause at the end and then start playing again so it auto loops, here is a copy of the script. here is what it does and you will see how it stops at the end



actionscript Code:






Original
- actionscript Code





desiredText = "This is Just a Test to see how it all works and to replay..!";
dt.text = "";
i = 0;
j = 0;
function randomtext() {
(i<desiredText.length) ? go() : clr();
function go() {
if (dt.text.charAt(i) != desiredText.charAt(i)) {
j++;
dt.replaceText(i, i+1, String.fromCharCode(j));
} else {
i++;
j = 0;
}
}
function clr() {
clearInterval(intID);
}
}
intID = setInterval(randomtext, 10);






 desiredText = "This is Just a Test to see how it all works and to replay..!";dt.text = "";i = 0;j = 0;function randomtext() {(i<desiredText.length) ? go() : clr();function go() {if (dt.text.charAt(i) != desiredText.charAt(i)) {j++;dt.replaceText(i, i+1, String.fromCharCode(j));} else {i++;j = 0;}}function clr() {clearInterval(intID);}}intID = setInterval(randomtext, 10);



i have it set for multi lines so it will auto wrap the text .. if some one can help with this i would be greatly apreciated...

Pause/Wait Inside While Loop.
I need to make my game pause or wait between every pass in a While loop.

The complicate things, the While loop is inside of a For loop, and all of this code is in a movie clip.

The existing code looks something like this:


on (press) {
if (_currentframe<10) {
checkPress2();
}
}


function checkPress2(j, tp) {

for (i=0; i<=_root.groupNum; i++) {
_root.score++;
_root["g"+tp].gotoAndStop(80);
while (_root["g"+(tp-j)].kind == 80) {
//I NEED IT TO WAIT HALF A SECOND HERE
_root["g"+tp].gotoAndStop(80);
}
}



I know that the prefered or 'only' way to make something wait is to use an interval, but how in the world would I use one in this situation?




If for instance, I made the entire function a setInterval, wouldn't the function 'start over' every interval?

I need the action inside the While loop to wait half a second before running, on every pass of the While loop.

I would really appreciate some suggestions

Scripted Pause Loop - NEWBIE
Hi All as a newb, i am struggling with something that seems prety simple logically..

I have a movie that plays, at a certain point i want the movie to pause (this is where i want the actionscrpt to go into action pausing the movie for say 4 seconds)

Then after the pause i want the movie to continue, the movie continues playong until it gets to to another action that sends the playhead right back to the beginning by use of a "gotoandplay" (this is already there)

This will ovbiously loop for ever, but i wnat to add some actionscript to the pause frame, that counts each time the loop has happened, so in the whole movie loops more than 3 times I can send the playhead to another position out of the loop?

Thanks if anyone can show me how to do this..

Biscutty

Annoying Pause At End Of Sequence Loop
I originally worked on a 12 frame animation in Flash 5 and the animation loop worked perfectly. I then moved the animation to my copy of MX 2004 and noticed a 1 frame pause at the end of each loop. It's destroying the animation. Are there any settings to fix this? I've tried exporting in every format and it exists in all of them, even video.

The animation is a looping movieclip of 12 frames that loops for 48 frames on the main scene. Every 12 frames there is the pause. Even if I use the movieclip in just one frame, it still has the problem. I have checked every clip in the file for an extra frame but even adding 10 frames to them didn't seem to alter the pause at all.

Video Set To Loop, But Has A Slight Pause At End
Hi,

I have a video looping via AS3; only thing is the video slightly pauses at the end before it loops.
Any one know how I could fix this?

I have tried the following, but no matter which method, I get that pause:

(METHOD 1)
container.myVideo.autoRewind = true;
container.myVideo.addEventListener(VideoEvent.AUTO_REWOUND, loopVideo);

function loopVideo(event:VideoEvent):void
{
container.myVideo.play();
}

(METHOD 2)
container.myVideo.addEventListener(VideoEvent.COMPLETE, playAgain);

function playAgain(evt:VideoEvent):void
{
container.myVideo.seek(0);
container.myVideo.play();
}

Kind Regards,

Boxing Boom





























Edited: 09/26/2008 at 01:04:35 AM by Boxing Boom

Streaming Sound Loop With Pause
Hello Everybody,

i`ve a little problem to make the Sound Basics Tutorial.
If i want to make a loop with my streaming "drumloop.mp3", flash make a small pause between the repeats.
I`ve read that flash have a bug with streaming mp3`s, exist the problem still flash 9 ? And have anybody a solution ?

All the best
Dominik

Simple Question On How To Pause A For Loop
I have a for loop.

I want each run of this loop to have pause before going to the next run.

like this:


for(i=0; i<=20; i++){

-> perform an action

->wait a while, and go to the next run

}


I experimented a bit with setinterval, but can not get it to work...
any suggestions here?

many thanks, kind regards Game

Actionscript: Can You Pause A Loop For A Set Number Of Frames?
The subject says it all I have an array which contains 16 movie clips
references. I want to loop through the array and have it play each movie.

Each movie is 100 frames long. So in english I want
to:

Start at an array = 0
Pause for 100 frames
do an action
load the next movie.

Is this possible?

Can't Remove Pause In Background Music Loop
Hi. I am wondewring how to make a background music loop that doesn't pause when the song restarts. I have seen flash files that loop and you can't really tell where the loop ends and begins again because it imediately begins again. Is this possible with Flash MX 2004 or do I need to use another program?

Thanks

Seamless Sound Loop With Pause Button Possible?
I've looked all over the web and can't believe that a seamless sound loop with pause button can't be done... the loop works great (seamlessly) if I simply play it (see code)

but I'd like the user to be able to pause and restart the sound (I'm using a WAV encoded to mp3 in flash to avoid the ID3 tag).
I've been setting this up using Event.SOUND_COMPLETE, and that works, but for whatever reason interferes with the seamless looping of the sound, making for a glitchy sound rendition.

Is there any other way to seamlessly loop sound while retaining the option to pause? thanks







Attach Code

var sound:Sound = new loop();
sound.play(0, int.MAX_VALUE);

Can't Get Background Sound To Loop Without Small Pause Between Loops...help.
I have small 9 second sound clip that I want to loop in my flash project. I import the sound into a layer, and set it to repeat 999 times, and sync=event.

When I play my movie, the sound plays through once, then there is a split second of silence, then the sound starts again. The silence is NOT from the actual sound its self, but it seems when flash "rewinds" the sound to the beginning, it pauses the sound slightly, thus it does not sound SEEMLESS.

What do I have to to to make the sound seemless?

As I have it right now, the sound is in its own layer within a scene. The sound is not in a movie clip.

Any help would be appreciated. THANK YOU!!!!!!!

Ryan

Multi-column Image Fader - Pause In A For Loop
Here's what I'm doing: I have a content management system written in PHP and MySQL with a page allowing the admin to upload images. These images are supposed to be animated in a Flash movie - specifically, 4 columns, fading at different intervals.

My images load in just fine, it's animating them that I'm having trouble with.

(By the way, if there's a better way to go about this than what I've come up with, please don't hesitate to let me know. I'm still a rookie with ActionScript and am not fully aware of all the capabilities. This is the most complicated ActionScript I've ever written from scratch.)

Frame 1:

PHP Code:




imageinfo = new LoadVars();
imageinfo.load("http://localhost/scripts/header.php");
imageinfo.onLoad = function(success) {
    if (success) {
        trace("Variables loaded");
        columns = 4;
        i = 1;
        col = 0;
        for (counter=1; counter<=this.total; counter++) {
            col++;
            if (col>columns) {
                i++;
                col = 1;
            }
            this.imageName = 'col'+col+'image'+i;
            this.imageLoc = this[this.imageName];
            _root.createEmptyMovieClip(this.imageName, counter);
            _root[this.imageName].loadMovie('http://localhost/'+this.imageLoc);
            switch (col) {
            case 1 :
                _root[this.imageName]._x = 0;
                break;
            case 2 :
                _root[this.imageName]._x = 233;
                break;
            case 3 :
                _root[this.imageName]._x = 466;
                break;
            case 4 :
                _root[this.imageName]._x = 699;
                break;
            }
            if (counter == this.total) {
                this.topcol = col;
                this.topimage = i;
            }
        }
    } else {
        trace("Error loading variables");
    }
    gotoAndPlay(2);
};
stop();







Frame 2:

PHP Code:




var pauseSeconds:Number = 5;
var fading_speed:Number = 200;
columns = 4;
i = imageinfo.topimage;
col = imageinfo.topcol+1;
function fade(mc, i) {
    mc._alpha -= 2;
    if (mc._alpha<=0) {
        mc._alpha = 0;
        clearInterval(nb_fade[i]);
    }
}
for (counter=imageinfo.total; counter>=1; counter--) {
        col--;
        if (col == 0) {
            i--;
            col = 4;
        }
        imageName = 'col'+col+'image'+i;
        imageLoc = this[this.imageName];
        nb_fade[counter] = setInterval(fade, fading_speed, imageLoc, counter);
}
stop();







Right now, all of the images fade at the same time. My main hurdle is that I need to "pause" during the for loop, so that the topmost image will fade, then 5 seconds later the next will fade, and so forth.

Doing them decrementally like that seemed like the easiest way to go, since I'll always be sure which ones are on top. But perhaps I should just put them all in an array in the first frame's loop instead of going through it again? Then perhaps I could use setInterval or something like that? Any help, guidance or advice would be much appreciated.

Good Sound Loop Player - On/off Button, No Pause
i need an on and off button to play a small sound loop - problem is, all the ones i have made by following tutorials gave the sound a pause at the end even though when i previewed the sound at flashkit, it worked perfectly - so it's not the sound that's wrong.

any advice? tutorials, fla's

thank you.

Super-Easy ActionScript Pause Timeline Loop
Its even less complicated than the subject for this post... Download the source if you want it even faster, or read my little explanation. I searched the web looking for a solution for this little problem, of pausing the timeline for a designated amount of time, as to not clutter my timeline with needless static frames, and it seemed everyone's solutions were too complicated. This is simple as pie. All you need is 3 frames, and a few lines of code.

Frame 1:

Code:
var delay = getTimer() + 3 * 1000;
All this is, is a variable called "delay" (or whatever you want to call it) that uses the built-in getTimer() function of flash, to obtain the current time. Then the + 3 * 1000; portion merely adds 3 seconds as the delay by multiplying the number 3 (which represents the number of seconds you want to delay) by 1000, which represents milliseconds, the unit of time measurment used by getTimer(). So to change your pause, you just change 3 to however many seconds you wish to pause the animation.

Frame 2: is empty

Frame 3:

Code:
if(getTimer() >= delay) {
gotoAndPlay(this._currentframe+1);
} else {
gotoAndPlay(this._currentframe-1);
}
This code prevents you from having to label frames and do any needless additional work. All it does, is checks if the current time is greater than or equal to the delay. If it is it moves the playhead forward, continuing the animation, if it isn't, it moves it back one frame (to empty frame 2, as to not reset the timer), and starts the loop again.

Easy peasy, nice and easy, light and breezy.

XD

Loop / Pause In Movie Clip - Duration In Seconds Instead Of Number Of Frames
hi,

i want to know if there's a smart way of creating long-ish, easily editable pauses in movies clips using actionscripting (instead of just throw in dozens more frames in the timeline)?

i'm currently using a loop as such:

i++
if (i<500) {
gotoAndPlay("waitingForUser");
trace(i)
} else {
gotoAndPlay("autoScroll ");
}
this has it looping through 500 times so is obviously dependant on framerate. is there a way to do this and have it loop for for x amount of seconds instead?

many thanks,

ponch

Is It Possible To "pause" The BG Loop Whilst An Flv Is Playing?
I thought I remembered an "onExitFrame" command, but it doesn't seem to be there anymore.

Essentially, when the button is pushed and the movie progresses to the frame holding the flv player, I'd like it pause the bg loop (or kill it), but to reload or restart it when the user hits a menu button to resume exploring,

Any thoughts? I'm assuming this is a common need...??

Thanks guys!

J

Any Way Around The Loop Error (loading 8000 Vars, Flash Thinks Its A Loop.)
I have 8000 vars to load....... all at once, so Flash thinks its in a loop at the 3000 mark and gives an error. Is there any way around this?

How Do I Define The Greatest _x Position Based On A Loop, Assuming I Know The Last Element Of The Loop?
Hello,

This may be complicated,

I've a loop that creates emptyMovieClips
then I use one function to onRollOver _xscale them += 10

Now I want to move another movieClip based on the greatest _x position of my previously _xscaled elements, how do I do that?

example

for (var i = 0; i<my_array.length; i++) {
_root.menu_.createEmptyMovieClip("btn"+i, i+1);
}
//
_root.menu_["btn"+i].onRollOver = function() {
this._xscale += 10;
//
MY_DRAGER._x = HIGHT._x;
}

Can this be done?

Thanks,

I Would Like My Sound Loop To Continously Loop Without Looping Over Itself When I Repeat My Images.
I have a sound loop moving along with my flash images. When the flash images finish and I send it back to frame 1, my sound doubles. How can I play my sound loop once, but allow my images to continously loop.

Is there away to just run one loop of sound, and let the image aspect continue to loop.

I would like my sound loop to continously loop without looping over itself when I repeat my images.

Make One Element Loop Without Making Enitre Movie Loop?
i'm trying to make one element continue looping without making the entire movie loop... here's what i mean..

i have a layer that i've name actions which i've asigned a stop(); to at the end of the animation. but i want the red pulsating dot to continue looping/ animating ... to give you an even better idea, here's the swf file...

http://www.push1.com/roster_art_gal.swf

cheers!

LoadVars In A For Loop Not Executing .load Function Until For Loop Completed?
Ok so I have a simply for loop: ID[i] is a global array



Code:


for (i=0;i<12;i++)
{
var loadInfo:LoadVars = new LoadVars();
loadInfo.onLoad=function(success:Boolean)
{
if (success)
{
trace("whatever:"+loadInfo.myname);
}
else
{
trace("Nope");
}
loadInfo.load(ID[i]+".txt");
}



the problem I'm having is that the function doesn't execute until the for loop completes and then it executes 12 times in a row. Output is 'whatever: undefined' 11 times and then 'whatever: Bobble' (which corresponeds to the last .myname value as it should). Why is this? And how can I fix it? To be continued...

~NH

Loop Inside Loop... Why Doesn't Work Properly?
In order to cause a delay, I have put a loop inside another loop. Here it is:

for (a=1; a<6; a++) {
for (b=1; b<10000; b++) {
}
}

Flash delays to show the page but in the end I just see both variables with the maximun value. The point was to see variable "a" growing with delay. What have I done wrong?

Thank you

Function Inside For Loop; How To Give It Parameters Of The Loop
Hey!

This is the code:


Code:

for (i=0; i<5; i++) {
_root.createEmptyMovieClip("temp"+i, 1+i);


_root["temp"+i].beginFill(0xFF0000, 20 + (20*i));
_root["temp"+i].moveTo(0+(60*i), 0+(67*i));
_root["temp"+i].lineTo(100+(60*i), 0+(61*i));
_root["temp"+i].lineTo(100+(64*i), 100+(65*i));
_root["temp"+i].lineTo(0+(55*i), 100+(80*i));

_root["temp"+i].endFill();

_root["temp"+i].onRelease = function() {

trace("button Number = " +i);
}
}


So I made butttons and assigned each one an onRelease function. But each one needs to have assigned a variabile by the value "i" in the for loop.
When I write it like this the function itself is defined only after I click it and it ofcourse asigns all the buttons the same "i", the last value of "i" in the for loop.

How do I do it so I get first button with variable 1, second with 2,... ?

Thx.

Pausing Execution Of Code In A For Loop Between Each Loop. Howto?
I have a for loop which runs x amount of times and between each loop i'd like to implement a small pause of execution of the code. How would i do that? Can something like that only be done using a timer? If so how would i go about doing that and what things should i import? (Trying to do this in a class) ...

Loop Help: XML Attribute Doesnt Stay On Each Object Of The Loop
Hi, i'm working on a gallery that loads thumbnails from an xml file into 3 columns and when you click on a thumbnail it opens a new window with the fullsized image in.

I have modified code from a gallery tutorial to load the thumbnails from a xml file. They are going in 3 columns at the moment (I don't understand why but they are) but only the last image has a hand cursor when you rollover it, and then when you click on it, it traces "undefined" into the output box.

I have put
Code:
trace(images_arr[i].attributes.fullsize);
just below the bit where it loads the thumbnails and it traces the right path from the xml file for each image.

Can someone help me get it to trace the right path from the xml file when you click on ALL the thumbnails, not just the last one.

Thank you so much in advance!



Code:
function GenerateThumbs() {
images_arr = images_xml.firstChild.childNodes;
gap = 10;
this.createEmptyMovieClip("thumb_mc",100000);
thumb_mc._y = 10;
thumb_mc._x = 10;
for (var i = 0; i<images_arr.length; i++) {
trace('generating thumbs'+i);
this.thumb_mc.createEmptyMovieClip("thumb"+i+"_mc", i);
this.thumb_mc.createEmptyMovieClip("thumb"+i+"_tmp_mc", 300);
this.thumb_mc["thumb"+i+"_mc"]._x = ((i%3)*(67+gap));
this.thumb_mc["thumb"+i+"_mc"]._y = Math.floor(i/3)*(67+gap);
this.thumb_mc["thumb"+i+"_mc"].loadMovie(images_arr[i].attributes.thumb);
this.thumb_mc["thumb"+i+"_tmp_mc"].no = i;
this.thumb_mc["thumb"+i+"_tmp_mc"].onEnterFrame = function() {
var _mc = this._parent["thumb"+this.no+"_mc"];
var l = _mc.getBytesLoaded();
var t = _mc.getBytesTotal();
if ((l>=t) && (t>1) && (_mc._width>1)) {
_mc.onRelease = function() {
trace(images_arr[i].attributes.fullsize);
};
}
};
}
}


var images_xml = new XML();
images_xml.ignoreWhite = true;
images_xml.onLoad = function(success) {
if (success) {
GenerateThumbs();
} else {
trace("Error loading XML file");
}
};
images_xml.load("gallery.xml");

Pausing Execution Of Code In A For Loop Between Each Loop. Howto?
I have a for loop which runs x amount of times and between each loop i'd like to implement a small pause of execution of the code. How would i do that? Can something like that only be done using a timer? If so how would i go about doing that and what things should i import? (Trying to do this in a class)
Though i'm wondering if there's an easier way than timers to be able to do something like that, like C's sleep() function for example.

My Sound Loop Is Repeating Itself Ontop Of Previous Loop
Here is a link to a movie that I am working on:


LINK-
http://blue-title.com/v2/


My client says that when you first start the movie, the loop starts fine but when he clicks on one of the three buttons at the bottom (Home, Florida, Alabama) the initial first loop continues to play and a new loop is beginning to repeat while the first one is still playing.

It works fine for me in Firefox and Safari on a Mac.

Any solutions?

Todd Temple

Movie Clips In For Loop Onlydisplaying In 1st Loop
Hi there! I'm new at this so excuse if I'm being stupid.

I'm creating a game which I'm looping through an array and inside the loop I'm playing clips. The clips display only the first time the loop is being run. Here is the actionscript. PLEASE SOMEONE HELP ME... I'M DESPERATE!!!

code:
on (release) {
var myClips = new Array("Fletter", "Lletter", "Aletter", "Mletter", "Eletter");
var myClipsNewName = new Array("mov2", "mov3", "mov4", "mov5", "mov6");
var myClipsValue = new Array (10, 11, 12, 13, 14);
var cnt = 0;
for (var t = 0; t<4; t++) {
for (var i = 0; i if (cnt == -1) {
cnt = 0;
}
var temp = myClips[cnt];
attachMovie(myClips[cnt],myClipsNewName[cnt], myClipsValue[cnt]);
updateAfterEvent();
trace(myClips[cnt]);
if (i == Total-1) {
myClips.splice(cnt, 1);
myClipsNewName.splice(cnt,1);
myClipsValue.splice(cnt,1);
if (cnt == myClips.length) {
cnt = 0;
}
break;
}
cnt = cnt+1;
if (cnt == myClips.length) {
cnt = 0;
}

}
}
}


edit: jbum added as tags

Mp3 Sound Loop Bad. Wav Loop Good.
I have a soundloop which is a WAV file
and it works just fine when i loop it in flash

But when i convert it to an MP3 file...for osme weird reason theres a little less than 1 second pause when it starts again...you can tell its a loop...not smooth

But in WAV format its fine.
Its weird..ive used two different softwares to convert my wav file.
ive used Creative Wave Studio, Ive used a dedicated third party MP3-WAV convertor.

same results...the mp3 has bad looping.

any ideas?

[MX04] Loop Loop Whoops
Hi,

I know this might be really simple but I'm having a problem with my movie continuing to loop even though I've put the stop() function anywhere and everywhere I can think of. Basically, I have some mc's in Frame 1 which perform some calculations in AS. At the end of one of the calculations, I have _root.gotoAndStop(2) (which I'm assuming is telling the playhead to move on to the next frame in the main timeline).

I've put in key frames in the second frame for the same mc's to perform some different calculations which are dependent on variables from Frame 1's calculations. After running through the calculations, the movie won't stop looping and I can't figure out why.

Can anyone suggest a course of action? Thanks in advance.

Stop Loop And Replay Loop
Okay on my stage I have a start(MC) and a stop(MC) and a clear(MC) these will be used as buttons. I also have a dynamic text box that shows my output.

I am making it so when you click start it will start counting from 0 to whenever you hit the stop button, I have changed my fps to 1 so it doesn't crash my computer, And this is where I am running into trouble. Here is my code.

var myTimer = 0;

startBtn.onPress = function() {
this.onEnterFrame = function() {
myTimer = myTimer + 1;
//trace(myTimer);
this._parent.myTxt.text = myTimer;
}

}


stopBtn.onPress = function() {
trace(myTimer);
this.myTimer.onEnterFrame = stop();
}


I would also like it so when you hit start again it picks up where it left off.

Please any help would be greatly appreciated.

Thanks
T

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