ActionScript 1/2 :: Using GetTimer() As A Cache Killer?

Jan 31, 2011

I have recently been working on a Flash file that dynamically loads a movie based on the contents of a simple XML file. I was concerned about caching issues so tried to set up the code to avoid the XML file being cached causing the wrong content to be loaded. I did this by adding a dummy query string to the file link which is a numerical value generated by getTimer().In practice the system mostly worked but occasionally old content would load even though the XML had been changed. The code runs a setInterval that checks the XML every 20 seconds and checks if the loaded file specfied has changed. The code loads the XML with the following code:

The getTimer() functions starts counting in milliseconds as soon as the movie runs so there is a chance that the same query string is assigned to more than one file, meaning that an old cached version is loaded instead of the new, live file. I am now thinking about ways to improve this code and generate unique values for the query string. I thought using the epoch time - the time in milliseconds from which Flash calculates time and dates which is set to Jan 01 1970 - would generate a new value every millisecond and maybe adding an additional random number to that value to further reduce the chance of the same query string being generated more than once.

this.onEnterFrame = function () {
var nowDate:Date = new Date();
nowTime = nowDate.getTime();

[code].....

View 1 Replies


Similar Posts:


ActionScript 2.0 :: (getTimer-getTimer) Word "undefined" Is Displayed In The Textbox?

Oct 25, 2009

I'm making a racing game and am trying to have the final time displayed after I cross the finish line...In frame 4 (where the game begins) i have a setInterval timer that counts down from 20.when it reaches 0, my text is: startTime; where var startTime:Number = (getTimer()/1000).In frame 12 (where the game ends) i have

finalTime.text = endtime
// finalTime is a textbox
var endtime:Number = (_root.finishTime-_root.startTime);[code]...

when i finish the race, however, the word "undefined" is displayed in the textbox.

View 2 Replies

Media Server :: Do FMS Cores Share The Same FLV Cache Or Does Each Core Have It's Own Cache

Jul 28, 2009

Do FMS cores share the same FLV cache or does each core have it's own cache?

View 1 Replies

ActionScript 2.0 :: Reset A GetTimer();?

Nov 28, 2005

How do I reset a getTimer();? My script for my "game" doesn't work, here's the code:

Code:
on(press){
poang += 1;
_root.minpoang=poang;
this.gotoAndPlay(2);

[code]....

As you can see, I have tried to reset time to 0 again, but that doesn't work..[URL]

View 4 Replies

ActionScript 2.0 :: Reset The Value Of GetTimer?

Jun 4, 2002

I have an empty movie clip that tells another movie clip on the stage to move based on a variable that's based on the getTimer results something like:

onClipEvent (enterFrame) {
targetx = 0;
_root.slide.gotoAndPlay("move");

[Code].....

Now, what I want to do is to reset the value of getTimer so my movie will loop,

View 5 Replies

ActionScript 1/2 :: Catch When A Second Is Passed Using GetTimer

Jan 5, 2011

I'm trying to catch when a second is passed using getTimer. I don't want to use setInterval, because I'll need to pause, and unpause it. So.. here's my code:
 
[Code]...

What is wrong with this code? It seems that the time variable reachs 1000 milliseconds too fast.I'm not getting a second interval. How would I fix that?

View 1 Replies

ActionScript 2.0 :: GetTimer >> Stall Timeline?

Apr 19, 2004

this doesn't work...what's wrong with it. i want to stall the timeline in an MC for 5 seconds.

Code:
now=getTimer();
if (now > 5000) {[code].........

View 14 Replies

ActionScript 2.0 :: How To GetTimer Doesn't Re-initialize

Aug 9, 2004

I have a simple slideshow that is non-interactive. It just loops five movie clips loaded externally. Each slide is shown for a certain amount of time that is determined with getTimer.The code for the slideshow is in the last frame of the root timeline. So, basically the slideshow starts when the root timeline finishes playing. The problem is that the timer works great the first time the code plays, but when I tell the player head to back up and enter the frame again, the clips play very rapidly, as though getTimer was not being initialized.

Here is the code:
stop();
square._alpha = 0;

[code].....

View 2 Replies

ActionScript 2.0 :: Any Way Of Capturing GetTimer Result?

May 18, 2007

Is it possible to capture the time in a timer? I have some English learning games for my students that use a timer. It works fine as it is. Its starts when they click start and ends when they drag the last thing into place. What I would like to do is have a bonus scene when students do exceptionally well and get some crazy low score. I don't know how to go about capturing the end time though.

View 1 Replies

ActionScript 3.0 :: GetTimer(); For Download Speed Variable

Sep 16, 2009

i have an .fla, which loads goes to different frames in the timeline according to the download speed of the user. i understand how it should work... start timer > upload file > stop timer > calculate download speed - easy?

so what is this simple code im missing to find the download speed? from my fruitless searching, the only relevant code i could find, is this:

Code:
var time1 = getTimer();
targetClip.loadMovie("example.swf");
targetClip.onLoad = function()

[Code]....

... but i have test this, which gives an undefined property error grrr.... so what is the actionscript 3, to find the value of the download speed?

View 4 Replies

AS3 :: Flex - GetTimer() Method And The Timer Class?

Jun 18, 2009

I'm in the process of making a game (a shmup) and I've started to question the accuracy of the timers in ActionScript. Sure, they're accurate enough when you want to time things on the order of a few seconds or deciseconds, but it seems to perform pretty poorly when you get to finer ranges. This makes it pretty tough to do things like have a spaceship firing a hundred lasers per second.

In the following sample, I tested how long (on average) the intervals were between 1000 timer ticks intended for 30ms. Time and time again, the results are ~35-36ms. Decreasing the time, I found the floor on the timer delay to be ~16-17ms. This gives me a max fps of ~60, which is great visually but also means I can't possibly fire more than 60 lasers per second :-(. I ran this test a few times at 100 and 1000 loops, but for both the 30ms test and the 1ms test the results didn't change. I print to a textField at the end because using trace() and launching the swf in debug mode seems to negatively affect the test. So what I'm wondering is:

Is this test a decent measure of the Timer class's performance, or are my results questionable? Will these results change dramatically on other machines? I understand this is dependent on the getTimer() method's accuracy, but the discussions I find on this topic usually center around getTimer()'s accuracy on larger intervals.

[CODE]...

View 5 Replies

Actionscript 3 :: GetTimer Results Between MOUSE_MOVE Events

Jun 27, 2010

I'm programatically dragging the play head back and forth along a timeline based on a mouse event listener. The faster the mouse drags the faster the playhead rips through the frames (it's linearly proportional). I'm also firing a starter=getTimer(); event at the inital mouse_move Event trigger (and only on the initial event) and then firing a ender=getTimer() at the end of the code that calculates the new playhead position, but only if the calculation has resulted in the playhead being told to move at least one frame (the mouse can move a few pixels before playhead will move one frame). In essence it's giving me a frame per second rate.

If I look a the delta of the two timers I rarely get anything but 0. Occasionally I'll get a 1 but not very often. There are a good few dozen heavy lines of code that need to be worked out between the initial mouse_move and the decision to move the play head, and this has to be done for a number of mouse position changes before the playhead will move at all and the second getTimer call is triggered. Does the mouseEvent trigger every ms or does it trigger at the frame rate (enterframe rate) of the doc. If so the smallest delta I should see is 31ms.

This runs as an app in the standalone swf player (10.1) and never in a browser.
Are my results indicative of this? Can the compiler really run this fast? How does one do very small timing tests that appear to be beyond the millisecond clock granularity?

View 1 Replies

Actionscript 3 :: Flash Game : GetTimer Inaccurate

Jan 17, 2012

I'm working on the game. The gameplay is based on a really small time lapse (you have only 5 secondes to do an action). My timer works great in Flash Player, i DO have 5 secondes. In a web browser (firefox, safari ..) the 5 seconds timer is now 8 seconds.

[Code]...

View 1 Replies

ActionScript 2.0 :: Combining Mouse.addListener And GetTimer?

Aug 4, 2003

I need to get my movie to check if the user has click anywhere on the interface (doesn't matter were), if there's not click after 60second, I need to send the movie back to frame1.I know is a combination of addListener(Mouse), onMouseMove and getTimer. but I'm not very good at action script yet to combine the three.

View 8 Replies

ActionScript 3.0 :: GetTimer() Returns The Same Value On Two Subsequent Frames?

Oct 9, 2011

I'm encoutering something pretty weird. My framerate is set to 60 and I have a function that listens to enterFrame events and calls getTimer() to calculate the time between steps. That usually works nicely, however when I run the swf in flash player 10.3 or 11 standalones, the time delta is detected for many steps as being '0' because getTimer() returns exactly the same thing as on the previous step. The flash movie as such doesn't skip frames (except it looks bad since everything moves according to the time delta) and the framerate is 60 as it should (EDIT: Not actually true, 0 ms frames are skipped). It doesn't even happen every time. Sometimes I run it with the aforementionned players and it's just fine, apparently for no reason. I have tried the debug and release players and the problem happens with both.I'm targeting flash player 10.0 and it works well with that standalone player, as it does with 10.1. Not targeting 10.3 might be part of the problem I guess, but I have no idea really. At any rate, I was wondering if anyone else encountered that problem before, and hopefully would know the cause. I have found nothing about it on the web so far.Technical info: I'm using flashDevelop 3.3.2 and the Flex 4.1 open source sdk

EDIT: It would seem it's not a getTimer problem. The time delta between frames is reported correctly but faulty frames do last 0ms.

View 4 Replies

ActionScript 2.0 :: GetTimer - How To Stall Timeline In MC For 5 Seconds

Apr 19, 2004

I want to stall the timeline in an MC for 5 seconds.
Code:
now=getTimer();
if (now > 5000) {
play();
} else {
gotoAndPlay(_currentframe - 1);
}

View 12 Replies

ActionScript 1/2 :: Does GetTimer Function Affect Output Time

Feb 8, 2011

Does the getTimer function affect the output time? so it's seen different in each country? I've created adigital clock using the time received from a php. Customers see a different time than mine. (php file works perfectly and output the time in my timezone).

View 3 Replies

ActionScript 3.0 :: Pausing A Timer Without GetTimer (instead Of Stopping / Restarting)

Oct 20, 2010

I'm currently working on a detailed music media management application in Flash. There is a mp3 player which plays music and has a playback seeker (keeps track of current time for track and a tiny pin that that increases its x position as the track plays). I have a simple play & pause button that does appropriate functionality of playing & pausing the track, but the issue is that I have to pause the Timer associated with updating the playback seeker. The seekerTimer object has a delay of 1000 (1 second), while I'm listening to a track, the timer may have already excuted 600 ms, only waiting for 400 ms till the next timer event is dispatched to update the playback seeker. If I hit the pause button at 600 ms of execution time and I do a seekerTimer.stop(); and then a seekerTimer.start();, the timer does not resume its execution and instead restarts executing from 0 ms. This means that the playback seeker is not updated accordingly.

How can I pause the timer when I hit my pause button (essentially store the execution time), and then resume execution when I hit the play button? The play button doesn't have any parameters to start executing from a certain time. I looked at tutorials online but they all rely on the getTimer(); function, this returns a value of how long the Flash player has been running (from initialization). The issue is that the mp3 player in this Flash app doesn't initialize upon the application initalization (I know its a bit confusing).

View 3 Replies

ActionScript 2.0 :: GetTimer Function - Time Resets On MouseDown

Sep 27, 2005

I don't know how to do the actionscript tags so I am gonna use the PHP ones!
PHP Code:
function startTimer() {
initial = getTimer()/1000;
}

If this function gets called, what exactly happens here? Does it reset the timer? Or just gets the time the swf has been playing? Because when you use this mouse listener
PHP Code:
mouseListener = new Object();
mouseListener.onMouseDown = startTimer;
It actually resets the time everytime you mouseDown.
[Code] .....

View 3 Replies

ActionScript 2.0 :: Use GetTimer() To Call A Specific Function In Every 3 Seconds?

Dec 14, 2007

I calling a function using setInterval()... however, it behaves differently in IE7 and Firefox. It is working fine in Firefox but not in IE7.Can I use getTimer() to call a specific function in every 3 seconds...?

View 1 Replies

ActionScript 2.0 :: Accuracy Difference Between GetTimer And Date.getTime?

Aug 29, 2008

I came accross another issue regarding the accuracy between the getTimer and date.getTime functions.I use this simple script (AS2)

[Code]...

What happens if you let this simple app running is that the trace will show that the difference between the getTimer and date.getTime results slowly increases.I would assume some inaccuracy, but not one that would slowly increase during the lifetime of the application. The reason I want to compare the two values is that I want to see if someone is tampering with the application speed with a program such as Cheat Engine. And I noticed the date.getTime function isn't affected by that program, but the getTimer function is.

View 5 Replies

ActionScript 2.0 :: Clips Play Very Rapidly As Though GetTimer Was Not Being Initialized

Aug 9, 2004

I have a simple slideshow that is non-interactive. It just loops five movie clips loaded externally. Each slide is shown for a certain amount of time that is determined with getTimer. The code for the slideshow is in the last frame of the root timeline. So, basically the slideshow starts when the root timeline finishes playing. The problem is that the timer works great the first time the code plays, but when I tell the player head to back up and enter the frame again, the clips play very rapidly, as though getTimer was not being initialized. Here is the code:

[Code]...

View 2 Replies

ActionScript 3.0 :: Use A GetTimer Method That Takes To Another Frame - Continues Counting

May 27, 2010

I am trying to use a getTimer method that takes me to another frame (frame is "memory") after a certain amount of time after the movieclip has been loaded. The frame that I want it to go was given the name already. The timer itself does count when tested, but it just continues counting.

[Code]....

View 2 Replies

ActionScript 2.0 :: Pause Override On Timed "endtime = GetTimer"?

Sep 30, 2006

I have a Flash movie that uses actionscript to pause for 5 seconds on each scene. I would like to have a Pause button that, when clicked, can "override" the 5 second timer, and stay paused until the user clicks the "forward" button to resume the movie. How can I make the pause button override the actionscript that is counting 5 seconds and then going to next scene?

The actionscript I'm using for the 5-second-then-go timer is contained within a movie clip that has in frame 1:
endtime = getTimer() + Number(substring(_name,5)) * 1000;
_parent.stop();

then in that clip's frame 3:

if(getTimer() < endtime) gotoAndPlay(2);

then in that clip's frame 4:

_parent.play();

I put that clip on the first frame of each scene, and it counts 5 seconds before going to next scene. Works great. But when I put a pause button with the code:

on (press) {
_parent.stop();
}

... that button doesn't stop the movie. It seems that the timer movie clip overrides it and just keeps the movies moving every 5 seconds. how I can get a pause button to work on this? Then I would want to "resume" the paused movie by hitting the "play" button to go to the next scene.

View 2 Replies

Get SWF From Server Rather Than From Cache?

Apr 3, 2009

Whats the best possible way to pull the swf in html everytime from the server not from the system cache?I am using flash files in my hytml which grabs the data from XML, we frequently update our XMLs so we want our users to get the fresh swf from the server so that they get the latest feed.

View 1 Replies

As3 :: Cache Image With It?

Nov 24, 2010

This is my first post here in StackOverFlow, and I bring you a problem that is hauting my development team.

We are in a project, using stand alone FlashPlayer as a news displayer.The news feed is a dynamic XML returned from a ASP.Net request and runs on Windows XP.

The problem is:- The display is running in a bus screen and sometimes the internet connection fails, but we still need to keep displaying images from the news already downloaded. When we manually put a string on a URLRequest it works. The image is downloaded from the server, cached by the IE8, and re-loaded from cache if the internet is gone. But, when we dynamic retrieve the image url from de XML and puts inside de the URLRequest method, the re-load from cache do not work.[code]...

View 1 Replies

Control When A Swf Is Loaded From Cache And When Is Not?

May 26, 2009

We have a web app. built in flash that allows customers to upload images and text, customize the container in which these will be shown (a swf file) and then embed the code into thier website. There is also a sharing options that allows their users to display this container, together with the content, on their websites. (For e.g you can see the container as the Youtube player and the content as the videos the user chooses to show). The swf container uses an XML file to know what to display.

Now, I am not a flash developer, but a person who takes care of the project.We are currently working on the app and the swf and we still find bugs. Every time we fix sth, I am told to erase my cache to see the changes. My concern is that the client/users might not see the newer version that we make available, but the old one. We can't tell them to erase the cache and we can't afford to renounce using the cache since the images are big.I was told that, sometimes, the browser does not see that the current version is a new one and loads it from the cache (actually, it never detected that there is a newer version and I always had to erase the cache). How can we tell the browser "now, load the swf from cache" or "now, don't load the swf from cache".

View 1 Replies

Professional :: Flash XML Cache In IE

Jul 18, 2011

I'm working on a project that includes several flash elements developed using an XML method. The objects work fine in all browsers except IE. Here is the behavior in IE. You can interact with the objects fine the first time through, but if you leave the page and come back, you just get a perpetual loading symbol. You can get the object back by right clicking and pressing play, but that is an obnoxious work around. I think it is a caching error in IE, but I'm unsure how to fix it given that it is not occurring in other browsers.

View 1 Replies

ActionScript 3.0 :: Download And Cache In AIR

Oct 26, 2011

I've made a program using AS3, AIR and php to look up a remote dir, and download mp3 file to a folder on my local machine.It works fine.However, even if I delete the downloaded mp3s from the folder on my local machine, and run a test, the program seems to 'instantly' populate the folder with the mp3s again, as if it's getting them from some windows temp folder, and not bothering to re-download them.I was wondering if the above is the case, and if so, if there's a way to force it to download the file even if it resides in a temp folder somewhere?[code]

View 2 Replies

Why Dynamic Flashbox Not Using Cache

May 19, 2010

The flashbox I've created is a dynamic object - like a coverflow - that loads 8 images (4 channels with a background and forefront image) on its first load and then every 5 seconds loads up another channel to replace one of the other channels. There are 8 channels & 16 images in all and the whole process loops. The images and the data incidentally are loaded via an XML file. Instead of loading the 16 images from the start and then loading them from the cache, it instead constantly loads new images, keeping the older images in the browser memory. If you leave it on the page with the flashbox for 30 minutes, then the browser memory can rise above and beyond the 500MBs of RAM usage mark. Leave it longer and it still racks up - for instance, I had Firefox (this is with all browsers though) get to over 2.5GBs of memory being used earlier on today.

View 1 Replies







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