I’ve been working on saving variables to an SQL database (through PHP) and then passing them back into Flash, and its working exactly the way it should at the moment. It’s set up so that when you click a “save” button, it saves the vars and then reloads them right away.
I need to set it up so in addition to doing this, it will load all the data when the page refreshes (essentially, the second part of the code show below). I’m just not sure what to change and/or add to make it work. Any help would be great - thanks!!!
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#000000]**function**[/COLOR] saveIt[COLOR=#000000]([/COLOR][COLOR=#0000FF]e[/COLOR]:MouseEvent[COLOR=#000000])[/COLOR]:[COLOR=#0000FF]void[/COLOR]
[COLOR=#000000]{[/COLOR]
[COLOR=#000000]var[/COLOR] request:URLRequest = [COLOR=#000000]new[/COLOR] URLRequest COLOR=#000000[/COLOR];
request.[COLOR=#000080]method[/COLOR] = URLRequestMethod.[COLOR=#000080]POST[/COLOR];
[COLOR=#000000]var[/COLOR] variables:URLVariables = [COLOR=#000000]new[/COLOR] URLVariablesCOLOR=#000000[/COLOR];
variables.[COLOR=#000080]tName1[/COLOR] = test1.[COLOR=#0000FF]text[/COLOR];
variables.[COLOR=#000080]tName2[/COLOR] = test2.[COLOR=#0000FF]text[/COLOR];
variables.[COLOR=#000080]tName3[/COLOR] = test3.[COLOR=#0000FF]text[/COLOR];
request.[COLOR=#0000FF]data[/COLOR] = variables;
[COLOR=#000000]var[/COLOR] loader:URLLoader = [COLOR=#000000]new[/COLOR] URLLoader COLOR=#000000[/COLOR];
loader.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]Event.[COLOR=#000080]COMPLETE[/COLOR], onComplete[COLOR=#000000])[/COLOR];
loader.[COLOR=#000080]dataFormat[/COLOR] = URLLoaderDataFormat.[COLOR=#000080]VARIABLES[/COLOR];
loader.[COLOR=#0000FF]load[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]function[/COLOR] onComplete COLOR=#000000[/COLOR]:[COLOR=#0000FF]void[/COLOR]
[COLOR=#000000]{[/COLOR]
[COLOR=#000000]var[/COLOR] variables:URLVariables = [COLOR=#000000]new[/COLOR] URLVariables[COLOR=#000000]([/COLOR] event.[COLOR=#0000FF]target[/COLOR].[COLOR=#0000FF]data[/COLOR] [COLOR=#000000])[/COLOR];
test1.[COLOR=#0000FF]text[/COLOR] = variables.[COLOR=#000080]tName1[/COLOR];
test2.[COLOR=#0000FF]text[/COLOR] = variables.[COLOR=#000080]tName2[/COLOR];
test3.[COLOR=#0000FF]text[/COLOR] = variables.[COLOR=#000080]tName3[/COLOR];
[COLOR=#000000]}[/COLOR]
[/LEFT]
[/FONT]