Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Reading from a text file every 5 minutes

Posted on 2003-03-07
15
Medium Priority
?
124 Views
Last Modified: 2010-04-03
I want to be able to read in a text file which contains 5 minutes worth of data to process. Once those 5 minutes are up, I want to do it again, and so on.

Currently, I am only able to keep getting the file every second or so which is going to cause a strain on the webserver.

I have to use Flash 5 for this. Is it possible and if so, could you provide a sample of the code I'd use for such a solution?

Newsgroups seem to avoid the issue altogether...

Thanks in advance

Graeme
0
Comment
Question by:GraemeScotland
  • 5
  • 5
  • 4
  • +1
15 Comments
 
LVL 22

Accepted Solution

by:
rascalpants earned 2000 total points
ID: 8091383
A VERY easy way would be to have a looping movieclip load in the variables after the five minutes are up, then reset itself...


- if your frames per second is set to 12, then just make a movieclip with 13 frames

- in frame 1 put this:

n = 1;
stop();


- in frame 2 put this code:

if(n == 3612){
 loadVariablesNum("pagewithtext.txt", 0);
 n = 1;
} else {
n++;
}


- in the 13th frame put a gotoAndPlay(2);


this looping movieclip will add 1 to n every second, and then on the 3600th second, load the text in again...


this is a very easy way to do this...


let me know if you need more information...


rp



0
 
LVL 22

Expert Comment

by:rascalpants
ID: 8091394
I am sure there is a more "elegant" way to do this, but I try to provide answers that everyone can understand and learn from...

you can get into getTimer and stuff like that, but there is really no need, unless you need to get this down to the millisecond...


rp
0
 
LVL 5

Expert Comment

by:ocgstyles
ID: 8091401
too fast for me RP!!!!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 5

Expert Comment

by:ocgstyles
ID: 8091404
HAHAHAHAHA
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 8091426
Big O,  do you have any other thoughts on this...  I can't think of an easier way, without some confusion...


rp
0
 
LVL 5

Expert Comment

by:ocgstyles
ID: 8091525
i was gonna use getTimer(), but yer first way is perfectly fine.  its must be helluva text file to take five mins to process!!
0
 

Author Comment

by:GraemeScotland
ID: 8091610
Thanks, it is a rather large text file which needs processed. There's 500 seconds worth of information on it, so I want each of the n counts to show a second's data from the file.

When all the data has been used, a new file should be ready to be read in with the next 5 minutes data.

I've been looking for some kind of time based mechanism like this for ages, thanks to all who contributed :-)
0
 
LVL 6

Expert Comment

by:henryww
ID: 8094654

@#$%*!%@%#@ ...  so fast ...
unbelievable ...

i shouldn't have gone to sleep... should wait for this one!!

oh man ... u've got that extra 2000 pts from the pdf question too ... hard to catch up ... ha ha ha ...

and ocgstyles took some of the little ones too !! hmmmmm

well, let's see how long it will take for me to get pass rp again ... LOL

well done.

cheers rp & O ...
0
 
LVL 6

Expert Comment

by:henryww
ID: 8094666
actually i have a better way to do this, but i am not gonna tell u ... since i don't get my 500pts no more ... LOL ...
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 8103019
I have about 3500 in points to give out.... maybe I should give it all away, and give an A for the questions as well....

now how can I give it to myself... hmmmmmm?


:)


rp
0
 
LVL 6

Expert Comment

by:henryww
ID: 8103111
ha ha ha ha ....
0
 
LVL 5

Expert Comment

by:ocgstyles
ID: 8103278
hey rp....yer my best friend!!  ;-)  did i ever tell you that?!?

-O
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 8103344
:)
0
 
LVL 6

Expert Comment

by:henryww
ID: 8103958
ha ha ha ... i have 2700+ pts to give away too ... anyone?

ha ha ha ...
0
 
LVL 5

Expert Comment

by:ocgstyles
ID: 8106206
i like points.  =)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question