This is a discussion on "LoadVariables from text file into Actionscript." within the Flash & Multimedia Forum section. This forum, and the thread "LoadVariables from text file into Actionscript. are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
LoadVariables from text file into Actionscript.
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Im loading variables in from a text file which looks like this...
variable1=hello&bigimage=main-graphic.jpg&title01=rebrand This works fine, I can add a variable to a dynamic text field by adding _root.variable1 ...... in the textfields' Properties Var: field. However I want to use variables in ActionScript as a normal variable. i have tried this...
|
|
|
|
#2
|
|||
|
|||
|
Re: LoadVariables from text file into Actionscript.
I write a tutorial about loading links from an external text file :
http://blog.datisdesign.com/2008/02/...file-in-flash/ maybe this can help you If it didnt please attach your fla file...
__________________
Last Blog Entry: Throughout IRAN (Dec 10th, 2007)
|
|
#3
|
|||
|
|||
|
Re: LoadVariables from text file into Actionscript.
Tried the method in your Tutorial and it gave the same outcome.
I have attached a flash movie with both methods, and text.txt file containing the variables. trace(_root.varTwo) comes back as undefined, but the value appears in a dynamic text field, therefore the variables are loading in ok, just not usable in code. I want to use the variables in actionscript because..... you may notice varTwo=filename.jpg ........ I want to reference filenames in the actionscript so i can load external images dynamically without hardcoding them into flash. |
|
#4
|
|||
|
|||
|
Re: LoadVariables from text file into Actionscript.
The reason for that is the variable you are calling is inside function scope and available only in function scope, not outside that, so you get undefined when you call it
__________________
Last Blog Entry: Throughout IRAN (Dec 10th, 2007)
|
|
#5
|
|||
|
|||
|
Re: LoadVariables from text file into Actionscript.
So do I need to load the variables and call them from inside the same function?
|
|
#6
|
|||
|
|||
|
Re: LoadVariables from text file into Actionscript.
It traces undefined because trace will run before the function is called, one way is to add another frame to your timeline and there trace your variable and you will get the result.
__________________
Last Blog Entry: Throughout IRAN (Dec 10th, 2007)
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Grabbing text from a file | schmoose | JavaScript Forum | 2 | Apr 6th, 2008 16:16 |
| Creating a log file (text file) and an XML file using XSL | kdelacruz | Other Programming Languages | 1 | Nov 4th, 2006 21:12 |
| Writing to a text file | Gurpreet82 | Classic ASP | 0 | Mar 15th, 2006 15:57 |
| Text file download | harlekin | Classic ASP | 2 | Dec 5th, 2005 18:23 |
| _root.loadVariables | burbie | Flash & Multimedia Forum | 1 | Nov 28th, 2005 10:03 |