ActionScript 2.0 :: Clearing SetInterval From A Different Function?

Jun 25, 2006

how to clear the interval in this code? I'd also like to know if there is a better way of firing makeStars() than using setInterval in a function - like I'm doing. I've looked at the Kirupa tutorial and I'm not seeing what should be done.

Basically, this attaches a number of stars within the Stage width and height properties. When the browser resizes I rewrite the stars to the screen with the new bounds. But I can't get the interval to stop, so the stars just keep getting replaced - disappearing and relocating abruptly.

It all works great outside of the resizeIt() function, but once inside she goes down hill from there. A couple of things I need cleared up (pun intended) are:

1. Am I creating a new interval each time resizeIt() is executed?

2.What is the scope of the interval(s), and does how you access them change depending on where you are in the code, or are they more global?

stop();
//number of stars to make
var numstars:Number = 100;
_root.attachMovie("background","bkgd",this.getNext HighestDepth());

[Code].....

View 4 Replies


Similar Posts:


ActionScript 2.0 :: SetInterval Function And Counter Var Not Clearing?

Oct 16, 2007

i'm reusing a function as a timer with setInterval. it works the first time around but then for some reason the counter var gets stuck at 10 (the delay var = 10) and won't reset and start counting up from zero again...code:

Code:
_global.count=0;
startTimer1=function(){

[code].....

View 5 Replies

ActionScript 2.0 :: Clearing A Setinterval With Button Press

Jul 20, 2010

I have a parent movie (AS2.0) calling a series of child swfs into an empty movie container/mask. I have a navbar with a home button, playall, play, pause buttons. The problem I have is that on my navbar the "play all" button that just tells the main timeline to gotoAndPlay a series of frames at the end of the main timeline that each have a "wait" function in them after they load an external swf before going to the next.

[Code]...

View 9 Replies

ActionScript 2.0 :: Clearing The SetInterval Everytime Change The Element In The Combo Box?

Apr 6, 2006

Right now I'm in the process of building a drum machine in Flash. The interface is based off of combo boxes and data that I load into the combo boxes. Depending on what you choose in the combo box, a sound should play at a certain interval. I have that part working perfectly. When you click the element of the combo box, the sound plays, and my set interval function calls.

Now the problem I am having is actually clearing the setInterval everytime you change the element in the combo box. I am using a listener set up to find when the combo box changes, I know it has something to do with when I clear the interval, but for the life of me I can't figure out how to clear it when the listener is called.

Here is the listener function I am using to call setInterval:

[Code]...

outside of the listener, and then took away the 'var', from in front of dbInt1 = setInterval..... and it works perfectly. It seems like a really weird way to do that though, and doesn't seem like it would be in good coding practice to do that.

View 2 Replies

ActionScript 2.0 :: Clearing A Function?

May 12, 2004

I set a function for

this.onEnterFrame = function(){
code;
}

[code]....

View 4 Replies

ActionScript 2.0 :: Possible To Clearing A Function?

May 12, 2004

I set a function for

this.onEnterFrame = function(){
code;
}

but later I want this onEnterFrame to stop functioning to conserve on processor resources.setInterval isn't too good of an option from the way I have things set up, so right now I just set it to a new function with a trace action which overwrites the old one.

View 4 Replies

ActionScript 2.0 :: Print Function, Clearing Variables?

Oct 2, 2009

I'm using this code

Code:
on (click) {
var x = 1;
print(x,"bmovie");
}

To print out the current page as displayed on the screen. The command works great, but when the button is pressed all of my variables seem to be reset, along with various combo boxes.The print function works as intended except clearing all my values .Is there a way around this?

Edit: I just ran a small test on a blank .fla with 3 buttons 1 - set variable = 1, 2 - trace variable, 3 - my print code

This does not clear the variables like it does in my application.What exactly goes on during the print function? If I can isolate and trace the problem, I could find a fix for it, but I have no idea whats going on.

View 1 Replies

ActionScript 2.0 :: OnFocus Function Is Clearing Variable?

Apr 3, 2007

osting to PHP - but decided to have an initial message in my textInput to instruct people to input their email address.But now that the onFocus function is telling the textInput it equals "" when clicked, it is posting the variable as "" instead of what the user has input!!How do I clear my textInput for the user but still post the user's info?The onFocus code is:

Code:
this.email_address.text = " your@email.com";
tiListener = new Object();

[code].....

View 2 Replies

ActionScript 3.0 :: Clearing Output Panel After A Function Is Completed?

Oct 16, 2009

Is it possible to clear the output panel after a function is completed?

View 7 Replies

Web Development :: Stop A SetInterval Function?

Nov 10, 2009

I have a function that I want to run at an interval within a frame. I use the following code to start the function:

var intervalID = setInterval(intervalFunction, 3000);

Then, in a button's onRelease I want to stop the function. In the onRelease, I make a transition to another frame.

btn.onRelease = function()
{
clearInterval(intervalID);
gotoAndPlay("nextframe");
}

The intervalFunction continues to execute.

View 2 Replies

ActionScript 2.0 :: Looping A SetInterval Function?

Nov 20, 2009

I'm creating a banner ad that tweens a thought bubble.It has 3 bubbles which tweens from the small bubble(1st one) to the big(3rd)one every 1/2 second with the setInterval function and then Invokes another setInterval which changes the text in the big bubble every 2sec. I got it to work perfectly, but the only problem is that I cant get it to loop through again properly. When I try to invoke the setInterval "animBubble" in the changeText function it doesnt read the clearInterval in the "animBubble" function causing it not to stop once the 3rd bubble has tweened in.

Here is my code:

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

[code]...

View 1 Replies

ActionScript 2.0 :: Cant Execute Function With SetInterval?

Mar 19, 2004

[AS]
_root.logo._alpha = 0; //S�tt alpha p� logon till 0
_root.meny._alpha = 0; //S�tt alpha p� menyn till 0
var donealpha:Boolean = false; //skapa en Boolean[code]......

The first two functions wont get executed.. I have tried to put trace("test") strait under the function ...(){ but it wont execute it..

View 4 Replies

ActionScript 2.0 :: Add A Setinterval Function To Slideshow?

Jun 16, 2004

I added a setinterval function to my slideshow.Prob is when the slideshow reaches the last pic it returns to pic1 goes to pic2,... but after the second loop it starts mixing the wrong pics for the wrong number.I guess I did a mistake in the if statement(if (nextSlideNode == null)...). can someone solve this for me.

See following code below. Also how can I stop this animation. I did something like learinterval(advance); but that did not do the trick.

[Code]...

View 7 Replies

ActionScript 2.0 :: Setinterval For A Loop Function?

Jun 16, 2005

Code:
_root.leftButton.onRelease = function() {
for(var i=0; i<6; i++){
animateThumbsToLeft(variable_1, variable2);
}
};

ok how and where do i put the setInterval script if i want to execute the "animateThumbsToLeft" function for 6 times and inbetween each time have a delay of say half a second..

View 1 Replies

ActionScript 2.0 :: SetInterval From Inside A Function?

Sep 7, 2006

If i have a setInterval inside a function, will it execute at the desired interval, even if i only call the containing function once?

View 5 Replies

ActionScript 2.0 :: SetInterval On Attachmovie Function With X And Y Loc?

Apr 28, 2008

I have a function on my script that attaches a movieclip on a specific position and then it duplicates it several times. This movieclip has a code in order to move across the stage randomly. When I try to use SetInterval to repeat this function two weird things happen: the movieclips don't duplicate over that specific location (they appear on x=0,y=0) and if I set the location only one duplicates and the rest don't. My question is: what can I do to repeat the function every 2 seconds exactly as it is the first time it runs, without the objects not duplicating or moving from the original location?

Here's the code:
meteoros = function () {
this.attachMovie("asteroid","asteroid_mc",this.get NextHighestDepth());

[code].....

View 2 Replies

ActionScript 2.0 :: Local Function / SetInterval?

Sep 3, 2003

Why is this not working? It just passes through the function instead of pausing. Source is attached:

View 10 Replies

ActionScript 2.0 :: Put A SetInterval Function In Front Of It?

Dec 22, 2003

I got this MC I load. How could I put a setInterval function in front of it?

Code:
onClipEvent (load) {
this._x = 100;

[Code]....

And what if I wanted to do this with several MC's in the same movie?

View 2 Replies

ActionScript 2.0 :: Cannot Execute Function With SetInterval

Mar 19, 2004

[AS]
_root.logo._alpha = 0; //Stt alpha p logon till 0
_root.meny._alpha = 0; //Stt alpha p menyn till 0
var donealpha:Boolean = false; //skapa en Boolean
var doneshrink:Boolean = false; //skapa en Boolean
var donemove:Boolean = false; //skapa en Boolean
[Code] .....

The first two functions wont get executed.. I have tried to put trace("test") strait under the function ...(){ but it wont execute it..

View 4 Replies

ActionScript 2.0 :: SetInterval MoveTo Function?

Apr 12, 2004

I have four buttons on the stage which I want to move 20 pixels up (easing) and fade in from 0 to 100. But I want them to appear with a interval of 1 second. I came up with the following function:

Code:
function showClips(yPos, alpha, speed) {
var endY = yPos - this._y;
this._y += eindY /speed;

[Code]...

View 3 Replies

ActionScript 3.0 :: Re-setInterval Each Time Function Works?

Mar 19, 2012

I have a function that draws a rectangle on the screen (see createInfoPanel())While drawing rectangle, I am adding 2 text fields on it.But as you may guess, it is adding those immediately. I want to delay adding these text fields, then I want to remove these panels after a while. The problem is, when I set an interval or timer, they won't work after I using once (I had to stop them by clearing/removing, it didn't set them again).Since my panel is being created each time image changes, I need them to work every time image changes.
 
So, I have 2 questions:1- How can I re-set interval each time my createInfoPanel() function works? It won't work anymore after setting and claring once. 2- You can see infoPanel.addChild(titleField); line in addInfoPanel() function. How can I work a smooth animation here? I mean, text appears slowly?

[Code]....

View 4 Replies

ActionScript 2.0 :: Call Function Using SetInterval From Another Class?

Feb 4, 2009

I have a custom class called SpeedCheck, in this class I have a function called Activate(), I am trying to call this function using setInterval from another class but I am not sure how to format it.

This is how I would normally call the function:

ActionScript Code:
SpeedCheck.Activate()

I tried this:

ActionScript Code:
setInterval(SpeedCheck ,"Activate",100);

but it doesn't work, what am I doing wrong?

View 3 Replies

ActionScript 3.0 :: SetInterval Function Runs Very Slow In IE8

Sep 9, 2010

I am doing some animation using setInterval. It runs ok on all browser(firefox, sarfari, and opera..), but not in IE8. I just check ie7, it works fine also.

View 4 Replies

ActionScript 2.0 :: SetInterval For Multiple Clips In One Function?

Apr 7, 2011

My issue is that I want to set up a system whereby I can register clips to a class that will have certain properties set and then animate changes in those properties. Namely, each clip is placed at a different _y position at authoring time, then at run time be repositioned at a different _y position, only to be animated back to the original position. I want to do this so I can edit the clips in their destined places to layout their positioning.

Visually, my code works fine but, as is apparent from the "trace("muvUp "+thing);", the interval isn't being cleared. And what's worse � at around 40000 (of getTimer()), the clips start disappearing.

I've attached a file but here's the code I'm working with (as you can see with the lines I've commented out, i've tried a few different options):

//MY CLASS ON FRAME 1:
function wordsClass(){}
wordsClass.prototype = new MovieClip();
wordsClass.prototype.onLoad = function(){

[Code]....

View 9 Replies

Actionscript 3.0 :: Accessing SetInterval() ID Created Within A Function

Jan 7, 2009

I am creating a text scroller and am having problems with clearInterval - the text starts scrolling, but it won't stop after I try to clear it upon a button click.

1. I declare a var (uint) equal to a setInterval() call within a function (if the text exceeds the width of the textField)

2. I have a button that "turns off" the mp3 player (swf) and resets all the text fields.

3. I can't seem to access the setInterval ID var from within the click handler.

I have declared the var (uint) at the root level, then set it to setInterval() within the function. Then I tried to access it from the click handler. I thought this would work since it's global at that point, but it doesn't.

Here's a link to the page so you can see how it doesn't work [URL] (you have to click on the last link with the long client name)

Here's the code that's involved with this function (of course this is only the relevant code, but I would post the fla when done for anyone who wants to use it):

Code: Select all//::: SCROLL DISPLAY TEXT
function scrollDisplays():void
{
(trackTextField.textWidth > trackTextField.width) ?

[Code].....

View 8 Replies

ActionScript 2.0 :: SetInterval - Fade Out A Button Through A Function

Aug 19, 2004

OK, trying to fade out a button through a function. I've done this before but I'm tired and it's just not happening. OK, there's a button named "button" and a movieclip named "fadeThis". The first frame of the root has the following code in it:

[Code]...

View 8 Replies

ActionScript 2.0 :: Function Not Listening To SetInterval Array

Sep 23, 2005

I have a random array of times in milliseconds, of which I want a function to be called on. Problem is, it seems to be ignoring the times in the array, and instead using the number of items in the array as a guage of how fast it should call the function. Any pointers?

[Code]...

View 10 Replies

ActionScript 2.0 :: Simple Function And SetInterval Not Working?

Mar 21, 2006

i've tried searching the forums and fighting with this way of fading the movie clip in and out. The movie clip has an instance name of "box", my brother also can't figure it out.

Code:
var fadeChecker:Boolean = true;
function flicker():Void{
if(box._alpha >= 100){[code].....

View 5 Replies

ActionScript 2.0 :: Pass The SetInterval Id Number Into The Function?

Jul 5, 2006

is there anyway to pass the setInterval id number into the function you are wanting to run.

I want the function i run to run clearInterval when a certain test suceeds.

View 4 Replies

ActionScript 2.0 :: Pass Parameters To A Function From SetInterval?

Jan 28, 2008

Here is the code that doesn't work:

Code:
myInterval = setInverval(open(3), 1500);
function open(n) {
clearInterval(myInterval);
this["item"+n].play();
}

I have also tried calling a function from setInterval which in turn calls a function with a parameter...also didn't work!

View 1 Replies







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