all groups > flash actionscript > october 2006 >
You're in the

flash actionscript

group:

Make a class from a php available in Flash



Make a class from a php available in Flash DANGH_b
10/31/2006 8:39:57 PM
flash actionscript: hello!
i have 2 classes in php:
the first one is "comm.php":
<?php
require ('Inter.php');
//----------------------------------------------------
class comm
{ var $testt;
var $con;


var $v=array();



function test(){
//echo " d ".$this->v[1]->nume ." d ";
$this->testt=$this->testt." asaasa ";
echo $this->testt;

}


function init()
{
$this->con = mysql_connect("localhost","root","");
if (!$this->con) die('Could not connect: ' . mysql_error());

mysql_select_db("auto_babc", $this->con);
$this->v= array(new Inter());

}


function insert($s)
{
$this->vv=new Inter();

$result = mysql_query("SELECT * FROM data");
$row = mysql_fetch_array($result);
//echo $name;
while($row['Feature_str_name']!=$s)
{
$row = mysql_fetch_array($result);

}

$this->vv->xx=$row["x"];
$this->vv->yy=$row["y"];
$this->vv->nume=$row["Feature_str_name"];
// echo " ".$this->v[$i]->name." ";
$this->vv->localname=$row["Feature_str_local_name"];
$this->vv->lat=$row["Feature_dec_lat"];
$this->vv->lon=$row["Feature_dec_lon"];
$this->vv->v1=$row["Feature_int_id"];
$this->vv->v2=$row["Feature_int_variant_of_feature_int_id"];
$this->vv->v3=$row["Admin1_str_code"];
$this->vv->v4=$row["Country_str_code"];
$this->vv->v5=$row["Feature_int_font_code"];
$this->test = "abc";
array_push($this->v, $this->vv);


}

function close()
{
mysql_close($this->con);
}


}




?>

and the second one is inter.php(the php requiered in the first one)
<?php
//echo "dasda:".$_POST["numar"] ."dsadA";

class Inter
{
var $xx=1;
var $yy;
var $nume;
var $lat;
var $lon;
var $v1;
var $v2;
var $v3;
var $v4;
var $v5;
var $localname;

function in(){
$this->yy="please man"}
}
?>

How can i make the class from the comm.php available in flash?
I want to work with the functions in it directly from flash.
Please help.
Thanks in advance




Re: Make a class from a php available in Flash Manno Bult
10/31/2006 10:16:40 PM

No can do really,

The PHP file connects to a database and Flash cannot do that on it's
own. It will need some serverside script to connect.
Even if you only want to connect to the database through PHP, you still
need some serverside PHP to initiate these classes and to function as a
handle for Flash to access these classes.

Or did I misinterpret?

Manno


[quoted text, click to view]

--
----------
Manno Bult
Re: Make a class from a php available in Flash DANGH_b
10/31/2006 11:27:50 PM
I am trying to work with phpobject.
this is the code in flash:
#include "PHPObject.as"

tmp = new PHPObject();
tmp.setDefaultGatewayKey("secret"); // CHANGE THIS TO WHATEVER SECRET KEY YOU
SET IN Gateway.php
tmp.setDefaultGatewayUrl("http://localhost/phpobj/gateway.php"); // CHANGE
THIS TO WHERE YOU PLACE Gateway.php
delete tmp;
Inter = new PHPObject("Inter");
If i want a dynamic text to display Inter.xx (which is declared "xx=1" i get
"[type function]" in the textbox. I tried to publish with action script 2 and i
got an error:
**Error** C:\Documents and Settings\BBluEE\Local Settings\Application
Data\Macromedia\Flash 8\en\Configuration\Include\PHPSerializer.as: Line 136:
The property being referenced does not have the static attribute.
if (v[a].__proto__ != Function.prototype)
if i publish it with actionscript 1 i get [type function] instead of the
variable

Total ActionScript Errors: 1 Reported Errors: 1


Do you know where the problem might be?
AddThis Social Bookmark Button