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




Set Interval Refresh - Help



I'm having more Set Interval Problems.
I think I know what the problem is but I dont know how to correct it.

Heres what I have:

My main timeline is a single frame with MC's and Buttons.
One of the buttons loads an .swf into level_2.
That .swf has an MC on a single frame, in which a series of setIntervals are taking place. They work perfectly on their own. They also work when loaded.

However... the problem is when the button is pushed for a second time, and the same .swf is reloaded. Then any of the buttons and MC's on the main timeline refresh repeatedly, so that they become unusable.

I tried using an unloadMovie(2) before every loadMovie(2), but that doesnt seem to clear whatever is going on.

Heres my setInterval code:


ActionScript Code:
stop();function pauseDelay() {    clearInterval(Pause3);    clearInterval(Pause);    gotoAndPlay("next");}var Pause = setInterval(pauseDelay, 7000);


I should also note that everything worked fine until I added preloader scenes, to both the main movie, and the movie being loaded.



Any help would be greatly appreciated!
Thanks



ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 03-28-2004, 06:04 AM


View Complete Forum Thread with Replies

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

On Refresh Page, Flash Doesn't Refresh Loaded Vars?
Hi my flash app loads random vars from a php script and shows the vars, but on refresh page the flash still contains the same vars as before? How do I reload the php script again and get new random vars into my flash app?

Mads

Set Interval / Clear Interval Question
Ok, here is my problem. I have a bit of actionscript the makes a sentence of text slide out. I just want this text to hang around for about 3 seconds and then slide back out. A delay within the AS to pause the AS before it continues through. I posted this question in here before and I got back some responses on set interval and clear interval. Now I did find a great link to this which I'm sure will help a lot of people out
http://www.umbc.edu/interactive/flas...?p=setInterval

but I just didn't understand how I could use that with what I'm trying to accomplish. Here is the start of my code.

onClipEvent (load) {
myX = 650;
myY= 480;
div = 6;
}
onClipEvent (enterFrame) {
_x += (myX-_x)/div;
_y += (myY-_y)/div;
}
onClipEvent (enterFrame) {
if (this._alpha <100) {
this._alpha += 5;
}
}

I also have the text fade in.
I'm just not sure how to put a delay on this AS before it runs to the end.
Just plain confused.
Any help would be great.

Set Interval / Clear Interval Question
Ok, here is my problem. I have a bit of actionscript the makes a sentence of text slide out. I just want this text to hang around for about 3 seconds and then slide back out. A delay within the AS to pause the AS before it continues through. I posted this question in here before and I got back some responses on set interval and clear interval. Now I did find a great link to this which I'm sure will help a lot of people out
http://www.umbc.edu/interactive/flas...?p=setInterval

but I just didn't understand how I could use that with what I'm trying to accomplish. Here is the start of my code.

onClipEvent (load) {
myX = 650;
myY= 480;
div = 6;
}
onClipEvent (enterFrame) {
_x += (myX-_x)/div;
_y += (myY-_y)/div;
}
onClipEvent (enterFrame) {
if (this._alpha <100) {
this._alpha += 5;
}
}

I also have the text fade in.
I'm just not sure how to put a delay on this AS before it runs to the end.
Just plain confused.
Any help would be great.

Set Interval / Clear Interval Question
Ok, here is my problem. I have a bit of actionscript the makes a sentence of text slide out. I just want this text to hang around for about 3 seconds and then slide back out. A delay within the AS to pause the AS before it continues through. I posted this question in here before and I got back some responses on set interval and clear interval. Now I did find a great link to this which I'm sure will help a lot of people out
http://www.umbc.edu/interactive/flas...?p=setInterval

but I just didn't understand how I could use that with what I'm trying to accomplish. Here is the start of my code.

onClipEvent (load) {
myX = 650;
myY= 480;
div = 6;
}
onClipEvent (enterFrame) {
_x += (myX-_x)/div;
_y += (myY-_y)/div;
}
onClipEvent (enterFrame) {
if (this._alpha <100) {
this._alpha += 5;
}
}

I also have the text fade in.
I'm just not sure how to put a delay on this AS before it runs to the end.
Just plain confused.
Any help would be great.

Set Interval / Clear Interval Question
Ok, here is my problem. I have a bit of actionscript the makes a sentence of text slide out. I just want this text to hang around for about 3 seconds and then slide back out. A delay within the AS to pause the AS before it continues through. I posted this question in here before and I got back some responses on set interval and clear interval. Now I did find a great link to this which I'm sure will help a lot of people out
http://www.umbc.edu/interactive/flas...?p=setInterval

but I just didn't understand how I could use that with what I'm trying to accomplish. Here is the start of my code.

onClipEvent (load) {
myX = 650;
myY= 480;
div = 6;
}
onClipEvent (enterFrame) {
_x += (myX-_x)/div;
_y += (myY-_y)/div;
}
onClipEvent (enterFrame) {
if (this._alpha <100) {
this._alpha += 5;
}
}

I also have the text fade in.
I'm just not sure how to put a delay on this AS before it runs to the end.
Just plain confused.
Any help would be great.

Change The Interval Of An Interval?
Hey,
I was wondering if there is a way to change the interval of an interval? With this I mean, the amount of MS's it waits before the function is called.

I would also like to know if there is a noticable difference on different computers when using intervals <60?

Thnx,
SaphuA

Set Interval
Hi I am trying to get a countdown timer to work.
I am using the code below which I got of the sticky set interval at the top of the forum.

My problem.
After the interval the function is called which plays the movie then it starts again. This works OK but the set interval seems to compound every time. With the countdown getting faster and faster the more times it plays.

I want to have the set interval start fresh each time. I am clearing the set interval by clearing it although that seems to be the problem..

Any Ideas?

On first frame...
//

treecountDown = function (message) {
displayTime--;
if (displayTime == 0) {
trace("trees");
clearInterval(this.timer);
gotoAndPlay("next");
}
};
displayTime=10;
this.timer = setInterval(treecountDown, 1000);
stop();

//

OOP With Interval
hi! i have a strange problem with setInterval and Objects, take a look at this code:
PS! this code is simplyfied for this example

code: _global.loadingO = function(){
this.percentF = function(targetSizeV, currentSizeV){
trace(targetSizeV)
trace(currentSizeV)
trace((100 / targetSizeV) * currentSizeV)

this.percentV = (100 / targetSizeV) * currentSizeV;
trace(this.percentV)// ERROR this variable will not be set when called from an interval
}
this.loadingInt = setInterval(this.percentF, 10, 120, 50);// interval messes up the variable
//this.percentF(120, 50);// this works just fine
}
loadingCake = new loadingO();

when i call the function inside the object with an interval the "this.percentV" variable is not set, but if i call the function normally it all works fine. is there some serious issues to using setInterval in Object or is my code simply wrong.

TOYTOTA

Set Interval
all i want to do is to pause a movie for 6 seconds while another movie is running. the movie is called 'wal'. all help appreciated.

Set Interval
How do I write an if statement that will only be true if a certain amount of time has passed?

Interval
aight all! basically i want my movie to start after 6.5 seconds, now i know i can use dis script for a setInterval:

setInterval(myfunction, 6500);

function myfunction()
{
....

but how do i do it so that it waits 6.5 secs, then starts the prog, and leaves it to carryon playin rather than kepp looping, is there another kind of interval way!
Ta

Oh yeah today is the first day of me new life, yo, u get me, i am LEE J SPOONER,

Set Interval For 1 Second?
I have tried do while loops to take out the whole I part and makeAloop function, But found that I mostly need to use a setInterval to slow down the proccess. What I need is for the interval to be i second or even half a second before the this. FaderOperations function is run again.

here is the code to my class.

class Fader extends MovieClip{
var fade = false;
var i:Number = 0;
var n:Number = 0;
function Fader()
{
this.faderOperations(fade, i, n);
}
function faderOperations(fade, i, n)
{
if (fade == true){
this.nextFrame();
i = i + 1;
makeAloop(fade, i, n);
} else {
this.prevFrame();
i = i + 1;
makeAloop(fade, i, n);
}
//--------Here is the set Interval-------------------------------
setInterval(faderOperations, 10, fade, i, n);
}
function makeAloop(fade, i, n)
{
if (i <= n){
faderOperations(fade, i, n);
}
trace(i);
}
}


Any help would be great.
Thank You
Quince

Interval After Interval
I have a problem. I need an interval to take a women mc("barn_lady") to walk to one stable pen and that uses a setInterval() function to stop her there. Now, the problem happens when I try putting in another interval to make her walk to another stable pen. The women, will go in between the pens and stop. The solution I am looking for is something that will separate the intervals. Does anyone know how to fix this? If someone does, can you help me? Please?
-Thanks for reading
Cobra

Interval Help
Ok, hi I'm new here but not new to flash and was wondering if someone could help me?

So I've making this small mini game which you can see here:

http://img40.imageshack.us/my.php?image=fall4ol.swf
(please ignore the cruddy art)

It's working fine acept for 2 things.

Firstly when you run out of lives the duplicated MC's dont leave the screen, is there anyway remove the via action script? I know I could just add a green MC with a higher depth than the duplicated MC's so it you cant seem them, but there must be a better way.


Secondly, and more importantly, when you die and start again instead of the MC's duplicating one every second, 2 appear every second, so I guess the code producing the MC's is running twice, so I also assume on the game over screen I'll need to disable the interval, so how would I do that?

Any help is appreicated and I'm using MX04 and AS2.0

Thanks in advance

Kirk_C

Set Interval?
Color.prototype.setBrightOffset = function(offset){
var trans = new Object();
trans.rb = trans.gb = trans.bb = offset;
this.setTransform(trans);
};

MovieClip.prototype.setBrightness = function(offset){
var c = new Color(this);
c.setBrightOffset(offset);
};


r1_lmc.onRollOut = function(){this.setBrightness(0);};
r1_lmc.onRollOver = function(){this.setBrightness(100);};


this works good but would someone be able to help me with a set inverval function to help ease the brightness transition out?

How To Set Interval
Hi guys,

I'm making a poker game right now.
Is there anybody who could help me set an interval between each card that been drawed. I really appreciate anybody who could help me.

this is the card drawing code.


picked = new Array();

for(i=0 ; i<52 ; i++) {
picked[i] = 0;
}

pos_x = 92;
for(x=0 ; x<5 ; x++) {
card = new Array();
card[x] = "";
do {
n = (Math.round(Math.random()* 51)) + 1;
} while(picked[n]==1)
picked[n] = 1;
card[x] = n;
c = _root.attachMovie(card[x],"card"+x,x);
c._x = pos_x;
pos_x += 100;
if(x%2) { c._y = 450; }
else { c._y = 420; }
}

[F8] Set Interval
I have an interval being set at different speeds loaded from an XML file. Is it possible to get the current timer value from the interval?

Interval S
i making a game in which ,when a zombie touches the player the player loses health. however, i want it to wait 3 seconds before the zombie can actually cause harm again. the frame rate is set to 40. and i no i can use set interval but none of theways iive tried worked. here is the code that handles the hittest. its within an onClipEvent(enterFrame) inside of the zombies MC

Code:
if (this.touchx.hitTest(_root.alex)) {
if (_root.alex.zombiecanbite == 1) {
_root.alex.HP -= 10;
_root.alex.Inf += 5;
_root.alex.zombiecanbite = 0;
} else {
_root.alex.zombiecanbite = 2;
//This is where i need the code to wait 3 seconds and then set the zombiecanbite to 1 again.
}
}
sorry if its hard to understand. if you have any advice please write it out in complete code form.

Getting Value Of Interval
I've set an interval to show an image for 5 seconds, then go to a fade-out script on another frame. I wish to enable a "pause/play" feature on so I can pause the "imageTime" interval below. I know I can do this by clearing and setting the interval, but I'm curious to know if I can calculate the time remaining in the interval and resume when I click play. For instance, if my image is being displayed, then somewhere around 4 seconds I click pause, can I find that remaining 1 second value and reset the interval to play only the remaining time?


Code:
function showImage() {
clearInterval(imageTime);
gotoAndPlay("fadeOut");
}
imageTime = setInterval(showImage, 5000);

Set Interval
Hello...

I have written a small function that simply moves an object to a new position on stage depending on a variable passed to the function. It works just fine, but instantly rather than in intervals -- mimicking a tween. I was wondering how I would integrate a delay into this function to allow it to work in increments.

The function is as follows:
function moveIt(thePosition) {
while (theName._x != thePosition) {
if (theName._x<thePosition) {
theName._x += 5;
} else if (theName._x>thePosition) {
theName._x -= 5;
}
}
}

Can I use set Interval? If so, how? Would I strip out the while loop to do so?

Help would be greatly appreciated.

Thanks

Set Interval
I am trying to delete a movie clip after it has been alive for x seconds. I also tried what they had in the help but that didnt seem to compile. What am I doing wrong?
Thanks


_root.attachMovie("boom", "blow"+blowNum, blowNum, {_x:bx, _y:buy, _xscale:scale*.6, _yscale:scale*.6});
setInterval(function(){_root["blow"+blowNum].removeMovieClip();}, 1500);

Set Interval Help
I want to attack a movieclip every second, ive tried having a go at added adding a set interval command, but i cant get it to work.
Here's ma code

attach = function () {
for (i=0; i<40; i++) {
repeat = this.attachMovie("ball", "ball"+i, i);
repeat._x = ((i*3)+30);
repeat._y = ((i*3)+30);
repeat._rotation = (20*(i*2));
}
};

I can get it to attach them all at once, but i cant get it to do it one by one

thanks

Set Interval
Hi there,

I have an image gallery, which passes in three images ata time, and i have a load of gallery buttons which load pictures.

First of all, i work out how many gallewry buttons i need, by dividing the number if images by three, easy peasy.

Then what i need to do, is to loop through the gallery buttons from 0 to number of buttonsneeded, and fade each button in. i could tween this, but i wold like to script it. Simply using the code below, the loops are too fast, and the gallery buttons simply appear immediately


Code:

// i have just loaded in the images, and stored the number in this load vars object, kitchentext

this._parent.kitchentext.onLoad = function() {
//hide all
for (z=0; z<=6; z++) {
_root["gallery"+z]._visible = false;
}
//get total number of images
this.image_number = _root.kitchentext[_root.Currentkitchen+"_number"];
this.gallerybuttons = this.image_number/3;
//show gallery buttons needed
for (i=0; i<=this.gallerybuttons; i++) {
_root["gallery"+i]._alpha = 0;
_root["gallery"+i]._visible = true;
for (p=0; p<=100; p++) {
_root["gallery"+i]._alpha += 1;
}
}
};
So, i found the set interval fucntion, and came up with this


Code:


this._parent.kitchentext.onLoad = function() {
//hide all
for (z=0; z<=6; z++) {
_root["gallery"+z]._visible = false;
}
//get total number of images
this.image_number = _root.kitchentext[_root.Currentkitchen+"_number"];
this.gallerybuttons = this.image_number/3;
for (i=0; i<=this.gallerybuttons; i++) {
//set gallery properties
_root["gallery"+i]._alpha = 0;
_root["gallery"+i]._visible = true;
//create the function which increments gallery item alpha by 1
increaseAlpha = function () {
_root["gallery"+i]._alpha += 1;
// if the galleries alpha = 100, break interval
if (_root["gallery"+i]._alpha=100) {
clearInterval(Go);
}
};
Go = setInterval(increaseAlpha, 10);
//create interval to call fucntion every 10 milliseconds
}
};
This on in an on press event. (whether that makes any difference i dont know), and i cant seem to get it to work

Really greatful for any help on this, not long been using as :-)

many thanks

jamie

SET INTERVAL
http://www.kirupa.com/developer/mx20...otogallery.htm
http://www.kirupa.com/developer/mx20..._slideshow.htm

I need some help to develop these two galleries, due to a lack of knowledge to scripting!

i would like to have a slide show to have an auto run and forward and back buttons, but the code in thes tuts is a bit over my head!

I do have this simpler code with fwd and bck buttons that works, just need to use a set interval to get a slideshow going on, PS it doesn't have to be XML.

//my simple code
maxImages = 4;
toLoad = 1;


imagenav.btnFwd.onPress = function() {
imageForward();
};

imagenav.btnBack.onPress = function() {
imageBack();
};

//------------------------------



imageForward = function () {

toLoad++;
if (toLoad>maxImages) {
toLoad = 1;
}
if (toLoad<1) {
toLoad = maxImages;
}

holder.loadMovie("images/image_0"+toLoad+".jpg");

};

imageBack = function () {
toLoad--;
if (toLoad<1) {
toLoad = maxImages;
}
if (toLoad>maxImages) {
toLoad = 1;
}

holder.loadMovie("images/image_0"+toLoad+".jpg");
};

any ideas gratefully received
Rat

Set Interval
I have to use Set Interval but i dont know how exactly i can achive the following

I have to start 3 different MCs ...

first at 4 Secs
second at 9 seconds
third at 11 secs

has sumone a rough and dirty script using set interval for this???

thanx in advance

Set Interval?
How to create Set Interval one movie to another Movie loading?

any example help me?

About Interval
i created a button and a dynamic text box with variable "a" and here are my codes for the bottom:

on(realese){
a = 5;

setInterval(countdown,1000);

function countdown(){
if(a > 0){
a--;
}
}
}

when i test it,the first time work all fine,the "a" decrease 1 every second,but the second time it just doesnt act how it suppose to be.is there something wrong with the interval?

Set Interval
I everyone, I'm sure someone can help me with that...

listen, I want to do a setinterval but my var have 2 parameters and it does'nt work with it


var myInterval = setInterval(alt(pX,pY),80000)


How can I do to make this work, I'm making like a ALT beside my button so I really need my parameters?

Thanks

Set Interval
I have a swf that loads external swfs on button presses. I would like to cycle through them as well. what is the correct way of going about this?
I have it set up so 3 frames hold different sections. I want it to cycle through each of those sections every 30 seconds or so. I know you need to use setInterval but I am not exactly sure how

How Can I Set Interval From Xml
hi guys
i had made an image gallery with using xml. that's ok.

But now client wants to control the Interval between image transition from an external xml or text file.

secondly he is asking for the random transition among images. Is it possible that, loading external image and giving them different transition to the image gallery.

some body help me out

thanks

Set Interval In AS 2.0
Hi All,

I want to make call to the fnCall() function everytime fnTrace() is called. Currently only the fnTrace is being called after 2 seconds but the fnCall function is not called following it..... any idea why this is happening?


Code:

class Test {
public function Test() {
setInterval(fnTrace, 2000);
}
private function fnTrace():Void {
trace("fnTrace");
fnCall();
}
private function fnCall():Void {
trace("fnCall");
}
}

Set Interval Help
I want to attack a movieclip every second, ive tried having a go at added adding a set interval command, but i cant get it to work.
Here's ma code

attach = function () {
for (i=0; i<40; i++) {
repeat = this.attachMovie("ball", "ball"+i, i);
repeat._x = ((i*3)+30);
repeat._y = ((i*3)+30);
repeat._rotation = (20*(i*2));
}
};

I can get it to attach them all at once, but i cant get it to do it one by one

thanks

Set Interval
Hi there,

I have an image gallery, which passes in three images ata time, and i have a load of gallery buttons which load pictures.

First of all, i work out how many gallewry buttons i need, by dividing the number if images by three, easy peasy.

Then what i need to do, is to loop through the gallery buttons from 0 to number of buttonsneeded, and fade each button in. i could tween this, but i wold like to script it. Simply using the code below, the loops are too fast, and the gallery buttons simply appear immediately


Code:

// i have just loaded in the images, and stored the number in this load vars object, kitchentext

this._parent.kitchentext.onLoad = function() {
//hide all
for (z=0; z<=6; z++) {
_root["gallery"+z]._visible = false;
}
//get total number of images
this.image_number = _root.kitchentext[_root.Currentkitchen+"_number"];
this.gallerybuttons = this.image_number/3;
//show gallery buttons needed
for (i=0; i<=this.gallerybuttons; i++) {
_root["gallery"+i]._alpha = 0;
_root["gallery"+i]._visible = true;
for (p=0; p<=100; p++) {
_root["gallery"+i]._alpha += 1;
}
}
};
So, i found the set interval fucntion, and came up with this


Code:


this._parent.kitchentext.onLoad = function() {
//hide all
for (z=0; z<=6; z++) {
_root["gallery"+z]._visible = false;
}
//get total number of images
this.image_number = _root.kitchentext[_root.Currentkitchen+"_number"];
this.gallerybuttons = this.image_number/3;
for (i=0; i<=this.gallerybuttons; i++) {
//set gallery properties
_root["gallery"+i]._alpha = 0;
_root["gallery"+i]._visible = true;
//create the function which increments gallery item alpha by 1
increaseAlpha = function () {
_root["gallery"+i]._alpha += 1;
// if the galleries alpha = 100, break interval
if (_root["gallery"+i]._alpha=100) {
clearInterval(Go);
}
};
Go = setInterval(increaseAlpha, 10);
//create interval to call fucntion every 10 milliseconds
}
};
This on in an on press event. (whether that makes any difference i dont know), and i cant seem to get it to work

Really greatful for any help on this, not long been using as :-)

many thanks

jamie

Interval Help
Ok, I've been through previous posts on this board for help on making a delay in a flash movie but when I try to emulate this I just can't get it to work, it just plays straight through the script.

All I want is the movie to pause, for say 4 seconds, then continue.

I wont confuse matters by putting the script I have down here, as I'm sure someone knows the answer to this seemingly simple question.

Thanks!

Set Interval
how would i specify set interval to call function a certain number of times

Set Interval Help
I'm not sure if this is possible but I'm trying to fiqure out a way to have multiple SetInterval functions. what I'm trying to do is have text highlight a sentence using the setinterval function than after the number of chars needed are highlighted I want to be able to clear the interval and then start with the next sentence through another setInterval.

The program I'm trying to write is somewhat of a text to speech. I have a audio clip and a static text box. the audio is supposed to sync with the highlight of the text. the only way i could fiqure to generate the sync with a highlight was through setSelection as a loop.

I hope i'm making sense as I'm new to this type of actionscript.

here is where I am currently at.


Code:

var i:Number = 0;
var my_snap:TextSnapshot = test.getTextSnapshot();
var count:Number = my_snap.getCount()
my_snap.setSelectColor(0xffff00);

var intervalId:Number;
var count:Number = 0;
var count2:Number = 0;
var maxCount:Number = 20;
var maxCount2:Number = 113;
var duration:Number = 50;

var intervalId:Number;
var count:Number = 0;
var maxCount:Number = 20;
var duration:Number = 50;

function executeCallback():Void {
trace("executeCallback intervalId: " + intervalId + " count: " + count);
my_snap.setSelected(i, i+1 , true)
i++;
if(count >= maxCount) {
clearInterval(intervalId);
my_snap.setSelected(0, 21 , false);
clearInterval(intervalId);
}
count++;
}

function beginInterval():Void {
if(intervalId != null) {
trace("clearInterval");
clearInterval(intervalId);
}
intervalId = setInterval(this, "executeCallback", duration);
}

function beginInterval2():Void {
if(intervalId != null) {
trace("clearInterval");
clearInterval(intervalId);
}
intervalId = setInterval(this, "executeCallback", duration);
}

beginInterval();
beginInterval();
any directions would be great as I'm going crazy.

stephen

Pls Help With Interval
ello... can anyone point to me..where to put the set interval in this below code if i wanna make the duplicate one bye one..i mean after it finished duplicate one and proceed duplicate 2nd after second..and so on..is it possible....i've tried put the set interval code but it's seem not work at all..the example code are below...


ActionScript Code:
bil = 1;
    for (j=0; j  < 4; j ++) { 
          for (i=0; i < 4; i ++) {
                duplicateMovieClip(theMask, "theMask"+bil, bil); 
                setProperty("theMask"+bil, _x, (i * 100));
                setProperty("theMask"+bil, _y, (j * 100));
                bil ++;             
           }   
     } 
 stop();





really need help...

thx
__________________

Interval
Hello,

I was wondering if someone here could enlighten me on how to do this properly. I want to load different swf files randomly in my mc with a interval. But if I start this movie it also waits at the start and I want it to load directly and then uses the interval.

Code:

var container:Array = ["1.swf","2.swf"];
var movies:Array =  container.concat();

function pickAclip(){
        var thePick:Number = makeRandom(0,movies.length);
        var theMovie:String = movies[thePick];
        loadMovie(theMovie,holder);
        movies.splice(thePick,1);
        if(movies.length <= 0) movies =  container.concat();
}

function makeRandom(min,max){
        return Math.floor(Math.random()*(max-min)+min)
}

setInterval(pickAclip,9800);


Thnx in advance,


Sipko

Game Interval
A friend and I are creating a game and have run into a problem that causes the game to increase speed each time it is played. Someone told me to move my setInterval to inside each movie clip rather than the function that loads the clip. Is this correct? Are there any other suggestions?

~Dera

Set Interval Problems
I'm trying to create a function involving four different mc's and after let's say 5 seconds it jumps to the correct frame number or label of each. Just can't seem to get it to work right. Here's what I have so far.

contentMenu = function(){
content_mc.nextFrame();
button1_mc.gotoAndStop("off");
button2_mc.gotoAndStop("on");
button3_mc.gotoAndStop("off");
updateAfterEvent();
}
menuID = setInterval(contentMenu, 5000);

Any suggestions on how to do this correctly? Each button has two frames (on and off) and content_mc has three. The idea is the on the first instance. Frame 1 appears for content_mc and button1_mc is set to it's on or first frame. Likewise the next instance, content_mc is on frame 2 (nextFrame) and button2_mc is now on and the rest are off and so on.

Using Set Interval On A TextFx
hello

i wanna know why this code generate so much instances of my char_ani_mc ...
would be a nice if i could control the velocity of the fx too ...

but i just donno what else can i do...please help me!


//////////////////////////////////////////////////////////////////

/* root.frame1 */

myvar="random TEXT random";

function setDuplicates() {
i++;
_root.attachMovie("generator", "generator"+i, ++_root.maxdepth);
_root["generator"+i].speed = random(50);
_root["generator"+i].xPos = random(Stage.width);
_root["generator"+i].maxChar = 9;
_root["generator"+i].serie = substring(myvar,Math.round(Math.random(myvar.lengt h)), 2);
}

setInterval(setDuplicates, 460);


//////////////////////////////////////////////////////////////////

/* mc.generator */


function generator(x,n,s) {
if(i<n){
i++;
_root.attachMovie("char_ani", s+i, ++_root.maxdepth);
_root[s+i]._y = Math.round(Math.random(99) * 180);
_root[s+i]._x = Math.round(Math.random(99) * 700);
_root[s+i]._yscale = i*30;
_root[s+i]._xscale = i*30;
_root[s+i]._alpha = random(99);
_root[s+i].fade(1, false);
} else {
clearInterval(cascadeInt);
this.removeMovieClip();
}
}

cascadeInt = setInterval(generator, speed, xPos, maxChar, serie);



//////////////////////////////////////////////////////////////////

/* textfield */

tfield.text=substring(_root.myvar, random(_root.myvar.length), 1);


and


on the char_ani mc i got a removeMovieClip();






This is a kind of growing letters fx with some random alpha
just donno how to end the fx..theres someone up the help ?

HELP_random Set Interval
i am trying to use a random set interval...this is what i have, but i am having some trouble...please help...:

//script
playMC = function() {
play();
clearInterval (pauseMC);
}
pauseMC= setInterval (playMC, (random (1000 * 5)));


thanks

Interval Not Cleared.
Hey,

got this prob:

//
function theFunction () {
// Some statements and...
clearInterval(myInt);
}
// I've set an interval as follows
var myInt;
myInt = setInterval(theFunction,1000);

The function should immediately cancel the interval so it is executed only once after a delay.

The interval keeps repeating however.

Any suggestions?

ThanX.

Set Interval Quirk
I posted this in the Newbies forum, but thought it was more appropiate here.
I have a simple tween in an MC that I want to repeat every 5 or 6 seconds.
The script I am using (with the help of someone else on the board)
is this

stop();
function stopClip() {
gotoAndPlay(1);
}
setInterval(stopClip, 5000);

Whats happening is that it loops every 5 seconds for the first 4 or 5 loops, then gets very sporadic. It will loop every 1 second, play half way, then repeat. I have even tried the updateAfterEvent method and it still wont work.

I have attached the .fla

Thanks for your help.
Josh

Problem With Set Interval
Hi. I am trying to use set interval and to stop it. Here is what I am doing:

thiscount=0;

function start(){
var intervalID;
intervalID=setInterval(myfunc,1000);
}

function myfunc(){
if(thiscount>19) clearInterval(intervalID);
thiscount++;
}

The problem is, it keeps on running. Can it be stopped? If so, what is wrong? This count seems to stop when it sould but myfunc keeps being called.

Thanks

Time Interval
And another stupid question...:-)
How can I do to know the time between two actions (a "press" and a "release", for example)?
Thanks

Pause Interval
If I want to "pause" a frame for a second, and then continue on to the next one. I remember the code being something like:

stop();
pauseinterval = 1000
GotoAndPlay(1);
}

Can anybody please give me the correct one?

Thanks a bunch!

Alternative To Set.interval ?
I was wondering if there's an alternative for the set.interval action as it is rather depedent on the fps of each system.

As you can see in the .swf below, the buttons on the MC's as well as the close button on the top right show up before the MC's animation is over.

What is the best way to find out whether the MC has reached for 100% either their original state or the xpanded state, taking into account that the script used for expanding the MC's is as follows :

onClipEvent(enterFrame){
this._width+=(_root.c6width-this._width)/2;
this._height+=(_root.c6height-this._height)/2;
}

Also, as I will be loading an external movie, I need to be sure that the external movie is loaded after the MC has reached 100% of its expanded state.

CMS

Thanks for your help.

Smalco

Set Interval Problem
hey i have this block of code:

setInterval(function () {
angle += 0.045;
_parent.clock.back.arm._rotation = angle;
timer = i;
}, 1);

it moves an arm on a clock very smoothly, works fine in a SWF but runs far too slowly when in a browser, any ideas would help alot. im lost..

cheers

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