I am trying to load variables from a text file, and have them available from then onwards in the movie, globally so to speak.
While I can read the variable values in a loader function which executes when the text file is loaded, I don't seem to be able to keep those variables available afterwards.
I have attached the .fla that I am working on. I understand that it is very basic and does not use class files and so on.... but I am just applying the finishing touches so that it actually works.Inside the quiz movieclip is some code that makes people's names and scores be entered onto the leaderboard. This works perfectly fine, however when I close the SWF and take the quiz again, the people that were previously on the leaderboard have disapeared!Is there anyway to make the best people stay on the leaderboard for future uses?but the code that is in question is:From frame 65 of quiz:
I have an empty SWF that's sole purpose is to call loadMovieNum and start the project. Each loaded movie has a few variables defined within them - unique to those loaded SWFs. Instead of declaring all the variables in each SWF can I declare all of them in one place, in the first frame of the empty loader it all starts from? I'm thinking I can then declare a variable which each loaded movie can increment as needed for me.
I'm writing code that takes data from mysql that's processed by a PHP script. It's actually a bit bizarre, at least to me. Anyway, here's some basic AS3 code that's moving toward what I want to do:
var loader:URLLoader = new URLLoader(); var urlRequest:URLRequest=new URLRequest("receive.php"); urlRequest.method=URLRequestMethod.GET;[code]....
For some reason, the statement "trace(evt.target.data);" produces a whole pile of garbled text before the actual stuff that it's supposed to show Because of problem #1, I've had to include a throwaway variable at the beginning, otherwise the first variable I try to pass into AS3 comes back as undefined. This causes errors when I run my flash movie in the IDE, but when I run it from the browser it doesn't seem to have any effect.But this is the strangest thing of all whenever I make any changes to the database (and subsequently try to load data from different variables), the new variables come back as undefined. For example, let's say that I add another entry to the database, and decide to load students 2, 3, and 4 instead of 1, 2, and 3. When I do that, any new data I've added comes back as undefined, even though when I view the PHP output in my browser, it looks just fine.
And now for the REALLY bizarre part: I'll copy that output, paste it into my PHP script as an echo statement, comment everything else out, and my flash movie runs fine. Even though the output from the PHP script is exactly the same, it gives me errors.
How can I make a bunch of variables from a for loop. for example for (var i=0; i<total; i++) {var bunch(i);}. that i make a bunch of variables named bunch1, bunch2, bunch3. I keep getting errors. I program and use so many different languages that I dont know if that can be done with AS3. my only other alternative i can think of is to create some sort of event dispatcher object array. but I dont know how to get them all to send events to one listener with there index number.
I have a list of strings that I add to an array, then attempt to set those values in a for-loop using data that I read in. The array gets updated, but the values the array contains do not. I also have an array of buttons that I update this same way that works great, but strings don't seem to work the same way. I have tried moving the string array to give it full scope, and still nothing...
public class test extends Sprite { // Declare a list of strings protected var title0:String = undefined;
There is a bird, and you control its upwards movement with a key. It has thrust, gravity, it works fine. The problem is I have a bunch of icicles that come at the bird that he is supposed to avoid. I tried this first with math random to use as an x coordinate and than move across the screen, but the icicles had the same x-coordinates sometimes. I tried does not equal(!=) but that doesn't work. I made an array and each number that came out of the array I assigned a different variable. This works fine. I put this variable into the x-coordinate such as mc.x=((n)*60)+480. I did this for five different icicles. All their differnt variables have a different value, and I put them into the same function for each individual video clip, but they still don't go to the right coordinate. Here is the test code just for the initial coordinate of each icicle before it moves...////////////////////////////Quote:
var temp:Array = new Array() for (var i:int=0;i<8;i++) { temp.push(i);
pictures2.php is working cos I just check so by rite the variables loaded should change.. but somehow each time I check those variables in myPictures.onLoad, the variables are always the same.
I'm trying to figure out which is more efficient in terms of memory and speed. What I'm doing is having a series of messages loaded to the screen. Is it just faster to write them in string variable or in an XML document which is more versatile in terms of editing and adding on to the document.
iam trying to append 3 variables to a url that already has 2 variables appended .. iam using the LoadVars -> "send" method but it wont work. it works if i use a url like "form.aspx" but it wont work if i use "form.aspx?var=nun" which is what i need so i can append 3 more variables to that URL.
I am loading variables from a txt file. After loading in Flash, the format of the variables is weird.
My text file looks something like this:
var1=15&var2=10&var3=this is a test&var4=etc
It has been created in notepad.
When I load the variables with the command loadVariablesNum("variables.txt",0); there is a problem with var1 and var2. These are not considered as integers but as text and have the values "15" instead of 15 and "10" instead of 10.
i added a text field and change it property to dynamic and set variable as "x".and then a added a new text filed and change it's property as input text and set variable as "x".and i need to print this "i love you + variable (x) + i miss you" ?
I followed the PHP MYSQL Flash Tutorial and I got it to work with ASP, I wanted to know is there a way in Flash to loadVariables for the entire movie.Example: Instead of this On Every Movie Clip:
I'm trying to load in a variable value from an xml file.
i want to turn the visibility of a button clip on or off from within my loaded XML code. i know that my xml is loading and working correctly. in my XML file, i have visible="true" set up as an attribute to one of my nodes. what do i need to do to get[url]...
an external file on my website that I can edit with a text editor.I am making a flash intro to a website that has a pull-down panelthat displays information on new content on the website. It has twovariables in the main actionscript 3 code:
var gotoUrl:URLRequest = new URLRequest(" http://www.website.tld/newcontenturl") var whatsnewText:String = "There is something new on this
I am working on a project that involves loading PHP variables into a Flash App. I need the content in the App to update consistently without the user needing to refresh the page.All the examples I found for bringing PHP variables into AS3 work at the beginning of the script and I need something that could run every 12 frames for example.Here is the code that I was working with currently:
Class File (Main.as) package { import flash.display.MovieClip;
In the constructor, is there a way to force load variables. Essentially, I have a list of variables set through the component inspector. I would like to load these variables from the constructor. Currently, the variables are null when the constructor runs.
I have a flash page flipping book that I bought at activeden. It uses an XML file to load in the images of the book to flip through. I have created a PHP file that takes an event ID and creates a custom XML file for flash. How do I have flash load an xml file like this? Instead of passing:
_xmlLoader.loadXml("setup.xml");
I would like to pass:
_xmlLoader.loadXml("setup.php?id=" + eid);
That code doesn't seem to be working for me though.
I have a simple flash form I put together (can be viewed at [url]... I have 4 input text boxes (name1, email, phone, and message1). Frame 1 is the form, frame 2 is the success message, and frame 3 is the message failed frame. The submit button has the following ActionScript attached to it [code]...
What I'm trying to do is, create a button in Flash, with a dynamic text box, where I name the first one "botao1", the second one "botao2" and so on.
I managed to get the text I wanted into the text box by using an external text file (notepad) with the following code:
Code: menu1=Text whereas "Texto" would be the text appearing inside that dynamic text box.
I also managed to do the same in an ASP page using the following code:
Code: response.Write(&menu1=Texto
whereas "Texto" would also be the text appearing inside the dynamic text boss, and it worked this way.
Now, what I'm trying to do is the following:
I have a webpage with a menu in the Header. I have the menus in a database and I'd like my Flash to access that database and write the all the menu names inside the dynamic text boxes.
My code in Flash is this:
Code: myData = new LoadVars(); myData.onLoad = function() { botao1.html=true;
I need to retrieve data from a text file, sort it with a new added score, and then turn the whole data back into a string and save it back into the text file.
I have worked on mini .swf files and php files, and I can seperately:
- retrieve data from a text file to Flash
- do the sorting in Flash from a string coming from a text file
- send a string to a php file and save it on a text file
But I cannot seem to do the three at the same time! Here is my [code]...
_root.loadvars = new LoadVars(); _root.mainoslataus.onLoad = function(succes) {[code]...........
The problem is that I want to use it at the preloader frame, and display it same time when flash file is loading. But it won't work, it loads when the file has fully loaded, and then its too late.I know that I could use another swf to load this swf and display it then, but its not what I want.
I am developing a flash board game which entails moving a piece around a board as a result of throwing a dice (the person will either move the dice themselves or it will move according to the outcome of the throw). When they land on particular squares I am going to have a random question (this is going to be a loaded SWF) appear that will have a multiple choice questions.Can I save the result of 'multiple choice question' within the main movie / separate movie and then use this variable ?
I have the same button several times in a loaded swf. On release, I want this buttons to attach a "mcextra" into target x This mcextra moves on vertical position and shows inside a jpeg. How can I use the same code to all the buttons so I can attach the mcextra and load diferent jpeg images? I guess I`ll have to set a variable calling the jpeg, isn`t?
I know Flash applications cannot store data locally for security reasons, however, Macromedia has addressed this issue:
[URL]
But I don't understand that at all...
So, probably using what that link says, what's the best (easiest on the user) way to store data to a consenting user's computer? I don't mind if it has a prompt for permission, but it should not rely on too much software that nobody has (java and shockwave seem ok). The goal would be to store data across sessions, so that it would remain available if one returned to the application after closing it and going offline.
This would be useful for saving a character's HP, experience, and location variables in a game for example... possibly ending up with a .txt file that looks like:
name: Aesir level: 2 exp: 50 zone: Cave of the Poo x coordinate: 10 y coordinate: 30 gold: 5