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








Pause: SetInterval Help


I'm using the following code in a movie clip to do a slide show:

function wait() {
stop();
var myInterval = setInterval(function () { play();clearInterval(myInterval);}, 3.5*1000);
}

then I put a "wait()" action after every new picture. Everything works fine.

Now the problem is this. If I click on a button in the movie, bringing me to a new frame, the wait function is still working and will mess everything up. How do I cancel it?




FlashKit > Flash Help > Flash ActionScript
Posted on: 07-31-2005, 07:08 AM


View Complete Forum Thread with Replies

Sponsored Links:

SetInterval And Pause
I am using setInterval with success, allowing for a timed delay to occur between the dynamic loading of jpgs. What I am now looking for is the methodology to 'pause' the setInterval and to then call it again to resume. The functionality is basically to allow for the 'pausing' of a timed slideshow and the 'continue' of the same slideshow based on button actions.

The code that I am successfully using is:

setInterval(runSlides,10000);

Where runslides is a function that is called.

View Replies !    View Related
Pause Then SetInterval
Hi there,
I'm trying to get an object to move to its left 1 pixel every second, after an initial 6 second pause.

So,
You press a button,
the object (panel_mc) moves 20 pixels to its left along its x axis,
then after 6 seconds (if nobody has pressed the button again)
the object starts to move to the right (along its x axis) 1 pixel a second.

- I can get the object to move the initial 20 pixels.
- I can also get the object to start moving to the left 1 pixel per second (after the button is pressed)


Code:
function goBack() {
panel_mc._x -= 1;
}
setInterval(goBack, 1000);
I'm stuck on how to pause for 6 seconds (after the button is pressed and before it starts moving back)

If anyone can help that would be great.

thanks

View Replies !    View Related
[F8] Pause SetInterval
Hi

Is there a way, to pause a 'setInterval' and then resume the setInterval, from where it was paused/stopped? I quess you would have to return the value of setInterval? Is that possible, or should it be done in another way?

I am creating a dias-show, and want to add a pause-feature.

View Replies !    View Related
Pause SetInterval
Hi, I have a question regarding the photo slideshow using XML and flash

(http://www.kirupa.com/developer/mx20...slideshow3.htm)

How can you create a button that will pause the slideshow? I can't find a way to stop the setInterval function once it's running.

Anyhelp would be greatly appreciated!!

View Replies !    View Related
Setinterval.please Pause
I did a search on this topic and tried a million things, I just can't get it to work.

I have an mc. in that mc there is a setinterval which should take it to frame 1 on the _root to be replayed. this should loop.


ActionScript Code:
stop();
function loopClip(){
    _parent.gotoAndPlay(1);
    clearInterval (this.intervalID);
    }
this.intervalID = setInterval( loopClip, 5000 );


but it doesn't want to delete the setinterval. which makes it go in a loop frenzy forever.
Please help!

~G

View Replies !    View Related
Pause With SetInterval Is Speeding Up
My problem is that my external swf are speeding up the second time you see it. I think it's the use of setInterval wich is making the movieclip speed up. Can anyone take a look at my coding? Is there a way to clear the interval in a frame before the "pause action frame" is played? I have tried to use clearInterval(myTimer); in a frame but this dosen't work. Is there another easy way to pause on a frame wich don't have this speed-up problem?


I have a external slideshow wich I load to my main stage using
(release) {
loadMovie("slideshow.swf", "_root.empty");
}

In this slideshow I use these actions
Frame 1: (fade in mc)
tellTarget ("_root.fade-in") {
gotoAndPlay(2);
}

Frame 2: (a pause frame)
stop();
function startAgain() {
clearInterval(myTimer);
play();
}
myTimer = setInterval(startAgain, 5000);

Frame 3: (fade out mc)
tellTarget ("_root.fade-out") {
gotoAndPlay(2);
}

Frame 4 to 19: nothing here, just leting the fadeout play to end

Frame 20 to 23 I use the same actions as in frame 1 to 3

View Replies !    View Related
Clarification On SetInterval To Pause
I recently discovered via this forum how to use setInterval to pause the playhead, saving me thousands of empty cells in my timeline (thankyou).

I've used this successfully for a while, but now I have a file that seems to be ignoring my stop commands in frames. I know you are supposed to clearInterval.

On the first frame of the movie I have this code:

function pause(){
play();
clearInterval(timer);
}

Does this code mean that after the designated pause time, the movie plays and the setInterval is cleared?

Then where I want the movie to pause I have this code:

stop();
timer = setInterval(pause, 1000);

As I said this works most of the time, but recently I have started using some action script on the end of sound objects (narration) to start playing after the playhead is stopped with a stop() command.

So here is basically what I'm doing. I start the narration as a soundObject, during the narration I have several pauses using the setInterval method, then towards the end of the narration I put a stop() in a frame and use this code:

voice19.start(0,1);
voice19.onSoundComplete = function() {
play();
}

to start the playhead again. Only the stop() command is just being ignored.

I've spent days trying to figure this out and would appreciate any help.

thanks,
Dennis

View Replies !    View Related
Playing/pause With SetInterval
I am working on a project that starts playing when the file loads. There are play & pause controls on the interface - my trouble is when I first click pause it pauses properly, or more accurately - clearInterval. When I try to restart it, it doesn't seem to reset the interval.

Here is my code:


Code:
this.pause_btn.onPress = function() {
clearInterval(inter);
trace('paused');

}

this.play_btn.onPress = function() {
delay = 5000;
_root.playMe(delay);
trace('playing');
}

function playMe(delay) {
counter = getCounter();
inter = setInterval(displayData, delay, counter, 'forward');
trace('playing');
}

this.playMe(delay);
So when the file loads, playMe() runs every 5 seconds. Clicking pause_btn, clearsInterval which stops playing. When I click the play_btn, it does not triiger the playMe function - not even a trace is displayed.

Any thoughts?
Thanks
Rich

View Replies !    View Related
Pause Effect Using SetInterval
I'm currently developing a game in FlashMX and I'd like there to be a pause of a few seconds before a button/character becomes active/clickable. Instead of adding a load of frames to create the effect, I'd like to use actionscript to create the pause. I know that this should be possible using setInterval function, but all the tutorials I've found are usually in a different context or don't explain where or on what the script should be put.

Thanks - Jessie

View Replies !    View Related
Pause Prototype / No Setinterval
Hi all...
i think ive asked this before but I couldnt find the thread.... what I need is a pause prototype....not setInterval. Have any of you find a good prototype for this or know a function for this??

This is what id like to do:

pause=function(time){
blah blah blah
}

blah = function(obj){
tween something......
pause(10)
tween something else....
}

blah()

Thanks for your help...

View Replies !    View Related
Pause (or Delay) With SetInterval
Hi!

Anybody knows how I can the following?

I want to perform an action, and after a period of time (one or two seconds)
do another one, and after one or two seconds a last action too. For example:

1. mainmc._xscale = 250
mainmc._yscale = 250

(wait two seconds)

2. mainmc._rotation = 45

(wait four seconds)

3. mainmc._alpha = 50

I tried the following script and works only one time, when I try to do it again doesn't work:


pause = setInterval(function () {


mainmc._alpha = 50


clearInterval(pause);
}, 1000);

pause = setInterval(function () {


mainmc._rotation = 45

clearInterval(pause);
},900);
pause = setInterval(function () {


mainmc._xscale = 250
mainmc._yscale = 250

clearInterval(pause);
}, 800);

View Replies !    View Related
SetInterval To Pause Movie
Hi,
I want to make use of the setInterval function so that the movie pauses for a while and then after 15 seconds it goes to another frame. I have tried the following codes but did not seem to work. I cannot use getTimer because it jumps from Scene 1 straight away to the desired frame, without pausing (because of the onEnterFrame).
Kindly advise.
U







Attach Code

//timeline pauses for 10 seconds
var nInterval:Number = setInterval(doAction, 7000);
function doAction():Void {
}

//Is the code below valid
if (setInterval(nInterval)>7000) {
gotoAndStop("hand");
clearInterval(nInterval);
}

View Replies !    View Related
Pause Playback (setInterval?)
Hi all, I have a very straight forward piece I'm working on that involves copy fading in and out but, instead of using the time-line for timings I'd like to use some script. Can anyone help me out?
It's just copy fades in (hold for three seconds) then fades out (hold for one second) copy fades in (hold for three seconds) etc...

View Replies !    View Related
How To Pause An Functin With Setinterval And Play Again?
Little bit stuck here, I call a function changePhoto with setInterval.

Furthermore I got two buttons (pause and play)

Now with pause I just clearInterval and with play I want to start where
changePhoto has been stopped???


ActionScript Code:
nav_mc.pause_mc.onRelease = function(){    trace("Pause this "+pIndex);        clearInterval(playID);    nav_mc.play_mc._visible =true;    this._visible = false;}nav_mc.play_mc.onRelease = function(){    trace("Play this");    play();    nav_mc.pause_mc._visible =true;    this._visible = false;}playID = setInterval(this, "changePhoto", 4000, 1);

View Replies !    View Related
SetInterval For A Pause In Screens Class
Some with the setInterval - trying to integrate a 10 second pause within the onFocus behavior. Slide loads/focuses, audio plays, onto the child screens.



ActionScript Code:
on (focusIn) {
 
setInterval(gotoNextSlide,10000)
    //Load Streaming mp3 behavior
    if(_global.Behaviors == null)_global.Behaviors = {};
    if(_global.Behaviors.Sound == null)_global.Behaviors.Sound = {};
    if(typeof this.createEmptyMovieClip == 'undefined'){
        this._parent.createEmptyMovieClip('BS_vo1',new Date().getTime()-(Math.floor((new Date().getTime()) /10000)*10000) );
        _global.Behaviors.Sound.vo1 = new Sound(this._parent.BS_vo1);
    } else {
        this.createEmptyMovieClip('_vo1_',new Date().getTime()-(Math.floor((new Date().getTime()) /10000)*10000) );
        _global.Behaviors.Sound.vo1 = new Sound(this.BS_vo1);
    }
    _global.Behaviors.Sound.vo1.loadSound("audio/1.mp3",true);
      // GoTo Next Screen behavior
      var screen = null;
      var target = this;
      while((screen == null) && (target != undefined) && (target != null))
      {
        if(target instanceof mx.screens.Screen)
        {
          screen = target;
        }
        else
        {
          target = target._parent;
        }
      }
      if(screen instanceof mx.screens.Slide)
      {
        screen.rootSlide.currentSlide.gotoNextSlide();
      }
      // End GoTo Next Screen behavior
 }


Any ideas? Thanks

View Replies !    View Related
Pause And Play Cuepoint With Setinterval
I am try to set an interval so when intervalID = setInterval(interval, 1000, infoObject.name); is fired at each cuepoint name i.e na1 etc the FLV is paused.

Is this the best way, or is there a better way to do this?
thanks


Code:


var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
display.attachVideo(ns);
ns.seek(0);
ns.onCuePoint = cuePointHandler;
ns.setBufferTime(20);
display.smoothing = true;
ns.play("filmstrip18new31.flv", 0, 100, true);
//every 500ms execute the function checkLoaded with param = stream_ns
var loaded_num:Number = setInterval(checkLoaded, 500, stream_ns);
function checkLoaded(my_ns:NetStream) {
//calculate the percent loaded
var percentLoaded:Number = Math.round(ns.bytesLoaded/ns.bytesTotal*100);
trace(Math.round(ns.bytesLoaded/1000)+" of "+Math.round(ns.bytesTotal/1000)+" KB loaded ("+percentLoaded+"%)");
if (percentLoaded>=100) {
clearInterval(loaded_num);
}
}
//loop FLV when completed
ns.onStatus = function(info:Object) {
if (info.code == "NetStream.Play.Stop") {
ns.seek(0);
ns.play();
}
};
// create 12 buttons and attach them to a cuepoints.
ns.onCuePoint = function(infoObject:Object) {
var id:String = infoObject.name.substr(3);
var mc:MovieClip = attachMovie("but", "but"+id, Number(id)+1);
intervalID = setInterval(interval, 1000, infoObject.name);
trace("but"+id+" "+infoObject.name);
mc._x = 212;
mc._y = 227.3;
if (infoObject.name == "finish") {
trace("completed loop");// when loop is complete set Number(id) type function to 0
}
_root["but"+id].onPress = function() {
trace("this button : "+id+" "+infoObject.name);
trace("---------");
ns.pause();
};
};

//pause FLV for a second and replay through after setInterval
function interval() {
ns.pause();
}

View Replies !    View Related
Stop Button Used With SetInterval Pause Technique
To control the length of my timeline, I use a pause script that I got from this board; looks like this:

Code on first frame of my movie:

function pause(){
play();
clearInterval(timer);
};

Code on various frames down the timeline where I want it to pause:

stop();
timer = setInterval(pause, 2000);

The above works great for me.

I want people to be able to pause and start the movie with the space bar, so I put over the whole stage a MC that will do this. this MC has two frames with a big invisible button on each frame and a stop command on each frame. Frame 1 button code:

on (release, keyPress "<Space>"){
_root.clearInterval(timer);
_root.stop();
this.play();
}

this.play sends MC to second frame where the second button is with this code:

on (release, keyPress "<Space>"){
_root.play();
play();
}

This works a couple of times, but then stops working. Any ideas why? Open to easier way to do this, but I would like to have users just be able to use the space bar.

Thanks.

View Replies !    View Related
Override SetInterval To Pause Movie Timeline
Hi -
I have a movie timeline that plays a continuous loop. I have added several delays to allow the user to read blocks of text before the animation continues. I want the user to be able to stop the presentation at will. The delay works fine, but I simply cannot get the presentation to pause.

delay script on frame-

function wait() {
stop();
var myInterval = setInterval(function () { play();clearInterval(myInterval);}, 4*1000);
}
wait();

code on stop button

on (release) {
clearInterval(myInterval);
stop();
}

If I change it to this it works

on (release) {
clearInterval(myInterval);
gotoandPlay("intro");
}

but I dont want it to go anywhere. I just want the main timeline to stop.
AARRGGHH!
Any help would be greatly appreciated!!!

View Replies !    View Related
Pause/Resume Slideshow Using SetInterval/clearInterval?
Hello,

I promise I did a big search on this topic, and I have a few books on hand, but this seems to be beyond what I know, which isn't all that much!

I'm trying to get my slideshow to "pause" and "resume" on mouse actions--rollOver to pause, rollOut to resume, click to go to another URL or another frame (not yet decided which, but I want to display the contact info when one clicks an image). I also have it set to show the "captions/descriptions" of each image on rollOver.

Each image is placed in its own frame, with this AS to give each image 2 seconds to show, with description on rollOver. This works so far:

ActionScript Code:
stop();var interval:Number = setInterval(function () { play(); clearInterval(interval);}, 2000);


I have all the images as buttons, and the descriptions are hidden unless the images are rolled over.

What I want to do is to pause the slideshow as long as the mouse is over the image (i.e, the user can view the image longer than the interval is set), and resume where it left off (I suppose going to the next image is just fine).

Initially, I very much wanted to have a "controller" of sorts to show up upon rollOver (but hidden otherwise), with which the user can skip forward or back instead of waiting for the entire show to run its course. Since I can't even figure out the pause/resume issue, I figured I'd keep it simple. However, I'd appreciate any input regarding making this happen, as well.

I'm attaching my test Fla here. It's entirely possible that I'm pursuing this using a wrong method, but setInterval is the only way I knew how to not resort to designating tons of frames per image.

Thank you in advance for any help--I appreciate your time!

View Replies !    View Related
Custom Objects And Internal SetInterval Loops -> A Problem Stopping The SetInterval
Let's say I had a class like this:


PHP Code:



var someVar = new Widget();

function Widget() {
    // Some variables, etc...
    this.int_someCommand = 0;
    // Activate the function on instantiation
    this.someCommand();
};

Widget.prototype.someCommand = function() {
    clearInterval(this.int_someCommand);
    this.int_someCommand = setInterval(this, 'someCommandLoop', 50);
};
Widget.prototype.someCommandLoop = function() {
    trace("THIS IS A WIDGET LOOP!");
}; 




...now, I was always under the impression that if you delete an object in Flash, the setInterval loops associated with it would die as well. But when I try to:


PHP Code:



// At some other point in my timeline...
delete someVar; 




or:


PHP Code:



someVar = new Object(); 




...the original loop is still running (I can tell just by reading the trace). How do I go about properly terminating a setInterval loop inside an Object without having to call a clearInterval()? Or is a clearInterval() the only way?

Thanks.

View Replies !    View Related
Tween Class, Does It Use Setinterval? Getting Strange Setinterval Type Problem
I have a gallery with small thumbnails. Upon clicking a thumbnail, I am using the Tween class to pull clips from an array and fade them between each other, loading the clips into a container.

When I click the thumbnail it loads the .swf fine and plays the Tween Class animation just as it's supposed to, however if I click any other thumbnail and go back to that first one the timing gets totally screwed up and the fades get jittery and overlap each other, much like it does with setInterval if you don't clear the intervals.

Is there a way to clear the Tween Class? Does it's timer run on setInterval?


This is the code I am using for the tween class


Thanks!


Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;

//content movieclips put into an array
var mcArray:Array = new Array(content1, content2);
for (var k in mcArray) {
mcArray[k]._alpha = 0;
}

// tween class has something called "OnEnterFrameBeacon" and it is added to the stage
// when we import the as file, so I wanted to get rid of it.
var n:Number = 0;

function playFades() {
if (n<mcArray.length) {
var tween_handler1:Object = new Tween(mcArray[n], "_alpha", Strong.easeIn, 0, 100, 1, true);
tween_handler1.onMotionFinished = function() {
//trace("motion finished by "+mcArray[n]);
//n++;
var tween_handler2:Object = new Tween(mcArray[n], "_alpha", Strong.easeIn, 100, 0, 3.5, true);
tween_handler2.onMotionFinished = function() {
//trace("motion finished by "+mcArray[n]);
n++;
playFades();
};
};
} else {
n = 0;
playFades();
}
}
playFades();

View Replies !    View Related
SetInterval Help
I'm not really sure how to go about using this, I'm terrible with actionscript.

I have a button that needs to have a delayed response, half a second to be specific, and then it needs to bring the user to a different scene. Is that easy to do or no? All I want is the user to click the button, it waits, then goes to a different scene...

Thank you, I'm lost!

View Replies !    View Related
SetInterval()
I am having a small problem with setInterval() -- I can't seem to make it update a var outside the callback?

var arg = 0;
function mySetTest(arg) {
arg++;
trace("arg = " + arg);
}
setInterval(mySetTest, 1000, arg);

tx!

View Replies !    View Related
SetInterval?
I have a slideshow, that loads a jpg and txt file randomly. Now instead of adding a huge number of frames to get time between slides, how do I use the setInterval command to wait, say 10 seconds, before executing the script again?

Thanks

View Replies !    View Related
SetInterval() - BUG
hi,
in the MovieClip:
this.kup=setInterval(function(){ trace("lup") },100);

i attach this movieclip onto stage:
when i removeMovieClip() this movieclip the setInterval function of this movieclip still wokrs..normally when we remove a clip all it's stuff inside it removes. But wht not in this casse with setInterval ?
is it a bug or there is sthg i passed.

View Replies !    View Related
SetInterval
i've read the sticky thread about setInterval and the answer to my questions weren't in there.

question1: is there a way to stop the interval with an action and then start the interval back up again where it left off?

question 2: once an interval is finished, is it possible to start it again?

thanks!

View Replies !    View Related
SetInterval Help
This is a two part question.

first i want to delay the loop on a movie that I have made. So when the movie reaches the end it delays for 2 min. then replays. Someone suggested using setInterval, since I don't know the first thing about actionscript, how it works, syntax anything I am having trouble getting it to work...I don't even know where to start with this.

I am also wondering if I could use this setInterval in the middle of my movie, instead of lengthening a static frame to get a delay.

I assume I would need to have the action call a function (although I am not sure what that really means, it sounds right) to continue playing the movie after the delay....I have seen stuff about using clearInterval so the action does not repeat, How does that work...I wonder if that would apply to my useage of this action?

If somebody wouldn't mine taking sometime and helping me through so I can understand what I need to do and whats going on that would be great. I catch on pretty quick, I just don't have any base as to what action scripting relates to.

Just a note: I have read through the setInterval tutorial in the actionscripting section, twice, over my head...:-(

View Replies !    View Related
SetInterval() Woe...
OK, in doing my own research on setInterval(), I used another board's setInterval() thread to come up with:
Code:
MovieClip.prototype.moveBox = function (){
this._y=this._y+1;
if (this._y = 300){
clearInterval (intID);
}
updateAfterEvent();
}
MovieClip.prototype.moveInterval = function (){
intID= setInterval(this.moveBox, 60,box);
}

intID;
_root.createEmptyMovieClip("box",10)
box.beginFill(0xcc0000,20)
box.moveTo(0,0);
box.lineTo(400,0);
box.lineTo(400,40);
box.lineTo(0,40);
box.lineTo(0,0);

_root.onLoad=function(){
box.moveInterval()
}

A box shows up, but it won't move. The following AS *does* move the box, but for the life 'o me, I can't create/duplicate copies and have them each move.
Code:
_root.createEmptyMovieClip("box",10)
box.beginFill(0xcc0000,20)
box.moveTo(0,0);
box.lineTo(400,0);
box.lineTo(400,40);
box.lineTo(0,40);
box.lineTo(0,0);
_root.onLoad=function(){
intID=setInterval(moveBox,60,box);
}
moveBox=function(clip){
clip._y++;
if(clip._y>300){
clearInterval(intID);
}
updateAfterEvent();
}


The closest I've come is have all the copies stack up on each other but with no movement. I've tried sooo many different variations on the setInterval() theme over the last day and a half - everything from assigning copies of the clip to an array, doing an Object assignment in order to specify a method using function-scope, to the above prototype method, I'm giving up the ghost and CRYING for help! I just wanna create multiple instances of a clip at a given rate, and then move each of them at another rate. So close, but I just couldn't make it happen. Any suggestions would be HUGELY appreciated!

View Replies !    View Related
SetInterval
Hey, I'm using the setInterval to keep calling a function if a variable is blank ... but it messes up when it reaches a certin number (I set a up a var it increment by 1)

here is the main piece code

getBal = setInterval(splitSerbal, 100);

/**** Gets the Balance and Serial Number for the game ****/
function splitSerbal() {
// Makes sure that the balance and serial are parsed once
// Gets the serial and balance seperate
if (serbalreturn == null || serbelreturn == "") {
a++;
trace(a);
getBal = setInterval(splitSerbal, 100);
} else {

do you have any clue why setInterval would mess up

if you want to see for your self make a new file and place that code in it.


thanks

- S

View Replies !    View Related
Should I Use SetInterval?
I have this little bit of script that will create 5 buttons. They all appear at once, but I would like them to appear one right after another. How would I do this? Would I use setInterval? If so, could someone show me how that would work?

Code:
for (h=1; h<=5; h++) {
_root.attachMovie("BtnMC", "Btn"+h, h+1000);
with (eval("Btn"+h)) {
_x = h*20-10;
_y = 240;
}
}

View Replies !    View Related
SetInterval
Hello
Please help... What should I fix in this script to make the circles appear one by one with particular interval of time?

View Replies !    View Related
Using SetInterval
ok. i have the following code in the main timeline:

PHP Code:




MovieClip.prototype.fades = function() {
         //continuing code
};






then, in a MC that was loaded using attachMovie, i have this:

PHP Code:




onEnterFrame = function () {
    this.fades();
    contents.drag.enabled = this.enable;
    contents.closer.enabled = this.enable;
};







When trying to replace the onEnterFrame with a setInterval i cannot get the function to work. any ideas?

View Replies !    View Related
SetInterval And Mc's
Hiya

OK .... I must be having a "dumb-day", but I've read all there is to read on setInterval and I'm still having trouble.

I have a clip on the main timeline that I want to play every 10 seconds. I placed the following code on the last frame of the clip :

stop();
setInterval( function() {gotoAndPlay(1);}, 10000);

Works great for about 5 minutes and then starts to glitch. Anyone know what I am doing wrong?

Thanks in advance
Mick

View Replies !    View Related
SetInterval How, What And Where.....
Hi All,

What is wrong with this code? The dame thing doesn't work. The setInterval timer isnt starting and / or it isnt calling the function.


Code:
function(refreshchat) {
this.xmlcnmsg.trigger()
}

setInterval( refreshchat , 6000 );

Cheers

Carl

View Replies !    View Related
SetInterval
Why doesn't this work?

Code:
function swfWait5() {
loadMovie("finalnews.swf", "_root.mc");
clearInterval(SW6);
}
SW6 = setInterval(swfWait2, 2000);

View Replies !    View Related
SetInterval With Xml. . . Is This Possible?
I need a little assistance in creating a setInterval function based on my xml file. If anyone could help, I would really appreciate it!

Here's a sample of xml file:
<count id="1">
<mediatype>1</mediatype>
<information>Introduction</information>
<endtime>12</endtime>
</count>
<count id="2">
<mediatype>2</mediatype>
<information>Clip 2</information>
<endtime>50</endtime>
</count>
<count id="3">
<mediatype>3</mediatype>
<information>Clip 3</information>
<endtime>150</endtime>
</count>

This is a sample of my actionscript:

Code:
myInterval = setInterval(beginFadeOut, time());

function beginFadeOut() {
clearInterval(myInterval);
mc.fadeIn(100, 7);
}
function time() {
sec = ((10/5)*1000);
trace("seconds called");
return sec;
}
eg.
sec = parent.childNodes[i].firstChild;

So, the value would be put in an array. I have tried several things, and have tried to ask the form, but no response.
If I need to post the .fla just let me know. Any assistance would be great!

Thanks,
cbs

View Replies !    View Related
Setinterval
TO WHOM IT MAY CONCERN:

My objective is to attain a algorithm similar to setinterval that can
be employed with flash 5.



Please respond


Kevin

View Replies !    View Related
SetInterval
Hi,

basically I'm trying to create a grid of thumbnails.

I'm using to functions:

function 1. loops through an array of pictures and finds the necessary params for it(ie xpos, ypos, ect...)

function 2. creates that thumbnail.

--------------
What I want to do is have them appear one by one not at the same time, but I don't want a timeline loop, so here's what I got up to now
--------------

/*create the clip to hold the grid on level1*/
_root.createEmptyMovieClip("grid", 1);
_root[grid]._x = 20;
_root[grid]._y = 100;

/*initializing my vars to create grid*/
rows = 5;
cols = 7;
xpos = 0;
ypos = 0;

/*this is the function I want to call every 2 seconds*/
function createThumb(item, type, xpos, ypos, targ) {
trace("xpos:"+xpos+" ypos:"+ypos);
}

/*here I loop through my Array of pics and call the above function*/
for (i=1; i<=pAr.length; i++) {
(i%cols == 0) ? xpos=(cols-1)*100 : xpos=((i%cols)-1)*100;
(i%cols == 1 && i != 1) ? ypos=ypos+72 : ypos=ypos;
interv = setInterval(createThumb, 1000, "test", "test", xpos, ypos, "test");
/*clearInterval(interv);*/
}
---------------

Notice my commented clearIntervals, I though this would work but it's clears the interval before calling the function.

Any Help to figure this out would be muchly appreciated.

Thanks

Dan

View Replies !    View Related
SetInterval Bug?
Hey,

I've got some weird problems when using setInterval. Look at the folowing two codes and try them:
code:
//--Works as it should be---
var test = "Test failed";
var nr = 1;
var text1 = "Test completed";
function newMap() {
test = this["text"+nr];
trace(test);
}
newMap();

code:
//--Does't work, 'test' totaly looses it's value---
var test = "Test failed";
var nr = 1;
var text1 = "Test completed";
function newMap() {
test = this["text"+nr];
trace(test);
clearInterval(itv);
}
itv = setInterval(newMap, 120);


What causes this? What can I do to fix it?

Thnx a lot,
SaphuA

View Replies !    View Related
SetInterval Help
See if I can describe whats happening here. Im getting some strange results.

I have used setInterval before with no problems whatsoever, untill now.
I have my main movie that loads external swf's into an emptyclip.
In one of those external swf's I have another emptyclip that loads other external swf's. In those swf's are MC's that have pictures in them that scroll from left to right. When the picture gets in the middle is where I use this setInterval script.
code:
stop();
function stopClip() {
clearInterval(interval);
play();
}
interval = setInterval(stopClip, 400)


When I try to load another swf with other pics, it all goes to wack. The picture MC's duplicate and I get pictures flying everywhere.
If I take out the setInterval script, it play fine, but I need it to stop for 3 seconds. Any other way to get the MC to stop for 3 seconds?

View Replies !    View Related
SetInterval
This is a great function to use. However, I had some inconsistancies with timing. Should I set the intervel to a multiple of the framerate for best result? I was pubishing at 12 frames per second and using an interval time of 83 miliseconds

bjornolafson@hotmail.com
bjornolafson@hotmail.com

View Replies !    View Related
Use Of SetInterval().
I need to have a function that reads a text file or database every 30 seconds say.

The system I am developing needs to be running indefinitely - i.e. 10 hours+ at a time.

Is it OK for me to use the function setInterval()?

I'm just worried that inadvertantly I might chew up processor resources?

The reason why I'm concerned is because there also exists clearInterval(). I just thought there must be a good reason to have this other function.

Should I be doing what I want to do using another method?

Any feedback/help would be appreciated.

Thanks.


OM

View Replies !    View Related
Where It's At? (setInterval)
I wrote this code

ActionScript:

_root.izmjena = setInterval(promjena, 2000);
function promjena() {
trace(this);
trace(_parent);
}




but when i traced to locate where is this setInterval it says "undefined".
so where it's at?

Problem is when i try to access some MC from this function called in setInterval, it doesn't work although that same MC is in root. So where is that setInterval located?

View Replies !    View Related
SetInterval....please Help
Okay i've read through almost all posts on setIntervals and still can't work out how to do what i need.

I have a main menu of 4 buttons that access a content movieclip with all my content in. One of these have a music page that has images changing within a movie clip every 25 seconds using setIntervals. These images are to run constantly until the user choses another menu option this is working fine. I then want to clearInterval(timer) once a new choice is made. Currently the timer just keeps running and resets the site.

I understand what needs to be done but don't know how to access the setInterval code i have within 2 movieclips. as far as i can see i need to clear the setInterval via the menu buttons.....and *u** knows how.

I usually have patience to work these bits out but, im a wee short of time on this one and have to get this finished.

I've tried to attach my fla but its to big for forum even after compression (4.2mb). if anyone can help will mail the file.

Thanks a bundle for any help, my sanity is thread bare....not helped by too much coffee due to desperation, so thanks

View Replies !    View Related
Setinterval, But How?
i got a simple movie using property. but i dont know how to use the setinterval action to only take speed influence on the movement of mc vozi

thats the main script:


startx = GetProperty(/:vozi,_x) ;
starty = GetProperty(/:vozi,_y) ;
horizontalno = /:targetx-startx;
vertikalno = /:targety-starty;
setProperty(/:vozi, _x, startx+(horizontalno/2));
setProperty(/:vozi, _y, starty+(vertikalno/2));




thtas on the buttons:


on (release) {
targetx = 195;
targety = 139;
}


thanks for any help...

setinterval but how?

View Replies !    View Related
How To Use Setinterval
check my fla
i have one movie clip which i want to play on click of a button after 1 second. i know it can be done using setinterval, but i dont know how to use it

View Replies !    View Related
SetInterval
I need to have an animation play every 30 seconds(example). I tried this but it did not work. The animation started playing but then it kept on playing.


Code:
setInterval(function () {
ball.gotoAndPlay(1);
}, 30000);


Where did I go wrong?
Thanks

View Replies !    View Related
SetInterval...not Quite Getting It
Just playing around, trying to understand setInterval. i can get my image to increase/decrease alpha, but it only works 2 times...then it is stuck at lower alpha....what am i missing?

Code:
mcFrame.createEmptyMovieClip("mcBox", this.getNextHighestDepth());
var mclLoader:MovieClipLoader = new MovieClipLoader();
var oImageListener:Object = new Object();
oImageListener.onLoadInit = function(mcContent:MovieClip) {
//size of photo in frame
mcContent._xscale = 10;
mcContent._yscale = 10;
//location in frame
mcContent._x = (mcFrame.mcBox._x+5);
mcContent._y = (mcFrame.mcBox._y+5);
//alpha of photo
mcPict._alpha = 60;

mcPict.onRollOver = function() {
var nAlpha:Number=setInterval(increaseAlpha,5,mcPict);
clearInterval(nLessAlpha);
updateAfterEvent();
};
mcPict.onRollOut=function():Void{
clearInterval(nAlpha);
var nLessAlpha:Number=setInterval(lessAlpha,5,mcPict);
updateAfterEvent();
}
//size of frame
mcFrame._width= mcPict._width;
mcFrame._height=mcPict._height;
};
mclLoader.loadClip("edelweiss.jpg", mcFrame.mcBox);
mclLoader.addListener(oImageListener);


//var and functions to call in code
var mcPict:MovieClip = mcFrame.mcBox;
function increaseAlpha(arg) {
if (arg._alpha<100) {
arg._alpha++;
}
}
function lessAlpha(arg){
if(arg._alpha>60){
arg._alpha--;
}
if(arg._alpha==60){
clearInterval(nLessAlpha);
}

}

View Replies !    View Related
AS 2 + SetInterval()
In Actionscript 2 I cannot access global class variables in a method being executed by setInterval(). The variable can be accessed in other methods fine. The workaround is to pass the variable in as a parameter on the setInterval() function, but it seems I should be able to access it without doing that. Here is an example of what I am running in to:


Code:
class Food {
private var drink:String = "Pepsi";
private var interval:Number;
// Constructor
public function Food() {
getDrink();
interval = setInterval(allDrinks, 500);
}
private function getDrink() {
// Returns "Pepsi"
trace(drink);
}
private function allDrinks() {
// Returns "undefined" instead of "Pepsi"
trace(drink);
}
}
I'd also like to note that I am using Flash player 8. Any help would be appreciated!

View Replies !    View Related
Using SetInterval
if I have a function like this:

selectItem = function(bname:String){

///Code

}

How can I use setInterval to change the value of 'banme'?

View Replies !    View Related
SetInterval Help
Hey everyone,
I have a question in relation to the setInterval function. I have a movie on level0 that loads in a movie on level1. Level1 has a short animation playing using the setInterval function that fades in movie clips. The problem that I get when doing this is the setInterval animation speeds up every time you load it in. I don’t understand why this is happening. I was under the knowledge that if you load then unload a movie it’s variables are reset?

Here is my script that sits on level1 (the loaded in movie). I have attached a file if you don’t understand.


Code:
var boxCount:Number = 5;

var countVar:Number = 0;
var extraCount:Number = 0;
var total:Number = 100;
var idCount:Number= 0;

for(var i:Number = 1; i<=_root.boxCount; i++) {
var prevNum:Number = i - 1;
attachMovie("myBox_mc", "myBox"+i, i);
_root["myBox"+i]._y = 125;
_root["myBox"+i]._alpha = 0;
if(i <= 1) {
_root["myBox"+i]._x = 130;
} else {
_root["myBox"+i]._x = _root["myBox"+prevNum]._x + 60;
}
}

var intervalID:Number = setInterval(mycallback1, 0.1);
intervalID;

function mycallback1() {
if(_root.extraCount != 1) {
_root.extraCount = 1;
}// else {
//_root.navigation_mc[_root.furnitureNavigation[+idCount]]._y = -20;
//}
if (_root.countVar >= _root.total) {
_root.countVar = 0;
idCount++
_root.extraCount = 0;
} else {
countVar = countVar + 5;
trace(countVar)
_root["myBox"+idCount]._alpha = _root.countVar;
}
if (idCount == _root.boxCount) {
_root.extraCount = 1;
clearInterval(newintervalID);
}
};


Thanks,
Dan.

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved