-
dynamic test using text file
I am new at flash so please bare with me. I am trying to load names, adddress, and a link from a text file. I wanted to start from the last person and display this information, along with a clickable link to their website. How would I go about doing something like this?
I have read a few thread when they say that they have taken a dynamic txt and placed it within a movie. What exactly does that mean?
-
That web bloke
If you click on help in Kool moves, and search on dynamic text you should find all you need. If you need more help beyond this come back here and we should be able to answer your specific question.
-
If you want the entire contents of the text file to be loaded into a dynamic text object, you can use Load Dynamic Text action. If you want pieces of the file to be loaded, it is a very different story.
-
Originally Posted by Bob Hartzell
If you want the entire contents of the text file to be loaded into a dynamic text object, you can use Load Dynamic Text action. If you want pieces of the file to be loaded, it is a very different story.
I guess I would be in the different story category. I would need it to bring in three variables of data at a time and then wait 5 secs and then go to the next one in order.
-
That web bloke
If these variable have fixed names, simply create a dynamic text box, and in the configuration pannel give the text box that variable name. Do this for each of the variables. Set the frame to run for the required time then on the next frame set up a return to the origonal frame and your variables will refresh.
-
up to my .as in code
Sounds like he wants to page through three entries at a time from an array of many. Paging.
-
Originally Posted by Stoke Laurie
If these variable have fixed names, simply create a dynamic text box, and in the configuration pannel give the text box that variable name. Do this for each of the variables. Set the frame to run for the required time then on the next frame set up a return to the origonal frame and your variables will refresh.
Won’t the variables start at the beginning of the text file if I tell it to goto the 1st frame?
-
Originally Posted by Chris_Seahorn
Sounds like he wants to page through three entries at a time from an array of many. Paging.
Yes, the correct. Data might look like something like this.
47. Joe Tell City, IN www.yahoo.com
46. fred Lombard, Il www.deathtouchhorrors.com
etc....
It might have to bring the data in three or four at a time if you could the number. Which just says when they were entered into the database.
-
up to my .as in code
entered into the database.
Database. You pulling the main array from MySQL? If so...post your table structure (dump it from phpmyadmin or similar) but DO NOT POST THE DATA. I only need the table structure...not the data.
-
Originally Posted by Chris_Seahorn
Database. You pulling the main array from MySQL? If so...post your table structure (dump it from phpmyadmin or similar) but DO NOT POST THE DATA. I only need the table structure...not the data.
No, I am sorry. I didn't mean database as far as MySQL. I am not ready for that yet. I am just planning on using a txt file.
-
up to my .as in code
Then I'm sure someone will post a solution. This way they know what you want and you can also search "paging" or similar in flash.
I would also explore xml since your entries have attributes. Both are fitting and can run locally. Good luck!
-
You could use a csv file to store the data.
Here's a thread about it
http://board.flashkit.com/board/showthread.php?t=681535
When you have all entries in an array you can use the onEnterFrame or setInterval to create a 5 sec timer that will loop through the array and display one record at a time.
-
Ok, I have learned a little bit about doing dynamic text. I have an small example here. www.gravemaker.info I was able to take 3 names into the spot from a txt file. Now, is there a way to name each one of the fist like txt1,.....txt26 and then use a for next statement to count down from 26 to 1. So I can copy the variable in txt26 and put it in the dynamic text box. And just go down the line to 1. How would the foumula be for something like that. Would it be like A = txt(t) with t being the for next statement? Probably won't work if it is a direct address. Anyone have any suggestions?
-
I don't know exactly what you want to do but here's a little example that shows how you could use a for loop.
Code:
myData = '1,5,3,6,8,5,3,54,7,12,6,84,34,89,0';
myDataArray = myData.split(',');
createTextField('myTextField',1,0,0,100,50);
myTextField.wordWrap = true;
for (i=10;i>0;i--){
myTextField.text += i + '=' + myDataArray[i] + ' ';
}
-
Originally Posted by w.brants
I don't know exactly what you want to do but here's a little example that shows how you could use a for loop.
Code:
myData = '1,5,3,6,8,5,3,54,7,12,6,84,34,89,0';
myDataArray = myData.split(',');
createTextField('myTextField',1,0,0,100,50);
myTextField.wordWrap = true;
for (i=10;i>0;i--){
myTextField.text += i + '=' + myDataArray[i] + ' ';
}
I guess my data would look something like this.
&txt29=Mark Sloat
&tit29=Lombard, Illinois
&txt28=Joe Smile
&tit28=Chicago, Illinois
Etc....
I have it setup in mine that txt would be setup for html so I can link that to a site.
I guess I was hoping that I could have a var a= 29 or total number of entries and then have a for next statement count down to 1 as it is printing out these variables.
Like txt(t) and tit(t) t being the for next loop.
Can I do it this way?
-
Code:
for (t = 29; t > 0; t--){
myTextField.text += eval('txt'+t) + '\n';
myTextField.text += eval('tit'+t) + '\n';
}
+ '\n' is used to add a newline character.
-
Thank you very much W. Brans. Is there a dwell time I can put in there or some type of wait time?
-
You can use an interval
Code:
tt = 29;
t = tt;
display = function(){
myTextField.text = eval('txt'+t) + '\n';
myTextField.text += eval('tit'+t) + '\n';
t--;
if (!t) t = tt;
}
display();
setInterval(display,2000);
This one uses an interval of 2 seconds.
-
Ok, so I got it to work with the code below, but I tried to put the variable tx=10 into the txt file and relay that information to tt but it didn't work. I think that the code thinks it as ascii, so tt=tx; isn't the way to do it. I guess I need to change tx into a string. How would I do that?
tt = 10;
t = tt;
display = function(){
top = eval('txt'+t) + '\n';
bottom = eval('tit'+t) + '\n';
t--;
hot = t + 1
if (!t) t = tt;
}
display();
setInterval(display,4000);
-
I just wanted to thank everyone for their help. I got it work. I got the variable to work by enclosing it in &....&. It had no problems after that. www.gravemaker.info
Now I just need to be able to switch from reading it from a text file to database. I am able to read all the variables in, I just need to reformat, I guess.
Last edited by msloat; 07-14-2006 at 06:15 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|