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




Letting 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 she'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?



KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 12-13-2005, 09:53 AM


View Complete Forum Thread with Replies

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

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?

Letting User Draw
I am having trouble getting this code to work it should let the user draw lines on the screen but... Nope

Here is the listing... please help me Im lost--

onLoad = function() {
lineStyle(2, 0x000000);
mousePressed = false;
};
Mouse.addListener(_root);
_root.onMouseDown = function() {
mousePressed = true;
moveTo(_xmouse, _ymouse);
};
_root.onMouseMove = function() {
if (mousePressed == true) {
lineTo(_xmouse, _ymouse);
}
};
_root.onMouseUp = function() {
mousePressed = false;
};

Letting The User Resize Shapes
Hello

I need your help, i am quite new to all this flash lark! I was wondering if there is any code that could be used to let the user resize movie clips, in my case shapes. Does anyone know how to do this. Many Thanks

Rich

Letting The User Save A File.
I'm designing a website based on Windows for a 22-minute cartoon thingy I'm making (by my calculations, it'll be officially up in 2 or 3 weeks, for those who have noticed that I first talked about this about a month ago. We're just recording the audio now, and I want at least one scene done before I go public...)

Anyway, the way I present the "Director's Commentary" section of the site is as a mock word processor, pretending that the director's commentaries are all just different .doc files on the computer. (Man am I ever clever! Go me!) To make this seem more genuine, I said "what the hell" and made it so that the user can write their own document, too. It's not something complex - it's just a big section of useless input text on a white piece of paper thingy. Took about 3 seconds to do, so why not, right?

Naturally, I had to show all my friends how clever I am. Pretty well everyone's response was: "Can you save what you wrote?" Curses! My cleverness has met a roadblock! "No! You can't! Can't you just appreciate my glory without demanding more?! Back, you vultures! Back, I say!"

They have a point. It's not impossible for me to do - I've seen Flash guestbooks.

First question:

How could I add that save option?

Second point:

I'm concerned that would take up needless server space. If some no-life decided "Boy! I'm going to write thousands on stories on this word processor! Keen!" I could run out of space, or at least low on space, on the single most useless and most impractical aspect of the site. So...

Second question:

Would it be worthwhile?

Letting User Choose Font Styles
Hi,

I would like to let a user choose the font size, type(arial..) and decoration (underline/Bold... )

Is there a component of a script around that does this?

How can I get a list of available fonts and decorations.

I would like to restrict the choices of the user to an acceptable set that is available on his/her system.

Thanks,

MikeC

*Help* Letting The User Resize Movie Clips
Hello

I am currently designing a drag and drop game for children for my degree. I have the drag and drop bit sorted but i also want the child to be able to resize number of shapes (which are movie clips) as well as drag them. I am currently using flash 8 and I was wondering if anyone knows any code to resize movie clips? also rotation would be helpful! Hope someone can help! Cheers

Rich

[F8] Letting User To Draw A Grah Or Chaning It
i want to let the user to draw a grapch or chane it
and in the end to save it to xml (for that i need to handle smart the grapch beacuse making xml is no problem)
i want to let the user drag the graph and i nthe end have the graph points
thanks in advance
peleg

User Input/Letting Users Draw
Hi,

Does anyone know if there's a tutorial or way out there so that when users click on the mouse and drag it, it will leave behind a trail? For example, if I wanted to draw an 8, I would hold down the mouse and motion an 8 and while I'm dragging my mouse, it shows up on the screen? I've seen tutorials where some movie clip will follow the movements of the mouse but it doesn't live a permanent trail..and well that's not quite the same.

Any ideas?

Letting User Draw And Save Drawing In A Flash Movie
Hi all,

I am looking to add a "signature" flash movie to some forms I am producing online, the visitors would fill in the form then sign with the mouse/graphics tablet and their signature would be saved on the server.

Is this possible with Flash (5) ? Can flash take what the user draws and convert it to a bitmap or even an SVG and send this to a server side script for saving ?

Many thanks

Rikki

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 Movie From Reloading After User Have Seen It
Hello everyone.

I have website in .html, with flash movie embeded (with preloader and menu buttons).. and I'm trying to stop the movie from loading after the user clicks on one of the menu buttons and goes to the next page.
I did some search and looks like I need to use sharedObject, I found some scripts but nothing worked for me...

Here is what I was using.


Code:

var my_so:SharedObject = SharedObject.getLocal("seenThis");
if (my_so.data.name == "seen it") {
//been here before
gotoAndStop(251);
} else {
//first visit
gotoAndPlay(1);
my_so.data.name = "seen it";
my_so.flush(1000);
}
stop();
I also come to realize that the movie/menu has ongoing animation, and I guess something else should be done for that...
I'm using a template and I'm not sure how I would get that script to work...

here are the files

SWF
FLA

Thank you in advance!

Can I Stop The End User Drag Resizing My Flash Exe?
OK, apologies if posting the same topic in multiple areas is bad, but i kinda need help with this urgently...



is it possible to stop the end user from drag resizing the window of an exe made in flash?


i've used :

fscommand("fullscreen", "false");
fscommand("allowscale", "false");

but they don't do the job i need...


can anyone help?



tanks...

Can I Stop The End User Drag Resizing My Flash Exe?
OK, apologies if posting the same topic in multiple areas is bad, but i kinda need help with this urgently...



is it possible to stop the end user from drag resizing the window of an exe made in flash?


i've used :

fscommand("fullscreen", "false");
fscommand("allowscale", "false");

but they don't do the job i need...


can anyone help?



tanks...

How Do I Allow User To Stop Flash Action And Restart?
hi, i'm hoping someone can answer this. I'm not sure if flash macromedia can do this or not, But i need to create a flash program where the user can stop the frames by hitting the space bar, or any other key on their computer, and then restart it again by hitting a key. anyone know if this is possible?

How Do You Stop An Animation Until The User Clicks On A Button?
In an animation, I've got the title screen/intro frame. I've got a "next" button to go ahead to the animation. But whenever I play the animation, it immediatly goes on. Is there a line of code to be put in? Please help me.

Do You Know How The User The Option To Stop Background Audio?
there is background audio playing in a loop in my project. how can i give the user the option to turn it off?

Advance Frames From Stop By User Mouseover?
I want the make the timeline advance a frame (or to a named frame), but i can't figure out how to make it do that only once the user mouses over the background...

Sits idle at stop(); until mouse enters the background (or maybe an invisible frame?), then advances until another stop();

I've included the .fla file in MX2004 format.

Thanks!

Stop Script After User Error Check
Say if I was writing some code to check users for a login system, making sure they can't get in with empty fields etc how would I go about halting the script once they fail it? So I can print an error without the rest of the checks running in the background and potentially letting them in.

Similar to "exit" in php

Loop Scene Until User Presses New Button
I'm having trouble writing the script to make one scene with action in it keep looping until the user hits another link button to bring it to a new named frame for another scene. Right now, my link buttons work, but when it plays through that scene, it continues playing right through all the other ones until the end of the movie. Since I want things to move while users are in one scene, I don't want to use gotoAndStop.

I have this so far:
_root.pump_btn.onRelease = function () {
_root.gotoAndPlay("screen_pump", 1);
}

How Do I Stop Flv Playback When User Clicks A Navigation Button?
This could be simple but I'm new to as3.
I have a few flv component instances on different frames. When you click a navigation button the current flv should stop and it takes you to a new flv on a different frame. But the previous one keeps playing. How do I stop the current one playing when the button clicks?

User Defined Stop Embedded Video Button
Ok, I fear that my mind and creativity has exceeded my knowledge and I apologize if this has already been posted but I didn't come up with very many options to search for.

I have created a header for a website in Flash Pro 8 and have a "nifty" first frame that displays the progress (text only, no bar) of the loading of an embedded video.  At the completion of loading, it jumps to frame 3 where the video begins.

Some users have asked for an option that, during the loading process, a button be available to click and it stops the loading process.  Currently, those users are just right clicking on the header and clicking "Play" to stop it from playing.

Is there a way (hopefully fairly simple) to place a button that not only stops the current download of the video for that user, but have the preference "remembered" so that the next time they log on, it doesn't start to load (IOW, so they don't have to click it everytime)?

Thanks for your time and, again, sorry for the double post if it was one!
Spaz0

Loop Locking Player User Interface Update
Hi!

In one of my apps, there are some bytearray shuffling going on, and this locks the player (no user interface updates) until ready.

Is there an command/function in AS3 that gives the player calculation time (for handling user interface updates etc.) that would be possible to put inside this kind of attention-demanding loop? I think that I've seen somewhere that there should be...

Regards / Jonas

[MX04] Do You Know How To Give The User The Option To Stop Background Audio?
there is background audio playing in a loop in my project. how can i give the user the option to turn it off?

Stop Flash Animation When User Clicks HTML Link
Hi there,

I have a page that contains an SWF. Beneath this SWF are a series of links that open new _blank windows that also contain their own SWFs. What I would like to do is stop the first SWF when a user clicks on a link so that we don't have two SWFs playing at once (as it could get a bit noisy!).

So basically something included in the link that can control the SWF using Javascript would be great. I found some code that looks something like this (see below) but doesn't appear to work.

HTML Code:
<a href='javascript:example.TStopPlay("_level0/InstanceNameOfMC")'>Stop First Movie</a>
Any advice much appreciated

Loop-dynamically Loads Movie Clips Depending On User Input
Hey?
I was wondering if anyone could help me? I have a combo box component called input_tabAmt. This component witholds 40 labels: 1,2,3,4....40.

What I want to happen is that when a user selects a label eg.- 6 and hits the submit button (submit_btn) then the movie creates/places 6 movie clip symbols on the stage or if they select 40 then the movie creates/places 40 movie clip symbols on the stage.

My movie clip symbol is called "Table". I think I need to use a loop but I am unsure how to create it.

I have only started to learn flash and I'm totally lost! If anyone could offer me any assistance, I'd really appreciate it?!

[MX04] How To Stop Video From Playing Automatically Until User Click A Play Button?
I am using Flash MX 2004.

I have made a video player from scratch and not from the pre-baked components.

I have the video player with a play/pause button, rewind button, a loader, buffer, mute button, etc.
The flv. Videos load into a list box via an xml file which then the user can click the desired video link and switch from video to video.

Using action script I want to know how to stop the video from automatically playing until the user clicks a play button when the player first opens.


var nc:NetConnection = new NetConnection();

nc.connect (null);

var ns:NetStream = new NetStream(nc);

theVideo.attachVideo(ns)




rewindButton.onRelease = function()
{
ns.seek(0);
}

playButton.onRelease = function()
{
ns.pause();
}

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.

Loop Twice Then Stop
How do I get a movie to loop twice and then stop?

Thanks.

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.

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