ActionScript 3.0 :: Use ClearInterval(b) Under Certain Conditions To Stop Each Interval?

Jul 3, 2010

I am using setInterval to call a function which itself creates intervals to call a second function..My issue is with the second interval in function1 'var b'. I am trying to use clearInterval(b) under certain conditions to stop each interval. This works when I have a 'single' interval created (i.e function 1 is only called once) but as soon as it is called more than once, I get errors.simple eg below

Code:
var b:uint;
var a = setInterval(function1, 1000);[code]....

I actually solved this by creating a 'counter variable' which is passed to function2, and just used clearInterval(counter), counter++; to clear each interval.My issue with this solution is having to keep track of what number interval im up to 'manually'.. and if i create more intervals later on Im worried about 'loosing count' and having to keep track.. and would rather reference the var name itself if possible?

I've tried to compare my counter var to the value of the interval via a trace, and they appear to be the same. So I dont understand why clear(a) and clear(counter) dont give me equivalent results.

View 3 Replies


Similar Posts:


ActionScript 2.0 :: Does ClearInterval Not Work When Called Inside A SetInterval / Why Does ClearInterval Not Stop The Interval

Mar 25, 2004

I'm having an issue with setInterval/clearInterval when it comes to dealing with objects. Take this example:

[Code]...

Why does clearInterval not stop the interval? Does clearInterval not work when called inside a setInterval? Am I doing something wrong? How do I get it to delete the interval when it reaches a certain count?

View 3 Replies

Actionscript 3.0 :: Way To Stop An Interval

Oct 7, 2009

How do you stop an interval after you set it?

View 5 Replies

ActionScript 2.0 :: Interval Won't Stop - Looping

Jun 3, 2008

this SHOULD stop. the end conditions certainly fire... but it just keeps on looping like some mad...thing! i attached the FLA and the TXT it needs to work it's madness.

View 13 Replies

Stop Interval Function By Clicking Button?

Mar 26, 2009

I have a simple movice clip, 72 frames. On Frame 42 I have this actionscript

//----------------------------------
function wait2() {
stop();

[Code]....

and a few other "possible" solutions I found on the web....but nothing works. If I click the damn button...

View 2 Replies

ActionScript 2.0 :: Interval Does Not Stop When The Low Button Text Shows Low?

Mar 18, 2011

I have a problem with a clear interval command that only half works,when i select the the high button the interval clears but when i reset the high button the interval starts again,also the interval does not stop when the low button text shows low.I get the trace action but no clear interval.

Code:
auxcont=function(){
if(high_txt.text=="reset"){
clearInterval(myInterval);[code]....

on low system circulates between pump on and off.on high system is in high mode .

View 3 Replies

Actionscript 3.0 :: Use An Interval Function To Make The Movie Stop In?

Apr 29, 2009

In AS2 I use an interval function to make the movie stop in a specific frame for x second and they play again Example:I add this code on a specific frame 1:

var count:Number = 0;
var maxCount:Number = 35;
useHandCursor = false;

[code].....

View 1 Replies

ActionScript 2.0 :: Stop Interval When Object Alpha Larger Than 100

Oct 9, 2006

I have an interval problem.
Code:
//function for fading in objects
function fadeIn(theMc:MovieClip, fadeParam:Number) {
if (theMc._alpha < 100) {
theMc._alpha += fadeParam;
trace(theMc._alpha);
[Code] .....
I made a small function for fading in objects. Once the object its alpha is larger then 100, it should stop that interval, but it doesn't.

View 2 Replies

ActionScript 2.0 :: ClearInterval() Not Working?

Jun 20, 2009

Code:
var STextOnce = 0;
var CurrentLapentum = 0;
var LockOnce = 0;[code].........

For some reason, the clearInterval(SpinnerInterval); is not working and when I call it, the ring still keeps spinning :

View 8 Replies

ActionScript 2.0 :: ClearInterval Not Clearing?

Jul 8, 2005

here is my problem. I have a slideshow that I wish to pause when I rollOver a button, and to resume when I rollOut.

here is the the interval part of the code:
var ssInt = new Number();
ssInt = 100;

[code].....

View 5 Replies

ActionScript 2.0 :: Cannot ClearInterval In Class

Sep 2, 2006

I have just started working with classes and am having trouble using setInterval/clearInterval in the class. I am sure my scoping is incorrect but I am not sure how to fix it. My problem (simplified) is below:[code]Bascially, how do I set up my interval so that when "myFunc2" is called, loopImage is not undefined and it is able to clear the interval.

View 5 Replies

ActionScript 2.0 :: ClearInterval Across Different Movieclips

Jun 20, 2007

basically, sayd I have two movieclips, how can I use one to clear and interval in the other? I have tried using:

[Code]...

View 4 Replies

ActionScript 2.0 :: ClearInterval Not Working?

May 14, 2005

I use an interval to verify when someone scales the browser when tweening, afterwards it shows correctly.The problem is that sometimes the clearInterval doesn't work It always happens after a while when I click next or prev too fast Also bothering is just before the bug, the image scales to very small (sometimes)

Code:

function sizeInterval2 ()
{
loaderback._width = containerMC._width + 10
loaderback._height = containerMC._height + 10

[code]....

View 3 Replies

ActionScript 2.0 :: ClearInterval That Was Set Inside A Movieclip?

Jun 19, 2009

I have a movieclip where I have lots of code, because its kind of a module. Inside it have have some AS2 code inside a movieclip called "mymodule"

Code:
var myinterval;
some_movieclip.onRelease = function(){

[code]......

View 1 Replies

ActionScript 2.0 :: ClearInterval() Doesn't Clear Anything?

Mar 24, 2005

can any of you point out if this code is wrong or do I have a bug in my Flash? It's sopposed to be a simple move function, called by an interval, and after reaching the border of the film, it's sopposed to stop. pretty simple, right? right, but theHere's the code I've used: (mcBall = 1 framed movieClip)

_root.onEnterFrame = function()
{
function fMoveIt():Void

[code].....

View 3 Replies

ActionScript 2.0 :: ClearInterval() Function Isn't Working ?

Dec 26, 2005

I just created an image gallery that displays 3 images at a time. For some reason, it works (for the most part) in Opera, but it doesn't display the images properly in IE.

img1, img2,and img3 are blank movie clips that hold each of the photos. The links to the photos are retrieved from XML, and are displayed in a random order. The first picture shows how it looks in IE, and the 2nd is in Opera. It also seems that the clearInterval() function isn't working like it should. Once the pictures are loaded, they are resized using the resizeMe() function (called by setInterval) to fit in the rectangle.

IE: Opera:

Code:
img1._alpha = 0;
img2._alpha = 0;[code].....

View 9 Replies

ActionScript 2.0 :: Cannot Get The ClearInterval Command To Work

May 25, 2009

I cannot get the clearInterval command to work. I have a panel that is tweening down into the stage about 4 seconds after the movie loads and then I do not want it to happen again. Right now the panel continues to tween in everytime I close it. Right now, the clearInterval is not working.

var down:Boolean;
var currentInterval:Number;
down=false;

[Code].....

View 1 Replies

ActionScript 2.0 :: Using ClearInterval() And External Swfs?

May 11, 2005

I have a project that requires around 20 external swfs. All of these swfs get called into a _root via XML. Each swf (contains a video swf and some graphics/text) has a progress bar and a playhead that is monitored by using a setInterval(). Once the progress bar is complete, the interval gets cleared.

However, if a user wants to watch a new video before the progress bar gets cleared, the video swf won't load, although all the text and static graphics that are in the swf file will. I think it may be an issue of the interval not clearing, because if the progress bar is completely downloaded and then a new swf is chosen, the video swf loads fine. Can I use clearInterval() from the _root of my movie to clear the setInterval from my external swf?

PS -- I tried to solve this issue by using removeMovieClip() in my _root, and that worked really well on everything but IE 5.2 for Mac?

View 2 Replies

ActionScript 2.0 :: SetInterval/clearInterval Functions In A Cleaner Way?

Aug 18, 2007

i was wondering if someone could pls help me to code the setInterval/clearInterval functions in a cleaner way?

[AS]
var timer:Number;
obj = new Object();
RHArrow.onRelease = function(){

[Code]...

View 1 Replies

ActionScript 2.0 :: Why The Inclusion Of The Word New Causes The ClearInterval Not To Work?

Jun 6, 2009

I typed the following code two ways... one has the word "new" and one doesnt... the one with the word "new" completely ignores the clearInterval() call... however when the code is run without the word "new" it behaves as I expected- with the interval terminating in the first call of the function. why the inclusion of the word new causes the clearInterval not to work?

myInterval = new setInterval(myFunction,100);
function myFunction(){
trace("hello");
clearInterval(myInterval);
}

View 5 Replies

ActionScript 2.0 :: XML Slideshow Photo Gallery SetInterval / ClearInterval

Dec 27, 2005

I'm using a version of XML Slideshow Photogallery that loads slideshow.swf (and other pages) into master.swf. It plays good the first time through and when I trace myInterval, I can see it increment 1,2,3 ... with each slide. When I go to another page and then come back to the slideshow - the myInterval will skip a couple or I get 2 values at the same time. This causes the slideshow to display every other image (or every 3, etc). I can see that the problem is from not clearing the myInterval variable properly. The clearInterval(myInterval); function seems to just clear the last instance created. Is there a way to clear all instances?

View 14 Replies

ActionScript 2.0 :: Focus Question On The SetInterval And ClearInterval Use Inside A Class

Jul 13, 2006

I would like to focus my question on the setInterval and clearInterval use inside a class.
isn't bellow the right way to use it ?

[Code]...

View 2 Replies

ActionScript 2.0 :: ClearInterval - Loading / Unloading External Swfs Into A Container Movie

Jul 9, 2005

when loading/unloading external swfs into a container movie,i`ve noticed that any intervals (within the loaded files)i`ve used are not being cleared despite the movie being unloaded causing errors when the same swf is reloaded. Without manually clearing all intervals is there a way round this?

View 1 Replies

ActionScript 2.0 :: How To Add More Conditions To A If Then

Jul 21, 2004

Ok here is the problem... I have this code:

[AS]
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {

[code]......

View 2 Replies

3 MovieClips - Using IF Function With Two Conditions

Feb 2, 2011

I ve used next script:
onClipEvent (load) {
if((_root. mc1._visible=true) and (_root.mc2=true)) {
_root.mc3._visible=true;
}else{
_root.mc3._visible=false;
}}

To achieve next: mc3 is visible only when mc1 and mc2 are visible else its hidden, but this dont work, with this script on load all clips are visible on stage mc1, mc2, mc3, inspite there is a script which is hiding mc1, and mc2...(they should appear on stage on mouse event and this was ok before a inserted script from beginning of post, now they are always visible). How should I write this to make mc3 visible only when mc1 and mc2 are both visible on stage.

View 2 Replies

Xml :: Descendants With Multiples Conditions?

Apr 21, 2011

Example of my XML list:

<listnode>
<nodeA id="1">
<nodeB id="1" />

[code]......

View 2 Replies

ActionScript 2.0 :: If Statement With Two Conditions?

Sep 26, 2006

if(description_1 = "HELLO" && date_1 = 1981){
do Crap()
}else{

[code]......

View 4 Replies

ActionScript 2.0 :: What's Format For Having 2 Conditions

Aug 5, 2003

whats the format for having 2 conditions???[code]

View 4 Replies

ActionScript 3.0 :: Difficulties Using Conditions With XML?

Jul 3, 2011

I'm having some difficulties using conditions with XML and AS3.

Having something like this in my XML:

Code:
<?xml version="1.0"?>
<schedule>
<class>
<name day="monday">AAA</name>

[Code]...

View 4 Replies

ActionScript 2.0 :: Flash8 If Statement - More Than 1 Conditions

Mar 13, 2009

Is there a way to have more conditions in an "if" statement? For example I have 3 conditions:

condition 1: a=5
condition 2: b=3
condition 3: c=12

So, if a=5, b=3 and c=12, I want to trace("success") for example. But it's necessary that all 3 conditions are executed. How can I do that?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved