Stop The Damn Loop
Hey,
I'm working on a ISO-RPG and now I´m making a itemDrop function, it´ll alow you to drop your items on the ground...
To check where around the hero is a free spot I use a loop, but the loop should stop after the condition was true, how can I do this?
code: dejoinItem = function (nr, item) { for (var a = -1; a<2; a++) { for (var b = -1; b<2; b++) { if (map[hY+a][hX+b][2] == 0) { SaphuA.inventory.splice(nr, 1); map[hY+a][hX+b][3] = item; map[hY+a][hX+b][2] = 1; makeTile(hX+a, hY+b); resortItem(); } } } };
Thnx, SaphuA
FlashKit > Flash Help > Flash ActionScript
Posted on: 10-06-2003, 03:46 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Ugh Can't Get This Damn Audio To Loop
hey everyone. i'm working on a site for a client with a simple flash header. anyway, he's got some music he wants to loop. so i set about doing it the way i had done on my last site. i made a video clip with the sound starting on frame 1 with loop set to 99999. and then in frame 3 it says to go back to frame 2. (if you're wondering why i did all this with a video clip, its so i can have a play/stop button for the music. i'm sure there are easier ways to do this, but i'm a retard like that) anyway, it wont loop. can someone take a look at my fla? the movie clip is in the layer called "audio."
http://eclipsegfx.com/oor/oor.fla
thanks.
btw- i know the audio clip is huge! i told him we'll worry about lowering the sound quality later.
Help I Cant Stop The Damn Thing From Skipping
I made a web site with alot of stuff moving, and its skipping. i know this is a problem with flash but is there and easy way to fix it. i dont know much about action script but i spent alot of time on this and i cant use it.
n e help will be nice
thanks
gadgets
Stop Scene Loop Without Stop();
I have an interactive flash application that I'm building, but it's gotten kinda large (~200k) because of one large png file. So, I want to build a preloader for it, but I seem to have some difficulty getting it to a) stop looping back to scene 1, or b) look good if I use stop();
for some reason, the folowing scene's moving elements look crappy if I use stop(); in it's first frame in order to stop it from going back.
I don't want scene 1 to continuously reappear, but stop messes with the moving elements in scene 2.
Any novel suggestions? Thanks in advance for even reading this.
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
Stop Loop
How do I stop a movie from looping? I want opening animation then to stay static until the user selects and option....but mine just keep looping no matter what I tried....
Can Not Stop Loop
Hi... even though I have the loop box not checked and I have placed a stop on the end of thelast sceen, for the life of me I can not get this thing to not loop. I just want one showing of the movie.
Oh BTW I am using Windows2000 SP2, IE 5.5 latest version and publishing in NetObjects Fusion MX. Hope this helps.
Thanks much for your help.
Stop The Loop
Hi, I've created a movie in Flash 5.
Everything works great. I exported it so that it will play in the Flash player but the player is set to loop by default and I only want my movie to play once.
Any ideas?
Can Anyone Help Me Stop This Loop?
Hi there
I'm trying to stop a tunnel effect so that it stops after, for example, 10 loops. Can anyone out there help with the loop code, and where would it go in the following set up?
The code is set up as follows:
Theres an ACTIONS layer and a MAIN layer on the main timeline.
1. Actions layer has 6 frames, as follows:
FRAME 1
i = 0;
alpha = 0.1;
BBB = 5;
maxlight = 20;
toggleHighQuality();
_root.attachmovie("AA", "NN", 9999);
NN._x = 315;
NN._y = 200;
// Mouse.hide();
FRAME 2
for (j=1; j<5 && i duplicateMovieClip("/li0", "li" add i, i);
setProperty("/li" add i, _xscale, getProperty("/li" add (i-1), _xscale)+i*alpha);
setProperty("/li" add i, _yscale, getProperty("/li" add (i-1), _yscale)+i*alpha);
alpha = alpha*1.14;
i = Number(i)+1;
}
FRAME 3
if (i gotoAndPlay(_currentframe-1);
}
FRAME 4
setProperty("li0", _alpha, 0);
FRAME 5
i = maxlight;
// if( first ==1){
// li0._x = li0._x -1;
// first = 0;
// }else{
// li0._x = li0._x +1;
//
// first = 1;
// }
//
while (Number(i)>0) {
setProperty("/li" add i, _y, (getProperty("/li" add (i-1), _y)+getProperty("/li" add i, _y))/2+11*(li0._y-200)/200);
setProperty("/li" add i, _x, (getProperty("/li" add (i-1), _x)+getProperty("/li" add i, _x))/2+11*(li0._x-400)/400);
setProperty("/li" add i, _rotation, getProperty("/li" add (i-1), _x)/4-90);
i = i-1;
}
FRAME 6
BBB = BBB-1;
gotoAndPlay(5);
if (BBB == 0) {
NN._visible = 0;
}
2. Main layer
startDrag ("li0", true);
Thanks in advance for your time
Rob
Can Anyone Help Me Stop This Loop?
I'm trying to stop a tunnel effect so that it stops after, for example, 10 loops. Can anyone out there help with the loop code, and where would it go in the following set up?
The code is set up as follows:
Theres an ACTIONS layer and a MAIN layer on the main timeline.
1. Actions layer has 6 frames, as follows:
FRAME 1
i = 0;
alpha = 0.1;
BBB = 5;
maxlight = 20;
toggleHighQuality();
_root.attachmovie("AA", "NN", 9999);
NN._x = 315;
NN._y = 200;
// Mouse.hide();
FRAME 2
for (j=1; j<5 && i duplicateMovieClip("/li0", "li" add i, i);
setProperty("/li" add i, _xscale, getProperty("/li" add (i-1), _xscale)+i*alpha);
setProperty("/li" add i, _yscale, getProperty("/li" add (i-1), _yscale)+i*alpha);
alpha = alpha*1.14;
i = Number(i)+1;
}
FRAME 3
if (i gotoAndPlay(_currentframe-1);
}
FRAME 4
setProperty("li0", _alpha, 0);
FRAME 5
i = maxlight;
// if( first ==1){
// li0._x = li0._x -1;
// first = 0;
// }else{
// li0._x = li0._x +1;
//
// first = 1;
// }
//
while (Number(i)>0) {
setProperty("/li" add i, _y, (getProperty("/li" add (i-1), _y)+getProperty("/li" add i, _y))/2+11*(li0._y-200)/200);
setProperty("/li" add i, _x, (getProperty("/li" add (i-1), _x)+getProperty("/li" add i, _x))/2+11*(li0._x-400)/400);
setProperty("/li" add i, _rotation, getProperty("/li" add (i-1), _x)/4-90);
i = i-1;
}
FRAME 6
BBB = BBB-1;
gotoAndPlay(5);
if (BBB == 0) {
NN._visible = 0;
}
2. Main layer
startDrag ("li0", true);
Thanks in advance for your time
Rob
How Do I Stop A Loop?
i have an image of a globe that i ahve tweened to increase it in size whilst it looks like it is rotating. How do i stop it from looping back and make it stay large, rotating at the same time?
Why Why The Loop No Stop
code:
///frame 1
function result(a, b) {
return a+b;
}
var i = 0;
while (i<2) {
var value = result(i, 1);
trace(value);
if (value == 2) {
break;
} else {
gotoAndStop(2);
}
i++;
}
///frame2
stop();
trace(i);
you can see the program should do 'gotoAndStop(2)' in the first loop
because the value equal '1' in this time and the variable i should equal '0' but..
in fact,flash got frame2 after finished while loop 2 times
in the way the "else" doesn't work.
why??
Stop The Loop
i'm sure this is the newbiest of newb questions... basically i made a little flash intro to my site... and i only want it to run one time, as opposed to continually looping... is this something i can turn off using html?
How To Loop And Stop
i have basic frames that need to loop all movie from frame 1 to 100 but i need to stop after 3 loops, anyone can help me?
Edit....
i wanted something like this but it want work.. i added this to the last frame
var countLoop=0;
countLoop += 1;
if (countLoop>3) {
stop();
}
Stop A Loop
How do I make my scene stop looping?
Also when i preview my intro in a browser its not centered. How can I center it?
How Do I Stop Loop? And Should I?
I've got a simple function that works towards a lesson progress bar.
onEnterFrame = function () {
progTotal = Math.round (_root._totalframes);
progCurrent = Math.round (_root._currentframe);
progPercent = (progCurrent/300);
trace(progPercent);
}
Works like a champ, but as I traced it I noticed this occurs about 15 times a second (15fps).
This seems like a ton for overhead computing to me, and was wondering if I could just grab it initially on the enterframe and stop. I only need to know once in the frame when it changes (on the entry of a new frame).
Ideas?
Thanks.
Stop On Second Loop
Hello everyone.
Great start to the work week when I have a question this early in the day.
Here it is. I have a web banner that loops twice. I have the loop working no problem (code below). Now on the second play I want to stop it somewhere other than the last frame. For example the movie has text that fades out so the loop can fade in on the second play. But I want to stop on the text before it fades out since the movie is going to stop.
Does anyone know if this is possible. And if you point me in the right direction.
Code:
var loop:Number;
if (loop == 1) {
stop();
}
else if (loop == undefined) {
loop = 1;
}
How To Stop A Swf, Mid-loop
I have a banner that is looping the appropriate number of times, But I need it to stop on a specific frame after looping (NOT the final frame of the swf).
I need it to play through to the frame i want (Frame 85)... instead of JUMPING to it (after the ad plays the fourth time).
This is the script i'm using.
quote:((!x ? x=1 : ++x)<4) ? gotoAndPlay("start") : gotoAndstop(85);
Is my actionscript vocab just limited? I was so proud of myself for figuring it out up to this point. But I've hit a roadblock. Help? Thanks.
jen
How To Stop A .swf To Loop?
I need to do a several amount of flash clip and it need to stay in .swf files. So all the flash clip a made by now don't stop looping. When I preview it by the CS3 Pro, it's ok. But when I export it and play it in my browser, it won't stop looping. How can I stop looping a SWF file when I export it? Can any one help me?
thanks
How To Stop This Loop?
Hi,
I've got a proplem with stopping this loop:
In the first frame I got this code:
if(!initialized){
i=0;
initialized=true;
}
i++;
duplicateMovieClip ("p", "p"+i, i);
p = eval("p"+i);
p._x = -70+random(10);
p._y = 45+random(10);
if (i==30){
i=0;
}
...and in the second frame I got:
gotoAndPlay(_currentframe-1);
The effect is that the clip duplicates over and over again. Now, I want to stop that loop, e.g. when "i" reaches 30. I've tried to do that by changing the last part of the code:
if (i==30){
stop();
}
...but didn't work:) I wonder if anyone can help me on this. I'd appreciate.
Actually I wanted the animation to stop, dissapear or was removed. I've tried this one for instance:
if (i==30){
removeMovieClip ("p");
}
but didn't work either.
Thanks in advance for any help.
Stop Loop Or Not?
I've got a simple function that works towards a lesson progress bar.
onEnterFrame = function () {
progTotal = Math.round (_root._totalframes);
progCurrent = Math.round (_root._currentframe);
progPercent = (progCurrent/300);
trace(progPercent);
}
Works like a champ, but as I traced it I noticed this occurs about 15 times a second (15fps).
This seems like a ton for overhead computing to me, and was wondering if I could just grab it initially on the enterframe and stop. I only need to know once in the frame when it changes (on the entry of a new frame).
Ideas?
Thanks.
How Do I Stop A Loop?
How do I stop an animation from looping?
I attached the file that I need this done on.
Thank you,
Toad
Stop Loop
How can we prevent a clip loaded with:
loadMovie("someMovie.swf",qaz)
from looping? I want to load it and I don't want it to loop!
Thank you very much
Stop A Loop?
I've used Swish to create a .swf file. Everything works fine, but I can't get the file to cancel the loop. I don't want the movie to restart every time it ends. If you could help I'd really appreciate it. Go to http://hop.to/garbage to see the movie I am talking about. Thanks!!
Loop De Loop Need To Stop
Dear Helper People
I am trying to make a movie using the The Matrix Bitstream Effect
http://flashkit.com/tutorials/Specia...52/index.shtml
but I want to goandplay 10 times then stop.
Could you please tell me how I can set it so it goes through the frames 10 times then stops.
Well since I have you hear I would also like to ask.
I am also using the DOS Text Typer Effect
http://www.were-here.com/forum/tutor...sor/index.html
Why is it when I try to insert pictures to desplay on the screen, the pic moves along with the word.
How can I desplay it and not have it move.
-Thanks
Loop+duplicate Mc + Stop, Help
Hi, my problem is this one:
I have a loop in a MC who duplicate 3 Mc (blue, red, yellow). Blue is a Mc of a graphic symbol with a guide.
i would like to do 3 loops to my loop, and after this, I would like that all my duplicated Mc stop.
example of script into my loop:
if (CopyCount < 99 and _root.B == 1) {
CopyCount = Number(CopyCount)+1;
trace ("Blue" add CopyCount);
duplicateMovieClip (_root.Blue, "Blue" add CopyCount, CopyCount);
setProperty ("_root.Blue" add CopyCount, _y, "384");
setProperty ("_root.Blue" add CopyCount, _x, "512");
}
At the last image of the loop, I put:
counter=counter+1;
if (counter !=3) {
gotoAndPlay (2);
} else {
stop();
}
I was thinking that the stop could stop my car to moving, but not.
Do you know how I can do it,
THANKS.
How Can I Stop The Loop Function?
When I'm in the Publish Settings window, I'm making sure the loop button in the HTML section is not checked, yet my movie still loops after I publish.
Where am I screwing up?
jon
Start And Stop A Loop?
Im new to mx, and am used to tell targets to control audio events.
What would be the easiest way to have a start and stop button that starts/stops the audio loop?
Animation Stop During Loop
I have an intensive loop that last at least 5 seconds.
During that time my animation stop. The sole purpose of the animation is to show that my flash movie is not froze.
Is there a way to avoid the animation to stop during the loop.
CFK
Loop Movie Only Twice, Then Stop?
so we can stop a movie after it plays once - no loop. great. or we can let it loop forever. lovely. but how can we make it loop only twice, THEN stop (kinda like you can w/ an animated .gif)?
Thanks!
~elle*
Importing A Loop...why Does It Stop?
I have recently been breaking movies down by scene and making them individual .swf files to load in. When I used to make a large movie, I would call in a looped sound with the loadmovie command and it would loop continually until I told it to stop. Now that I have all the .swf broken down, it stops playing the minute I go to the second swf file off the start page.
I have all .swf files loading into level0 and the sound loading into level 1, but it still cuts off. Can someone tell me what I am doing wrong?
Thanks!
bradley
Anypone Know How To Stop This Loop?
Hi there
I'm trying to stop a tunnel effect so that it stops after, for example, 10 loops. Can anyone out there help with the loop code, and where would it go in the following set up?
The code is set up as follows:
Theres an ACTIONS layer and a MAIN layer on the main timeline.
1. Actions layer has 6 frames, as follows:
FRAME 1
i = 0;
alpha = 0.1;
BBB = 5;
maxlight = 20;
toggleHighQuality();
_root.attachmovie("AA", "NN", 9999);
NN._x = 315;
NN._y = 200;
// Mouse.hide();
FRAME 2
for (j=1; j<5 && i duplicateMovieClip("/li0", "li" add i, i);
setProperty("/li" add i, _xscale, getProperty("/li" add (i-1), _xscale)+i*alpha);
setProperty("/li" add i, _yscale, getProperty("/li" add (i-1), _yscale)+i*alpha);
alpha = alpha*1.14;
i = Number(i)+1;
}
FRAME 3
if (i gotoAndPlay(_currentframe-1);
}
FRAME 4
setProperty("li0", _alpha, 0);
FRAME 5
i = maxlight;
// if( first ==1){
// li0._x = li0._x -1;
// first = 0;
// }else{
// li0._x = li0._x +1;
//
// first = 1;
// }
//
while (Number(i)>0) {
setProperty("/li" add i, _y, (getProperty("/li" add (i-1), _y)+getProperty("/li" add i, _y))/2+11*(li0._y-200)/200);
setProperty("/li" add i, _x, (getProperty("/li" add (i-1), _x)+getProperty("/li" add i, _x))/2+11*(li0._x-400)/400);
setProperty("/li" add i, _rotation, getProperty("/li" add (i-1), _x)/4-90);
i = i-1;
}
FRAME 6
BBB = BBB-1;
gotoAndPlay(5);
if (BBB == 0) {
NN._visible = 0;
}
2. Main layer
startDrag ("li0", true);
Thanks in advance for your time
Rob
For Loop With Stop(); Command?
hi
does anyone know how to make a for loop with the stop command? sort of like below? it doesn't work though:
for (a=1; a<=10; a++) {
"_level0.mc"+a+".stop()";
}
thanks!
Loop 5 Times Then Stop
Hi, I've created a small animation over 20 frames and would like it to play completely through 5 times then stop. I know about putting the stop action on the last frame but how do I specify how many times to loop the animation before it stops.
Thanks.
Image Loop But Stop Everything Else?
How do you do that? I want the .gif image to keep doing what its suppose to do.. then i want everything else not to loop. I dont get it.. this is frusrating me alot!
Loop Four Times Then Stop
I have a movie with several movie clips, one of which I want to loop four times then stop.
1. How do i achieve this?>
2. Is there a danger it could go out-of-synch with the other clips, or is the version i see on my computer safe?
Many thanks
Cristie
Stop A MediaClip Loop
I try to make a presentation and I use a Movieclip and some other things
I juse visible = False/True and MovieClip to Play/Stop.
BUT I have one little problem that drive me crazy.
When that is time to play the MovieClip I write
PHP Code:
mymovie.play();
And that start the movieclip BUT that start to loop.
I have try to have
PHP Code:
stop();
in the layer but that still loop??
Can someone plz help me?
Can I Stop Loop On Certain Layers?
Hello all, I am wondering if I can get something like
Quote:
stop();
to stop only certain layers in a flash document, while letting the other's keep looping?
-=j0nnyr0773n=-
How To Let A User Stop A Loop...
Let's say i'm developing a chessgame, that evaluates moves in a while loop. I want the user to stop the game from looping, and give the move he's come up with so far. Just to stop the waiting for the user. I came up with this (the enterframe is there to let it compile):
Code:
firstTime = true;
this.onEnterFrame = function() {
if (Key.isDown(13) && firstTime == true) {
firstTime = false;
i = 0;
a = 0;
aap.text = "";
while (i<1) {
if (Key.isDown(32)) {
trace("Breekiebreekie "+a);
break;
}
aap.text = a;
a++;
}
}
};
Okay, what happens? For me, it stops the loop, but it doesn't trace.
aap is a textfield, and it roughly displays the same number every time i try and press space. How come?
Loop 2 Times Then Stop
Hi
Trying to figure out how to make a swf file play only 2 times and then stop until the page is reloaded or revisted...at the moment I only see "loop" in DW 8 to be checked or unchecked but I don't see a place to type in a # of times to play the swf file, either in FLASH 8 or DW. 8..wondering how to do this...
Thanks KB
[F8] Loop 3x And Stop In A Certain Frame?
Trying to determine how and where to write a script to allow my movie to loop three times and stop in a frame that has an animated movie clip button (which fades away, disapperaring several frames before the actual last frame of the timeline) to drive the viewer to an external web site.
Frame script, right? any hints
A newbie working under a deadline,
~mdash
Using A Loop To Stop Movie
I have a movie that has 3 rows of 5 blocks, totaling 15 blocks. I have written a script that randomly highlights one block at a time by attaching a movieclip that has a lighter color of the block. The drawback to this script is it runs continuously. I am trying to loop the movieclip, called allpics 15 times then have it stop. Unfortunately, my attempts at using loops have failed. Any Ideas how to overcome this?
Here is my script:
_root.speed = 100;
movePics = function () {
mx = (Math.round(Math.random()*15));
if (mx == 0) {
_root.attachMovie("allpics", "pix", 1);
pix._y = 0;
pix._x = 0;
}
if (mx == 1) {
_root.attachMovie("allpics", "pix2", 1);
pix2._y = 0;
pix2._x = 83;
}
if (mx == 2) {
_root.attachMovie("allpics", "pix3", 1);
pix3._y = 0;
pix3._x = 171;
}
if (mx == 3) {
_root.attachMovie("allpics", "pix4", 1);
pix4._y = 88;
pix4._x = 0;
}
if (mx == 4) {
_root.attachMovie("allpics", "pix5", 1);
pix5._y = 88;
pix5._x = 83;
}
if (mx == 5) {
_root.attachMovie("allpics", "pix", 1);
pix._y = 88;
pix._x = 171;
}
if (mx == 6) {
_root.attachMovie("allpics", "pix2", 1);
pix2._y = 173;
pix2._x = 0;
}
if (mx == 7) {
_root.attachMovie("allpics", "pix3", 1);
pix3._y = 173;
pix3._x = 83;
}
if (mx == 8) {
_root.attachMovie("allpics", "pix4", 1);
pix4._y = 173;
pix4._x = 171;
}
if (mx == 9) {
_root.attachMovie("allpics", "pix5", 1);
pix5._y = 258;
pix5._x = 0;
}
if (mx == 10) {
_root.attachMovie("allpics", "pix5", 1);
pix5._y = 258;
pix5._x = 83;
}
if (mx == 11) {
_root.attachMovie("allpics", "pix", 1);
pix._y = 258;
pix._x = 171;
}
if (mx == 12) {
_root.attachMovie("allpics", "pix2", 1);
pix2._y = 345;
pix2._x = 0;
}
if (mx == 13) {
_root.attachMovie("allpics", "pix3", 1);
pix3._y = 345;
pix3._x = 83;
}
if (mx == 14) {
_root.attachMovie("allpics", "pix4", 1);
pix4._y = 345;
pix4._x = 171;
}
}
id1 = setInterval(movePics, _root.speed);
Timeline Loop That Won't Stop
Hey everyone, I'm new to ActionScript and have been trying to pull off a frame loop but for some reason it just goes on forever. All I am trying to do is loop between frames 2 and 3 10 times and then quit. I send Flash to frame 4 once I have gone back and forth 10 times. I'm not sure if it has anything to do with it but frames 1-3 are keyframes while frame 4 is a "[]" frame. I think that means end frame. They are the only active frames and this is the only timeline in the project. I should also mentioned that I have checked and the number for countLoop eventually goes up to 160,000 but then Flash lets me stop. Here is the code:
Frame 1:
var countLoop;
gotoAndStop(2);
Frame 2:
countLoop += 1;
gotoAndStop(3);Frame 3:
if (countLoop > 10)
{
trace (countLoop);
gotoAndStop(4);
}
trace(countLoop);
gotoAndStop(2);Frame 4:
stop;Thanks for any help :-)
How Can You Stop Freezing While In A Loop?
Does anyone know how to prevent flash-events from freezing while a loop is in progress?
In Visual Basic you can simply add the DoEvents() function inside a loop.
Thanks.
How Do You Stop A Function Loop?
I'm creating a preloader that loops through an array of adjectives and then stops randomly on one of the words in the array. My code actually works, but, I also receive a "256 levels of recursion" error message in the Output dialog. That's not so great. I wonder if anyone knows of a better way to code this. (Note: I'm working in MX 2004.)
Code:
loadArray = new Array("vivid", "effervescent", "luminous", "powerful", "concise", "spontaneous", "mischievous", "radiant");
formatText = new TextFormat();
formatText.font = "Interstate-Regular";
formatText.size = 18;
formatText.color = "0xFFFFFF";
formatText.embedFonts = true;
formatText.selectable = false;
preload_txt.text = loadArray[0];
// Load first item in array
var elapsedSeconds:Number;
var n:Number = 0;
var nCount:Number = 0;
function loopText() {
if (n<loadArray.length-1) {
n++;
} else {
n = 0;
}
preload_txt.text = loadArray[n];
preload_txt.autoSize = "right";
preload_txt.setTextFormat(formatText);
nCount++; // Let nCount reach 8 plus a random number between 1 and 7
if (nCount>8+(Math.floor(Math.random()* 7 + 1))) {
delete this.loopText();
}
}
function initLoop() {
countInt = setInterval(this, "loopText", 100);
}
initLoop();
stop();
Need .swf To Loop ONLY Two Times And Then Stop.
I'm got a fla file that has multiple movie clips of varying timelines....on the "main" timeline, the Scene 1 timeline, if you will, I have only one frame with multiple layers containing the various movie clips. I need a way so that when the movie plays through two times, it then will stop.
Thanks
ClearInterval Does Not Stop The Loop
Hey Guys,
I got a issue. I have read on the forum that "clearInterval" needs to be in the same function as from where i'm declairing the "setInterval" but i was wondering is there some other way to get this stupid thing to stop the loop.
Sorry for the mess.. i have been playing around with it allot.
Thanks!,
Code:
/////////////////////////////////////////////////////// MOUSE ///////////////////////////////////////////////////
//
//
function mouseMoveEffectIn(){
//
if (a1 < totalEffects) {
//
//trace("this['obj'+a].mAlpha:"+_root.effect0["obj"+a].mAlpha);
//
if ((_root.effect0["obj"+a1].mAlpha)<_root._xmouse && (_root.effect0["obj"+a1].mAlpha+mwRange)>_root._xmouse) {
//trace("effect:"+a);
//
//Math.abs(_root.effect0["obj"+a].mAlpha);
_root.effect0["obj"+a1]._alpha = 0;
//
} else {
//
_root.effect0["obj"+a1]._alpha = 100; //_root.effect0["obj"+a]._alpha = baseAlpha;
//
}
//
a1++;
//
} else {
//
trace("Helllo2 /////////////////////////////////");
//
//trace(" -intervalItem2:"+intervalItem2);
clearInterval(intervalId);
//trace(" -intervalItem2:"+intervalItem2);
//
//delete intervalItem2;
//
}
//
}
//
//
function mouseMoveEffectUp(){
//for (var a1 = 0; a1 < totalEffects; a1++) {
//
a1 = 0;
//
//intervalItem2 = setInterval(mouseMoveEffectIn, 700);
intervalId = setInterval(this, "mouseMoveEffectIn", 700);
//
//clearInterval(intervalId);
//
trace("Helllo1");
//
//
}
//
// Create a mouse listener object
var mouseListener:Object = new Object();
//
mouseListener.onMouseMove = function() {
trace("Move!");
//trace("_xmouse:"+_root._xmouse);
//clearInterval(intervalItem2);
//
//intervalItem2 = setInterval(mouseMoveEffectUp, 500);
mouseMoveEffectUp();
//
}
Mouse.addListener(mouseListener);
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
How Do You Stop And Loop Sound?
Hi. I have created a button which plays an external MP3 file, but the first problem is it only plays once. What script do i have to add so the sound continually loops.
Secondly, i have created a button which stops music, but i can't figure out the code which stops the MP3 file playing. I've tried backMusic.close();, but an error message is displayed as the sound is already loaded up.
Heres the code:
ActionScript Code:
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.text.*;
import flash.media.*;
import flash.net.*;
public class Script extends MovieClip {
public function Script() {
/*Other Code*/
//Play and Stop Music
var PlayMusicButton:musicButton = new musicButton();
PlayMusicButton.x = 780;
PlayMusicButton.y = 10;
addChild(PlayMusicButton);
PlayMusicButton.addEventListener(MouseEvent.CLICK, clickPlayMusicButton);
var backMusic:Sound = new Sound();
var req:URLRequest = new URLRequest("back_music.mp3");
backMusic.load(req);
function clickPlayMusicButton(event:Event) {
//How do you loop this sound?
backMusic.play();
}
var StopMusicButton:noMusicButton = new noMusicButton();
StopMusicButton.x = 725;
StopMusicButton.y = 10;
addChild(StopMusicButton);
StopMusicButton.addEventListener(MouseEvent.CLICK, clickStopMusicButton);
function clickStopMusicButton(event:Event){
//What is the code to stop the music?
}
}
}
Thanks for the help.
|