PDA

View Full Version : <!--#include file="TextFile.txt" -->


DenShinobi
02-02-2003, 07:10 PM
HEy ALL! :)

I want to include the contents of an external text file into a dynamic text box (with a scroller component added on to it)

where do i begin?

the simpler the better :)

can i use HTML tags in the txt file to format in flash's dynamic text box?

the sort of thing i'm looking for is similar to the SSI text below if that makes sense :)

<!--#include file="TextFile.txt" -->

thanks in advance for advice :) :) :)

CyanBlue
02-02-2003, 08:57 PM
Howdy... :)

Loading a content of an external text file into the Flash is fairly easy and simple... You could use HTML tags to set the attributes of the texts inside of the external text file, but there are limits on what tags you can use in Flash... Flash suppports HTML 1.1 tags...

You might want to look up 'LoadVars' object if you are using FMX and 'loadVariables' function if you use F5...

Let us know if you have further questions... :)

DenShinobi
02-02-2003, 09:04 PM
thanks for the advice :)

i'll look into the loadvars object now - any good reading on the web anywhere off the top??

i'm only wanting to use some simple formatting tags such as <B> so that shouldn't be a problem!

excellent stuff - CHEERS

CyanBlue
02-02-2003, 10:03 PM
This tutorial from AS.org is a good place to start about the loadVariables and LoadVars in Flash... (Stick to LoadVars() object if possible...)
http://www.actionscript.org/tutorials/beginner/loadVariables_and_loadVars/index.shtml

This article from the Macromedia goes a little bit deep into the use of LoadVars() object, but it is worth to take a look...
http://www.macromedia.com/desdev/mx/flash/articles/flashmx_php.html

This is the list of the HTML tags that you can you for the Flash...
http://www.macromedia.com/support/flash/ts/documents/htmltext.htm

I guess this should be enough for you to start... Let us know if you have any question... :)

DenShinobi
02-03-2003, 09:39 AM
thanks for these CyanBlue

i'll be on my way to read up about it right now :)

DenShinobi
02-03-2003, 10:38 AM
ok,

holder.loadVariables("file.txt");

i got this bit down.....

but i can't for the life of me work out how to get the loaded text into the dynamic text box with the scroller??

i am sorry for being thick :)

DenShinobi
02-03-2003, 01:20 PM
ok, i worked out how to get the text in (i was being a bit slow on that one - heavy weekend though :)

one problem i'm having is, the first time you look at a page, the scroll bar doesn't function properly, i presume this is because the .txt file hasn't had chance to fully load....

is there a way to preload all the text files early on??

can i load them all into the same level at the start, then just recall them later on???


any ideas?

thanks again.

CyanBlue
02-03-2003, 04:30 PM
Howdy... :)

Glad you got that one working...

Didn't I tell you to stick to LoadVars() object in the beginning if you can??? If you had, you wouldn't have this kind of problem...

To solve that... One way would be preload all your text files in frame 1(or as early as you can) and use the data later on after giving ENOUGH time...

Another way would be using the Flag...
You can add something like this at the end of text file...
loaded=true
and check if that variable loaded is "true" or not... (Remember that all the external data coming from text file or XML file are considered as 'STRING' in Flash...) and create a loop that advances to the next level or stage ONLY WHEN the condition is met... In this case, it would be if (holder.loaded == "true")

The other one would be using the LoadVars() object which will be fairly simple to change from loadVariables function... LoadVars() object has onLoad handler that gets executed only when the data is fully loaded...

So... Work on your magic and let me know if you need further assistance... :)

DenShinobi
02-03-2003, 06:29 PM
ahhh, i should have listened more clearly :)

thanks again for all your help cyan blue ----> really appreciated :)


i think i've got it workin' :) :) :) :) :)

thanks x 10,000,000,000

CyanBlue
02-03-2003, 06:37 PM
Glad that you got it working finally... :D

So... This is the amount that I can charge you???

> thanks x 10,000,000,000

Well... I'll just take the string part out and send you the bill...

Hm... Come to think of it... I ain't got no postage... I'll jus trim the number part and get the thanks... :D

:)