Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Data Integration / April 2006



Tip: Looking for answers? Try searching our database.

Problem receiving info from database via PHP to Flash dynamic text fields

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Julius Maximus - 19 Apr 2006 17:30 GMT
Hello, I'm having trouble receiving text informations in Flash 8 from a MySQL
database via PHP: I have a text field in my Flash animation that's supposed to
display a text with french accents but it doesn't display them correctly.

- the PHP file comes from Dreamweaver.
- I have already embedded all the possible fonts.
- I've already tested all kinds of anti-alias.
- I've searched for hours on this site to find an answer but nothing relates
to receiving variables from PHP.

...don't  know where to search anymore. Can any one help please?

// Julle
CWSMultiMedia - 19 Apr 2006 20:41 GMT
Are you seeing the data in flash through a trace();  ?
if yes, make sure the text field's height is tall enough, set as dynamic text
and give it a label, also when flash receives the data use the text fields
label.text = yourVar;
if no, then check you php, should echo $yourvar to flash which should be
waiting for the data if you used sendAndLoad().
Really need to see more to help.
Motion Maker - 19 Apr 2006 22:06 GMT
In addition to CWSMultiMedia suggesting some trace statement, I might start
without the PHP to see if Flash can display what you want. Then if it can,
the next focus is on that data communication if something is not being
transmitted to Flash.

Signature

Lon Hosford
www.lonhosford.com
May many happy bits flow your way!

Are you seeing the data in flash through a trace();  ?
if yes, make sure the text field's height is tall enough, set as dynamic
text
and give it a label, also when flash receives the data use the text fields
label.text = yourVar;
if no, then check you php, should echo $yourvar to flash which should be
waiting for the data if you used sendAndLoad().
Really need to see more to help.
Julius Maximus - 20 Apr 2006 13:11 GMT
Thanx for the quick answer!

Yep, I receive the data perfectly - everything works fine with those text
fields besides the accents. Here's an extract of my ActionScript for you to see
how it works:

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
myData = new LoadVars();
myData.load("php/galleries.php?year=" + _root.galleryYear);
myData.ref = this;
myData.onLoad = function(success) {
    if (success) {
        _root.rowNumber = (this - 1);
        for (i = 0; i <= _root.rowNumber; i++) {
            scrollKit.scrolled.attachMovie("galleryClip", "galleryClip" + i, i);
            scrollKit.scrolled.galleryTitleVar.text = this;
            scrollKit.scrolled.galleryTextVar.text = this;
        }
    }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -

"this" + the variables refer to my "galleries.php" file. An extract from this
file's PHP code:

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
<?php

$connection = mysql_connect("localhost", "username", "password");
mysql_select_db("database", $connection);   

$request = mysql_query("SELECT * FROM galleries WHERE g_year = '$_REQUEST'
ORDER BY g_id DESC");
$rowNumber = mysql_num_rows($request);
$current = 0;

while ($row = mysql_fetch_array($request)) {
    echo
"rowNumber=$rowNumber&g_id$current=$row&g_name$current=$row&g_title$current=$row
&g_date$current=$row&g_year$current=$row&g_text$current=$row&g_image$current=$ro
w&";
    $current++;
}

echo "current=$current";

?>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -

...should I place the variables somewhere else before they arrive to my Flash
animation?..

Anyway, I guess it must be a problem of text formatting because otherwise this
code works just fine. I also consider that the problem comes from Flash alone
because I previously used this exact same PHP code within a HTML webpage (same
type of picture gallery) and I didn't experience any accent problem. Thanx
again for your help,

// Julle
Motion Maker - 20 Apr 2006 15:22 GMT
 scrollKit.scrolled.galleryTitleVar.text = this;
 scrollKit.scrolled.galleryTextVar.text = this;

1. Perhaps I am not following this.
Is it this.g_title and this.g_text ?

2. Does trace show the accents?
trace (this) or trace (this.g_title) and trace (this.g_text)

3. Are you including all characters in the TextField if you selected to
embed fonts? French characters may need to be embedded.

4. Does the Font allow those types of characters?

Signature

Lon Hosford
www.lonhosford.com
May many happy bits flow your way!

Thanx for the quick answer!

Yep, I receive the data perfectly - everything works fine with those text
fields besides the accents. Here's an extract of my ActionScript for you to
see
how it works:

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- -
- - -
myData = new LoadVars();
myData.load("php/galleries.php?year=" + _root.galleryYear);
myData.ref = this;
myData.onLoad = function(success) {
 if (success) {
 _root.rowNumber = (this - 1);
 for (i = 0; i <= _root.rowNumber; i++) {
 scrollKit.scrolled.attachMovie("galleryClip", "galleryClip" + i, i);
 scrollKit.scrolled.galleryTitleVar.text = this;
 scrollKit.scrolled.galleryTextVar.text = this;
 }
 }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- -
- - -

"this" + the variables refer to my "galleries.php" file. An extract from
this
file's PHP code:

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- -
- - -
<?php

$connection = mysql_connect("localhost", "username", "password");
mysql_select_db("database", $connection);

$request = mysql_query("SELECT * FROM galleries WHERE g_year = '$_REQUEST'
ORDER BY g_id DESC");
$rowNumber = mysql_num_rows($request);
$current = 0;

while ($row = mysql_fetch_array($request)) {
 echo
"rowNumber=$rowNumber&g_id$current=$row&g_name$current=$row&g_title$current=$row
&g_date$current=$row&g_year$current=$row&g_text$current=$row&g_image$current=$ro
w&";
 $current++;
}

echo "current=$current";

?>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- -
- - -

...should I place the variables somewhere else before they arrive to my
Flash
animation?..

Anyway, I guess it must be a problem of text formatting because otherwise
this
code works just fine. I also consider that the problem comes from Flash
alone
because I previously used this exact same PHP code within a HTML webpage
(same
type of picture gallery) and I didn't experience any accent problem. Thanx
again for your help,

// Julle
Julius Maximus - 21 Apr 2006 09:35 GMT
1. Perhaps I am not following this.
Is it this.g_title and this.g_text ?

>> They're variables taken from the results of the PHP file:
g_title$current=$row and g_text$current=$row

2. Does trace show the accents?
trace (this) or trace (this.g_title) and trace (this.g_text)

>> Can't use trace since the datas coming from the database cannot be shown
when exporting the swf locally.

3. Are you including all characters in the TextField if you selected to
embed fonts? French characters may need to be embedded.

>> Yep, I even try to include them all... Doesn't work.

4. Does the Font allow those types of characters?

>> The font I use is the mighty Helvetica ;-) so, yes, it contains all the
characters of the world! H?h, don't know what to do...
Motion Maker - 21 Apr 2006 14:50 GMT
It seems to me either they are not getting to Flash or if they are, the
TextField is not configured to show them.

Other than the usual debugging isolation techniques I suggested, the last of
which is to be sure you are receiving urlencoded data with the characters
you need using a trace statement, you may want to try the Flash General
forum for a question on how to display the characters you want in a
TextField.

>> Can't use trace since the datas coming from the database cannot be shown
when exporting the swf locally.

Do you have a local server with the database set up for testing?

If you do then you should be able to access the database with Test->Movie. I
do it all the time and have different lines in the app's configuration
server script depending on where they are located to have the correct
access.

Signature

Lon Hosford
www.lonhosford.com
May many happy bits flow your way!

1. Perhaps I am not following this.
Is it this.g_title and this.g_text ?

>> They're variables taken from the results of the PHP file:
g_title$current=$row and g_text$current=$row

2. Does trace show the accents?
trace (this) or trace (this.g_title) and trace (this.g_text)

>> Can't use trace since the datas coming from the database cannot be shown
when exporting the swf locally.

3. Are you including all characters in the TextField if you selected to
embed fonts? French characters may need to be embedded.

>> Yep, I even try to include them all... Doesn't work.

4. Does the Font allow those types of characters?

>> The font I use is the mighty Helvetica ;-) so, yes, it contains all the
characters of the world! H?h, don't know what to do...
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.