ActionScript 2.0 :: Loading Variable From External File?
Oct 24, 2003
i have this code:
var loadText = new loadVars();
loadText.onLoad = function(success) {
if (success) {
myVar = this.myVar;
[code].....
to load an external variable to load one movie, on the data.txt I have myVar=video1 my problem is that he is not loading video1.swf to container mc, but the trace to the cvariable name is correct
I have this code: var loadText = new loadVars(); loadText.onLoad = function(success) { if (success) { myVar = this.myVar; [Code] ..... To load an external variable to load one movie, on the data.txt I have myVar=video1. My problem is that It is not loading video1.swf to container mc, but the trace to the variable name is correct.
I'm having trouble with this script. I have an external text file, from which all of the text on the page is loaded. I also have a series of thumbnails, but I need to have different numbers on each page, so I figured I'd put the number of thumbnails into the text file too and then run a loop to create the thumbnails and buttons dynamically. The loop works fine, until I try to use the value I have loaded from the text file. I think it is something to do with it being in a separate function, but I have tried making it _global.counter, I have tried putting the whole for() loop inside the myData.onLoad function. Basically, I have tried everything I can think of and still the loop does not run when the counter value is specified externally.
I am trying to load an external variable text file into a movie but it is returning compiler errors. Please suggest a solution. The source code is ......
var myTextLoader:URLLoader = new URLLoader(); myTextLoader.DataFormat=URLLoaderDataFormat.VARIAB LES; myTextLoader.addEventListener(Event.COMPLETE, onLoaded);
[code]....
The external file is "gxcvrt.txt" while name, slogan, rep, button1-7 are the variables to be loaded.The compiler returns the following errors (highlighted in red)
Line 4 '{' expected Source = function onLoaded(e:Event) :void {
I have a movie player that works fine when i hard-code the url value in the video function, but when i try to pass that url/file path from an external file, the video doesn't load. I suspect that there is something i'm doing wrong with the quotes. What am i doing wrong?
I'm working on a project that involves pulling a number from a text file on a remote server. I am familiar with the intricacies of loadVars and loadVariables, but in this particular case, the text file only contains a number. It is not preceeded by a variable name or anything like that. It is just: 40. Is there a way to pull this into flash without a variable name so I can display it in a dynamic text field?
I'm working on a project that involves pulling a number from a text file on a remote server. I am familiar with the intricacies of loadVars and loadVariables, but in this particular case, the text file only contains a number. It is not preceeded by a variable name or anything like that. It is just: 40. Is there a way to pull this into flash without a variable name so I can display it in a dynamic text field?
spot the error here that is giving me a TypeError: Error #2007: Parameter text must be non-null.The text field captions are in a file named captions.txt in the same root folder.
Code: var myURLLoader:URLLoader = new URLLoader(); var myURLRequest:URLRequest = new URLRequest("captions_tuesday.txt");
Trying to augment the Kirupa tutorial "ActionScript Text Animation" [URL] to take an external text file. When I switch out the line: text = "There is only one..." with: myLoadVar = new LoadVars (); myLoadVar.load("davetextdoc.txt") myLoadVar.onLoad = function (success){ if (success == true) { output.variable = "text" output.text=myLoadVar.text; }} I get the word "undefined" repeatedly loading itself. The text file is properly formatted (text=dave's text here...) I've tried untold permutations to self-solve.
I'm using LoadVars to load an external file that has one variable containing an array with a few sub arrays. Code: var externalData:LoadVars = new LoadVars(); externalData.onLoad = function() { var sectArray:Array = externalData.sectArray; }; externalData.load("portfolio.txt"); But every time I try to get one of the values I get "undefined". is there another way?
right now i'm just trying to trace each image name and it's height through the for loop, but what i would like to do is stack each image, 1 following the other.
when i run the trace, the output repeats just the last images name and image height. There is something wrong in my loop, right? Also i should mention that each image has a different height dimension.
I'm loading a filepath variable from a php script that simply returns something like [URL] This works fine, apart from the last bit which reads the text file where it throws an error: Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: file: However it works fine if I replace the variable with the actual filepath loadit.load(new URLRequest(filename)); to loadit.load(new URLRequest(C:/wamp/www/text/o/blah.txt);
figuring out my problem other than my lack of knowledge in action scripting? My issue is I am trying to load a variable from a text file, I am able to load the variable with in the function but I cannot for the life of me figure out how to get it out of the function.
Im running AS2 on Flash CS4 for this: I've found a million posts on similar topics, but none seem to do what I want, even though I feel like its very simple. I've tried a ton of different codes and can't get anything to work. All I want is for Flash to pull a number variable from an external file, lets just say a txt for now. I then want to be able to use this variable for calculations within flash. The only thing I can get to semi-work is having a txt file that says MyNum=5 and then putting the following in flash: loadVariables("Test.txt" , _root);
If I trace the variable "MyNum" it will output the right value, but its as a string no matter what I do. My most recent attempt to get it to be a number is to put the following on a later frame:
var NewVar:Number = MyNum; var NewVar2:Number = NewVar + 1 trace(NewVar2);
Despite hardcoding multiple variables to be numbers, the output I get is 51, which means its still displaying as a string. My other issue is that you have to wait several frames before the variable is recognized. Do you have to wait numerous frames to use these loaded variables? If so, is there a way I can code it so that flash will just wait until it has the variable before moving on? I can't seem to get any loading function to work for it, but I don't just want to pull my next action down the timeline some arbitrary number of frames and hope its enough for flash to pull that number from the file.
I have an external SWF file that is a dynamic chart. It normally requires (in the object and embed tags on the HTML page) a variable passed to it that points to an XML file.
What I want to do, is create a "container" program that simply has a few buttons, that when clicked load up that same chart.swf and point it to a different XML file.
What I can't figure out is how to get that external file to recognize it's dataURL parameter that it normally receives off the html tags. (BTW, I can't edit that chart.swf, it's a purchased product.) I tried setting a root variable of the same name in my container to point to a new XML file, but that doesn't work. I tried setting that variable, and using loadMovie with a GET to pass it the name, but that just looks for a string that flash seems to be interpreting literally, so it can't locate the file at all (I.e. it's looking for the literal name "chart.swf?dataURL=datafile.xml")
I have an external SWF file that is a dynamic chart. It normally requires (in the object and embed tags on the HTML page) a variable passed to it that points to an XML file.What I want to do, is create a "container" program that simply has a few buttons, that when clicked load up that same chart.swf and point it to a different XML file.What I can't figure out is how to get that external file to recognize it's dataURL parameter that it normally receives off the html tags. (BTW, I can't edit that chart.swf, it's a purchased product.) I tried setting a root variable of the same name in my container to point to a new XML file, but that doesn't work. I tried setting that variable, and using loadMovie with a GET to pass it the name, but that just looks for a string that flash seems to be interpreting literally, so it can't locate the file at all (I.e. it's looking for the literal name "chart.swf
From all the documentation and examples I can find, it appears that it would be correct to create a global array variable [outside of any functions] to load image names into, then use these images for a slideshow. I want to make the app dynamic, in that changing the text file gives a new set of images.
The global variable goes null [no values] after the load event listener. Why is that?
Isn't global, well global, and alive for the duration of the SWF?
I have one fla called index.swf it import another swf called (home.swf) through addChild()In home.swf, there is a button.i am trying to make this button activate an event in index.swf I tried using root but not worked I tried use stage but neither worked.
probably a hugely embarrassing beginner question, but I can't seem to find an answer anywhere. I think it's probably (hopefully?) just a syntax problem I'm loading the content of a dynamic text box from an external .txt file and I'm trying to find a way to change the content from a link in the .txt file (if that makes sense). The code I'm using to change the dynamic text box at the moment is:
for example i have 2 movie clip, clip1 and clip2, and i want to play one of them, which defined in a external txt file variable like this:&c=1& or &c=2&my problem is, i have just one frame to make this!i tride to make simple my question, it's a bigger project!there is more than 2 movies and can't use if(), i just want to change the number of end of movie clip instans name some thing like this:
ActionScript Code: clipname= "clip" var trc = new loadVars()
loadVariablesNum("produkter.txt", 0); import TextField.StyleSheet; var myCSS:StyleSheet = new StyleSheet();
[Code]....
and a dynamic textbox called "myHTML". If I name 'var' on this textbox everything works fine, but I want to write it in actionsscript instead. Where do I write that? (I have 3 different vars in the text-file)
I'd like to load external .swf file after clicking a button, so the new file replaces current one which is pretty much the same but in different language. Here is the file http:[url].... I'd like the little red&white button to do the work.I though this code would do the job, but something is missing here:
FlagPL_btn.addEventListener(MouseEvent.CLICK, webEng);function webEng(event:MouseEvent):void{windowLoader.source="AyeAyeMedia FOTO VIDEO AUDIO