ActionScript 2.0 :: Setinterval Called Too Quickly Makes It Stop Working?
Mar 22, 2006
I am having problems with this function, which is called when a button is pressed. I am loading a JPG with a movieClipLoader into a newly created movieclip, and while this is loading the other is still viewable and is faded and deleted when the new JPG has fully loaded, using the code below:
ActionScript Code:
function loadBigPicture(iValue:Number, firstTime:String):Void {
this.createEmptyMovieClip("myBigPicture"+iValue, this.getNextHighestDepth());
trace(_level0["myBigPicture"+iValue]);
[Code].....
If the button is pressed extremely quickly again and again, the intervals begin to stop working
View 3 Replies
Similar Posts:
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
Feb 28, 2008
I have a project where I'm removing code for bandwidth detection, but after I remove it, my code in the }else{ won't execute anymore like it did before. Not sure what I'm missing? Maybe a pair of curly braces somewhere? Here is before, and after bandwidth code removal:
stop();
images_xml = new XML();
images_xml.onLoad = startImageViewer;[code].....
View 2 Replies
Jan 23, 2004
on the attached fla I have an "invisible" button (button with 0 alpha). I copied a script from the tutes section that will allow me to open a new window when the button is clicked.This works OK, but I also have a MC below the button layer and this MC has some AS attached to it which basically makes it fade out to the image on the bottom layer.
It seems to me that the button script makes the MC script stop working because it's above the MC layer (I've switched the button layer below the MC layer and the fade out then works, but the button doesn't.How can I get both scripts working together? I know that MC's can't work like buttons, but is there a work around this?
View 6 Replies
Jun 12, 2009
I thought I had a handle on the timer class (even just a beginners understanding), but I'm having trouble with it.I have an event listener for the timer and it starts fine i get a delay, then a tween,but when I place a myTimer.stop();in the fuction the listener called (to stop it) it dosent stop.it will repeat placing the first image, and then call the first function again
......Wait its placing the first image in (a couple of lines before the start), so Its restarting the whole movie, not just the function?
myTimer.addEventListener(TimerEvent.TIMER, tweenone)
myTimer.start();
function tweenone (event:Event):void[code]...........
View 6 Replies
Dec 14, 2009
I have a function ("advance_slideshow()") that ticks a slide show up by one, then it loops back at the end. It works when called from the key listener I set up for debugging. However it does not work when called from setInterval. I added a trace to the function to confirm that it was being called, which it is; it just doesn't work when called via the interval
Code:
//////////////////////////
/* IMPORTS AND INCLUDES */
[code].......
View 1 Replies
Jun 28, 2010
I'm using setInterval and the issue is "how can i send data to function that are called from setInterval?". Now I have this: ActionScript Code: si = setInterval( startLoading(dir + "/" + f[i]) , t); If i send the function parameter in setInterval the function do all her job but the setInterval don't work. Wich are the best pratice to do this?
View 2 Replies
Sep 10, 2011
On a recent project I am working on, I created an event-based sound engine. Different components within Flex will be registered, and then the controller will listen to events and handle the information correctly. So, it just takes a custom SoundEvent or ChannelEvent to alter one of the channels, or play a sound.
I can not quite figure out what is wrong with my code, and I am finding myself snow-blind to the issue at hand. At first, I was going to rewrite it but I figured it would be better to learn from my mistake. Also, I realize that this is not correct for streaming sounds, but I am working off a local sound library until I get it up and running smoothly.
Here is the code for the SoundEvent:
package code.events
{
import flash.events.Event;
public class SoundEvent extends Event
[code]....
View 3 Replies
Nov 7, 2009
So this is my code so far:
on (press) { // Gives your movie a button functionsgetUrl("http://www.astahost.com");}
on (rollOver) {this._alpha=100;gotoAndPlay("Scene 2"); }
[Code]....
when i play the movie, it plays scene 2, however, scene 2, which is in my flash document, plays automatically. how can i stop this? is there some code which only makes scene 2 play when called for and not play automatically.
View 1 Replies
Nov 7, 2004
My goal is to change the time for setInterval each time the function is called. Planning to replace myInterval = 5000; with a randomized number. My problem is getting setInterval to recognize the myInterval variable from the function.
[Code]...
View 2 Replies
Jul 8, 2009
I use eventListeners to jump between frames.One of my frames displays a video. I imported the video as a component using the 'import video' function.It plays fine.When navigating away from the video I use the myVideo.stop(); command in AS3 to stop the video from continuing to play.or some reason, when I do this the buttons on my main page stop working.The code I use on the movie frame is:
cr_back_btn.addEventListener(MouseEvent.CLICK, onCRBackClick);
function onCRBackClick(e:MouseEvent):void
{
[code].....
View 5 Replies
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
Aug 26, 2004
I have a movie that goes through a spiel and I want to be able to stop it then hit play and have it continue. Easy enough IF the movie just goes straight through. But what mine does is pauses at certain places to make way for some spoken word (to be added later) using setInterval.My problem is (seems to be) if I hit my stop button while it's doing it's 1.5 second pause, then the stop button gets ignored. [URL]
View 5 Replies
Feb 24, 2006
How can i stop it from repeating??
var wait = function () {
//mystuff
}
var myTimer = setInterval(wait, 5000);
View 6 Replies
Jun 27, 2004
I use the letsMove function to move movieclips
MovieClip.prototype.letsMove = function(time, step, limit) {
countHundred = function (clip) {
clip._x += step;
updateAfterEvent();
[code]....
How can I use another setInterval function so, when the movieclip reaches the limit (in this case 100 pixels), it stops, waits for 1 second and starts the letsMove function again?
View 2 Replies
Jan 27, 2009
I have a flash 9 app that calls a php script that in turn pulls in some variables from txt files. The function within the flash file that calls the php script operates via a setInterval() function. For some reason, this works fine in Firefox and Safari, but in IE the swf fails to update the fugures unless i clear the cache and reload the page..rather than the setInterval() function doing so every 60sec...
View 0 Replies
Sep 1, 2008
I can't see why this setInterval isn't working ..basically I want it so a new instance of the same image from the library gets placed on stage at various time intervals at a different alpha level each time ... >
Code:
var myInterval:Number;
var number:Number = 1000;[code]............
View 2 Replies
Jan 9, 2006
How can I use setInterval to start and stop the root timeline? I would like to use it in this little fade function wherein the setInterval would kick into effect once the alpha is 100%. You can see where I think it needs to go. Here's the code.
Code:
stop();
variable = x+5;
title_mc._alpha = 0;
function fade() {
var nFadeSpeed = 4;
[Code]...
View 6 Replies
Oct 20, 2006
I have few sound files and I need to play then in an order and every time after the sound played a button is active then the user can click on the button to play next sound....etc. But at some point my setInterval keep calling the stop sound function even though myTimer is delete. I checked the actionscript dictionary and I found that the delete action is for Flash 5. Does it mean I can use it in Flash 7 or 8 and actionscript2?
Here is the code my created:
//-----------play sound---------//
function soundPlay(ID:Number){
var instrSound:Sound = new Sound(this);
var soundName:String = "SCP" + ID + ".wav";
soundID = ID;
[Code] .....
View 2 Replies
Sep 15, 2010
I'm having difficulty adding a setInterval to a Flash Movie I'm working on. Every time I try to introduce it all the elements fail to display.Attached is the Zip of where I'm up to so far - I have 9 blocks swinging onto the screen all at once (they finally come to a halt to reveal a picture). I'm trying to get them to appear one at a time with a delay inbetween.
View 7 Replies
Feb 7, 2008
public function showImageAt(num:Number):Void
{
var interval:Number = setInterval(
function():Void {
[Code]......
so the test function never gets called...
View 2 Replies
Jan 27, 2009
I have a flash 9 app that calls a php script that in turn pulls in some variables from txt files. The function within the flash file that calls the php script operates via a setInterval() function. For some reason, this works fine in Firefox and Safari, but in IE the swf fails to update the fugures unless i clear the cache and reload the page..rather than the setInterval() function doing so every 60sec...
View 1 Replies
Aug 27, 2009
The main AS timeline creates the enemy instance and calls them via the timer class. Inside the instance enemy movie clip there is some script to do a basic tween and there are functions to remove the enemy and to declare you've hit the enemy. The problem I'm having is when I try to call my KillEnemy function with a MouseEvent.CLICK (or MOUSE_DOWN, MOUSE_UP) event, it isn't registering, I realised this after testing the same function to listen for a MOUSE_OVER, MOUSE_OUT, it worked perfectly.
Can anyone explain why this is happening? Not just that the mouse seems to be a little delicate, even with the roll over listener called it isn't registering the event unless it hits a specific part of the movie clip enemy, which leads me to believe the movieclip is somehow built incorrectly? But even when testing the game with extreme settings (i.e. leaving the enemies on screen for a long time) the mouse clicks aren't registering still. Something is broken! Here is some of code inside the enemy movie clip, the problem lies on line 11:
[Code]...
View 6 Replies
Mar 18, 2009
I have a series of 6 images. In a single movie clip symbol (with the pictures embedded/attached in the swf), I want the images to fade in, stop for 4 seconds, fade out as the next image fades in, and repeats from there. I know how to do this with timeline tweens - but I wanted to learn how to make it in actionscript.
I've finally been able to make the images do this, but when I pull the movieclip into my main animation, it breaks all my stop(); commands for navigation. it seems to stop for 4 seconds and then continues on. I'm still very much an actionscript beginner, so I don't know how to troubleshoot it.
[Code]...
View 4 Replies
Sep 1, 2009
The first scene will have an embedded movie clip and artwork as a background for approximately 150 frames, the next scene (Scene 2) then appears (in the first and only frame) which has the following (AS2) setInterval on it (to play a swf file on a movie clip - the swf lasts a little over 2 minutes. Hence, 122000 milliseconds below):
Code:
mc_demos.loadMovie("swf/aquira.swf");
stop();
[code].....
View 1 Replies
Jan 18, 2009
I have a very odd issue with Firefox 3. Take the following code
ExternalInterface.addCallback("startAds", null, startAds);
function startAds() {
debug("Calling startAds");
[Code].....
The startAds function is called from javascript. When run in IE 6 & 7 everything works fine. When run in Firefox 3 i can see it enter the function and even assign and intervalId but the function set in the setInterval function never gets called. If i call setAds from actionscript and run it in Firefox 3 it works ok. Its just when the startAds function is called from javascript in Firefox 3.
View 2 Replies
May 10, 2005
I'm trying to create a wipe, where a bar expands vertically from the top to the bottom. This was accomplished with a motion tween. Now, I'm trying to use AS to duplicate that one bar across the screen, and this is done inside a movieclip, and the movieclip is on the main stage and it is setMask(my_mc); to reveal an image beneath.
Here's the code I'm using:
totalBars = Math.round(Stage.width/bars._width);
i = 0;
duplicate = function () {
if (i <= totalBars) {
i += 1;
bars.duplicateMovieClip("bars"+i, this.getNextHighestDepth());
this["bars"+i]._x = i*bars._width;
}else{
clearInterval(intervalID); }};
var intervalID = setInterval(duplicate, 10);
But it doesn't work!
View 8 Replies
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
Jul 20, 2008
If I place some working setInterval code within a function and then call the function, it fails:
Code:
function RevealLinks():Void {
menu_mc._visible = true;
[code].....
View 8 Replies
Jun 2, 2006
I have this simple bit of code which is used regularly in my movie...
minNum = 1;
maxNum = 200;
number = Math.ceil(Math.random() * (maxNum - minNum + 1)) + (minNum - 1);
Is it possible to add something to this code to stop the same number being called more than once?
View 1 Replies