Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a log filr to start a flash movie 1

Status
Not open for further replies.

NoviceFlashUser

Technical User
Sep 1, 2003
21
0
0
SG
hi All,

I am a newbie to flash actionscript. Recently I am required to use actionscript to read data from a log file (.log) to start a flash movie. Eg. if the log filec contain the word "start", then my flash movie will begin.

can someone please help and enlighten me on how to do it?

Thanks

regards
mirage
 
hi
Thanks for your prompt reply.
I needed to code some actionscript to read in an external log file (eg. data.log) generated from some other applicaition and if after parsing the log file and able to find for example the word "start" , the code will trigger a flash movie.

It's like using the external log file as a trigger instead of buttons .

thanks and regards
mirage
 
still dont know what you are after...maybe me...maybe monday morning

is this what you want

flash reads an external file
if the word start is there load a certain flash file and do something.


if so the data will have to be delimited and the log file structure may have to be amended
 
Yes, that's what I am trying to do. Just that the external file is of a .log extension and has the file structure that has data separated by commas.
It is actually a log file generated by a sms gateway and i am using it to trigger a flash movie. And i don't think the log file structure can be amended.
 
...still dont know what you are after...maybe me...maybe monday morning... ????

This is Tuesday morning... Labor Day remember?


Regards,

cubalibre2.gif
 
as you cant add variable names to the log file you have to mess about a bit first

frame 1
Code:
lv = new loadvars()
lv.onload = function(){
	all = unescape(this)
	remove = all.split("=")
	mydata = remove[0].split(",")
	for(i=0;i<mydata.length;i++){
        if(mydata[i]==&quot;start&quot;){
         loadMovie(&quot;start.swf&quot;,clip)
         break;
         }
}
}
lv.load(&quot;file.log&quot;)
 
hi billwatson,

Thanks for your code and I ll try it out. You are so helpful and efficient and btw our labour day (Singapore) is on May 1st.
 
hi Bill,

Thanks, the code works. btw, how can i write the code in such a way that it will not just read once but constantly reading and anticipating the contents of the file to change.

regards
 
Code:
checkFor = setInterval(startExists,5000)
//check every 5 secs
lv.onload = function(){
    all = unescape(this)
    remove = all.split(&quot;=&quot;)
    mydata = remove[0].split(&quot;,&quot;)
    for(i=0;i<mydata.length;i++){
        if(mydata[i]==&quot;start&quot;){
         loadMovie(&quot;start.swf&quot;,clip)
         break;
         }
}
}
function startExists(){
	delete lv;
	lv = new LoadVars();
	lv.load(&quot;file.log&quot;);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top