ActionScript 3.0 :: Change Interval Passed To SetInterval Function?
Jul 16, 2010How can you change the interval passed to the setInterval function?
I've tried for hours but it seems to trigger the function a million times.[code]...
How can you change the interval passed to the setInterval function?
I've tried for hours but it seems to trigger the function a million times.[code]...
Could anyone please tell me how I can change the number of milliseconds at which a setInterval function repeats, whilst the movie is running? I am using setInterval to call a function which duplicates a movieclip and I need the duplication to happen over decreasing amounts of time. The problem seems to be that the setInterval function only needs to be set once, so declaring it again with a new interval value isn't an option.
View 12 RepliesI'm working on a game, and I'm having some issues because it's kinda "stuttery" - it seems as though the ticks don't get called every x ms like they are supposed to (ofcourse there could be additional problems, but I'll look into those later on - this could also be an issue for other (future) projects).So I tried to have a look at setInterval. I made a new AS3 document with the following code:
Code:
// imports
import flash.utils.*;
import flash.events.Event;
[code]....
The interval probably averages, but it goes as low as 11 and as high as 37 sometimes. As such, I would say this function is not very reliable...
Have a problem with setInterval. How do you check if your interval is still running and don't add another one? When i trace myInterval, it gives me increment numbers, and not true or false? Is that supposed to be normal? If so, how do i check that myInterval is there or not there and do my actions according to the result?
View 3 RepliesMy 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]...
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?
I have a basic XML file and a parser in as3.
So far, I can get it to parse and trace data from the xml file:
{
xml = new XML(e.target.data);
var tester = xml.item;
[Code].....
My objective is to pass in a bunch of variables from my XML file that I can use anywhere in the flash project.
why is my variable not being passed into my function?
Code:
dealerLocate.urlButton.linkButton.onRelease=function(webAddress){
web=webAddress
trace("this is web "+web);
[Code]....
the webAddress variable is from the exact same timeline making it one level up from this function. it traces out correctly too so I know the variable is there... just not getting passed!
My code seems to produce an error (7 times - same code) "1120: Access of undefined property xmlMarker." This appears on all occasions where the variable 'xmlMarker' is called outside of the function ('showData') where it was first produced.
Code:
stop();
var placesXML:XML =
<places>[code]............
I have a feeling that I shouldn't refer to the variable as a 'MovieClip', but I am unsure what else to pu thee if that is where the fault lies.On the stage there are several buttons relating to the place names attributes (works perfectly), dependent upon which button is pressed, the scene then jumps to a frame (again this works well), however within that frame there will either be 'myMarker_mc', or myMarker_mc2' (this does not work!).
im trying to get the interval to change so consequentially the textbox content will too.
[Code]...
I have the following problem with objects in actionscript3:
var o:Object = new Object();
destroyObject(o);
trace(o); // [object Object]
[code].....
I've got this code:
Code:
function func2(options:Object)
{
...
}
[code].....
-which doesn't seem to work.
In my case I have 6 movieclips and 6 corresponding text fields (all 12 objects are on the main timeline) and the movieclips are named thumb1_mc, thumb2_mc, etcetc, and the text fields are named text1, text2, etcetc.I have a method:mcl_mcl.onLoadProgress = function (targetMC, loadedBytes, totalBytes)in which I need to change the appropriate text file's text depending on which movieclip is targetMC.The trouble is I can't find a way to distinguish which mc it is, so I can't pick which text file to change.I tried using properties but that doesnt work because everything about the movieclip gets obliterated the moment I load something into them.
View 4 RepliesHow to set an interval before calling a function?
View 1 RepliesCan I clear a interval in a function from another function?[code]...
View 2 RepliesIn c++ if I have a function that takes a class I have defined elsewhere as a parameter like so:void moveto(CPoint2D point) { ... }I can invoke it and pass along data to it like this:moveto(CPoint2D(0,0));basically creating the object and invoking it's constructor to be passed to the functionIs there an equivalent to this in AS3?if I have a function like this:function initialize(min:Point, max:Point): void { ... }how do I do something along the lines of :initialize(Point(0,0), Point(10,10))This throws an error im assuming because it thinks I want to cast something to a point and the notation I found earlier to do something similar only seemed to work if using the basic Object class.
View 1 RepliesBasically I want Javascript to pass a variable to Flash according to resolution. I realize my syntax might be off, but something like:
HTML Code:
<script type="text/javascript" language="javascript">
if (screen.width <= 800) {
expand = "false";
[code]....
Trouble is, I'm not sure what to do from here. I don't know exactly what I need to put in the <param> and <embed> tags, and how Flash would detect if the variable was true or not.
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...
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].....
I have a function which makes a call to the server to load some financial data. This data is then displayed in a grid. In order to keep displaying the latest data I keep making this server call (every 30 secs). I'm using a Timer object to do this. The problem I have is that I have to wait 30 secs when the application starts for financial data to be displayed, what I'd like to happen is that the load data call is made, then start the update timer. Is there a way to set this up or shall I use to data load calls, one to get the initial data, then one to get the updates, which is made every 30 secs?
View 1 RepliesI 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.
[This is Flash 8, AS2]
Code:
//////////////////////////
/* IMPORTS AND INCLUDES */
//////////////////////////
import mx.transitions.*;
[Code].....
how can i make this replay button? i need to kill the "delays" at function. how can i make this?[code]
View 1 RepliesI have my setInterval that is set this way:
[Code]...
I was wondering how I might change this to a "local" function instead of "_global". I've been trying, but my syntax is either screwed up or just just plain doesn't work.
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]....
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].....
I've got function that I call using setInterval. The problem is I need to call that function on an interval faster than 1 millsec.
View 4 Replieswhat i'm trying to achieve is to be able to create a random time frame betw 1 to 8 seconds before it calls a movie clip from the library.
Code:
function layEgg(hens) {
//set random time in sec
var timeGap = Math.floor(Math.random()*(8+1))+1;
[Code]....
however the time interval is not working. i managed to trace the random timeGap.
How do I pass a variable to function when calling it with interval.
This:
Code:
doFlip(1);
to something like this:
Code:
myInterval = setInterval(doFlip(1),2000);
I know the setInterval function makes something happen every x second(s) however, how do i make it wait for x second(s) then do something once?
View 7 Repliesmy code the problem with this code is that I can't change the delay once its loaded.
Is there a way to change the delay after firing runMany() ?
Code:
var intID:Number = setInterval(runMany, 1000, 1); // 1 second
function runMany():Void {
trace("runMany() called @ " + getTimer() + " ms");
clearInterval(intID);
}