PDA

View Full Version : Flash - Get PHP data problem.. +rep



Blinger1
06-11-2008, 12:34 AM
Hello everyone.

I have an annoying problem with Flash.
I want to get the data from a PHP page (which collects data from a MySQL database). That part works alright for what is needed.

http://freyta.net/mysql/hot.php?name=shane is the link to the data.

Now I load my data data using

onClipEvent (load) {
i = new LoadVars();
i.load("http://freyta.net/mysql/hot.php?name=shane", this, "GET");
}

which recieves the data "127="...

How do I get rid of that equals sign :S


Sorry for the really dumb question

Rapidshare
06-11-2008, 12:40 AM
It works?

Blinger1
06-11-2008, 12:41 AM
No, it has the stupid equals sign...
I can't just load the data "127"... (it works fine on the webpage but when i load it into flash it adds the = sign)

Yonder
06-11-2008, 09:31 AM
show the flash page.. please and your php source.

Blinger1
06-11-2008, 10:06 AM
http://freyta.net/mysql/hot.phps
http://freyta.net/mysql/gayz.fla

(its the little square box with all the code for the fla ;))

edit:

Maybe it is just my PC but it wants to download the phps

Here is the code in the spoiler

<?php
include 'sqlConnection.php';
$test = $_GET[name];

$getuser = mysql_query("SELECT * FROM name WHERE name = '$test'");


while ($user = mysql_fetch_array($getuser)){


//echo ("name=$user[name]");
echo ("$user[hot]");
}
?>

L?KE
06-11-2008, 06:23 PM
To be sure you could shortern the string to three in flash (duno how) or in php:




$user = $user[hot];
$user = substr($user,0,-1);



Edited by ,Jess, (Forum Super Moderator): Double posts merged due to lag.

Protege
06-11-2008, 06:58 PM
If I remember correctly, flash can read data like this:


&name=that
&this=poop

This is loading data using LoadVars

ActionScript:


data = new LoadVars();
data.load( "http://www.disasterpiece.co.uk/flashData.php" );
data.onLoad = function( success )
{
if( success )
{
trace( data.myMessage );
}
}


Returns
"Joygasmic blowjob"

The PHP page if you're interested whats on it (doesn't have to be a php page, can be a html/text/etc page)

Live content:
"&myMessage=Joygasmic blowjob"

PHP code:

<?php
// Using PHP just to explain
$variable = 'Joygasmic blowjob';
echo '&myMessage=' . $variable;
?>


Hope this helped.

Blinger1
06-11-2008, 11:45 PM
Okay that worked :)! (it got the variable properlly)

But, now my rotation won't work :S?


onClipEvent (load) {
data = new LoadVars();
data.load("http://www.freyta.net/flashData.php");
data.onLoad = function(success) {
i = data.myMessage;
if (success) {
trace(i);
if (_root.mcobj._rotation<tobe) {
_root.mcobj._rotation++;
}
}
};
}

Why doesn't that work?

This is really stupid :eusa_wall

Protege
07-11-2008, 10:24 AM
I dont understand what you are trying to do, explain more and I can help you.

Blinger1
07-11-2008, 10:27 AM
Okay...

Here is my idea.
I want to make an application called the 'hot-o-dometer'. Its like a speedometer but instead of saying mph or kmph, it tells you how 'hot' you are..

How it works:
I get a variable (which we called myMessage) from a remote location, and then dial turns that many degrees to point to how 'hot' you are..


Does that make sense?

Protege
07-11-2008, 10:28 AM
Im guessing you want it to be a smooth rotation yeah?

If its this case, Id do the animation via movie clips (not AS as its a ****) then when it returns a value use a case to switch animations of how "hot they are"

Though you will have set "Hotness" say, 1 2 3 4 5 6 7 8 9 10

Blinger1
07-11-2008, 10:30 AM
Preferably. That is why I had the code



var tobe // This is how hot the person is
if(mcobj._rotation<tobe){
mcobj._rotion++;
}



edit: Okay!

Thats not a bad idea actually ;).

I just thought AS would be quicker - heh!

Protege
07-11-2008, 10:32 AM
add me on msn, [email protected] and we'll chat more there.

Want to hide these adverts? Register an account for free!