Hello all!
I’m a new member and surprise surprise Iam struggling with the following problem.
Thanks in advance for any help.
I have a php file (select.php) that retrieves data from the MySQL database.
When I load the ‘select.php’ it shows the result as expected.
This means my problem is not in PHP but in Flash!
In Flash MX2004, I got the following code on frame 2
- stop();
myData = new LoadVars();
myData.onLoad = function(succes) {
if (succes) {
trace(myData);
//these buttons were made invisible in the first frame.
bt_0._visible=1;
bt_1._visible=1;
} else {
trace(“Error loading data”);
}
};
myData.load(“http://localhost/select.php”);*
When Flash recieves it through ‘loadVars’ it activates the ‘trace(myData)’ function and ouputs as follows:
- selected%5Fdata=5%0D%0A%0D%0A%0D%0A%0D%0A&image%5Ffile4
=Pic%5FFour&content4=Content%5FFour&title4=Title%5FFour&image%5
Ffile3=Pic%5FThree&content3=Content%5FThree&title3=Title%5FThree&
image%5Ffile2=Pic%5FTwo&content2=Content%5FTwo&title2=Title%5FTwo
&image%5Ffile1=Pic%5Fone&content1=Content%5FOne&title1=Title%5FOne
&image%5Ffile0=Pic%5Fzero&content0=Content%5FZero&%0D%0A%0D%0A
[COLOR=Red]title0=Title%5FZero[/COLOR]&onLoad=%5Btype%20Function%5D*
‘[COLOR=Red]title0=Title%5FZero[/COLOR]’ red to highlight the problem variable.
The above traced result shows that all the variables are loaded into Flash.
So the problem is not there either!
But whenever I access it later, whether through a button event or another trace function the first variable ([COLOR=Red]title0=Title%5FZero[/COLOR]) shows as ‘undefined’.
All other variables are available and works fine.
But ‘[COLOR=Red]title0[/COLOR]’ was just traced as '[COLOR=Red]Title%5FZero’[/COLOR] in the *‘myData.onLoad’ *function!
Now it shows as ‘undefined’!!
So the problem lies in the first variable only. But how? I couldn’t find an explanation within my limited actionscript knowledge.
I did a lot of search on web and in books, but all in vain!
I use the code below to access the variables.
- function show_me (me) {
title_txt.text = myData[“title”+me];
content_txt.text = myData[“content”+me];
image_txt.text=myData[“image_file”+me];
}*
Button code on ‘bt_0’ and ‘bt_1’ respectively -
- on(release){
show_me (0);
}
on(release){
show_me (1);
}*
Any help will be highly appreciated.
Thanks
And Iam still curious!