Welcome, Guest. Please login or register.
Did you miss your activation email?
02/08/12, 08:17
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  General
| |-+  Flash and AS 3 (Moderators: papachan, kofi addaquay)
| | |-+  Variables + ActionScript 3
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 Print
Author Topic: Variables + ActionScript 3  (Read 1960 times)
hinomotoblade
Seasoned Programmer
***
Posts: 131


Flash Never Die :D


View Profile
« on: 01/12/10, 22:50 »

Helooooo i need some help.. T____T

When i try to send data to PHP, its like didnt connect between flash and PHP  Huh

Code:
<?php
$hcon 
mysql_connect("localhost","root","") or die ("Gagal terkoneksi ke Database !!!");
$hdb mysql_select_db("cobaflash",$hcon) or die ("Database tidak di temukan !!!");

$nama $_POST["namain"];
$password $_POST["passwdin"];
$alamat $_POST["alamatin"];
$email $_POST["emailin"];
$pekerjaan $_POST["pekerjaanin"];
$jumNak $_POST["jumNakin"];
$gender $_POST["genderin"];
$orang $_POST["orangin"];
$url "INSERT INTO hinodata (nama,password,alamat,email,pekerjaan,jumanak,gender,orang) VALUES ('".$nama."','".$password."','".$alamat."','".$email."','".$pekerjaan."',".$jumNak.",'".$gender."','".$orang."')";
$hinoquery mysql_query($url);

if (
$hinoquery) {
    echo 
"valid=OK";
} else {
    echo 
"valid=FAILED";
}
?>

nah in the echo "valid=OK" and "valid="FAILED"

in the flash i have caught that with
Code:
function hinoComplete(event:Event):void {
  trace(event.target.data.valid);
  if (event.target.data.valid == "OK") {
  statusin.text = "Data Send Success !!";
  } else {
  statusin.text = "Data Send Failed !!";
  }
  }

but the trace in flash said "undefined"
Sad

Please help me.. a bit bit help thats really appreciate =)

Thank you =D
« Last Edit: 01/13/10, 02:24 by Ronald Wernecke » Logged

Huihihi~ Cheesy
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6162


View Profile WWW Email
« Reply #1 on: 01/13/10, 02:29 »

Hi and welcome to the boards.

After your request has nothing to do with the thread you posted in, I created a new one.

If you receive "undefined", this means, something in your path assignment is wrong.

The best way finding yout how the structure looks like, you are ceceiving from the server, you can use Charles debugging proxy.

It tells you what happens in the communication line.

Be aware, capital letters are recognized as different Wink
Logged

happy flashing
Cool
Ronald
hinomotoblade
Seasoned Programmer
***
Posts: 131


Flash Never Die :D


View Profile
« Reply #2 on: 01/13/10, 08:28 »

wiw yes thank you very much..  Smiley

but i have tried and tried, and there are same as the flash-db tutorial about the structure..

in the example there is

Code:
echo "writing=Ok"; //

but in my PHP file i change to
Code:
echo "valid=OK";

did that influence?.. :O

huhuhu, i just want to make communication between Flash > PHP > Mysql Sad
until now stil not success Sad hiks2

But thank you for your reply.. thank you thank you very much  Cheesy

Logged

Huihihi~ Cheesy
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6162


View Profile WWW Email
« Reply #3 on: 01/13/10, 09:35 »

it very much depends on how you access this inside of your flash component.
The nameing must match 100%
Logged

happy flashing
Cool
Ronald
hinomotoblade
Seasoned Programmer
***
Posts: 131


Flash Never Die :D


View Profile
« Reply #4 on: 01/15/10, 08:30 »

yes i have checked that.. see :

in flash side :
Code:
var hinoVar:URLVariables = new URLVariables();
hinoVar.namain = namain.text;
hinoVar.passwdin = passwdin.text;
hinoVar.alamatin = alamatin.text;
hinoVar.emailin = emailin.text;
hinoVar.pekerjaanin = comboBox.value;
hinoVar.jumNakin = jumNakin.value;
if (genderin1.selected) {
hinoVar.genderin = genderin1.value;
       } else if (genderin2.selected) {
hinoVar.genderin = genderin2.value;   
   }
   if (orangin.selected) {
   hinoVar.orangin = "YES";
   } else {
hinoVar.orangin = "NO";   
   }

and in the PHP Side :
Code:
$nama = $_POST["namain"];
$password = $_POST["passwdin"];
$alamat = $_POST["alamatin"];
$email = $_POST["emailin"];
$pekerjaan = $_POST["pekerjaanin"];
$jumNak = $_POST["jumNakin"];
$gender = $_POST["genderin"];
$orang = $_POST["orangin"];

when i trace all of variables in flash, thats work, but when i want to get some return message thats said "undefined"..
Thanks again about your reply Smiley
« Last Edit: 01/15/10, 08:33 by hinomotoblade » Logged

Huihihi~ Cheesy
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6162


View Profile WWW Email
« Reply #5 on: 01/15/10, 13:18 »

if you privide the two variables in your URLVariables Object, you can receive them Wink

Thats the trick
Logged

happy flashing
Cool
Ronald
hinomotoblade
Seasoned Programmer
***
Posts: 131


Flash Never Die :D


View Profile
« Reply #6 on: 01/15/10, 21:46 »

Ummm sry, what do you mean?.. :O

To connect flash and php, there are some extension / plugin/ import to do that, maybe?.. :O

Thanx Smiley
« Last Edit: 01/15/10, 22:05 by hinomotoblade » Logged

Huihihi~ Cheesy
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6162


View Profile WWW Email
« Reply #7 on: 01/16/10, 01:52 »

definately not.
The mimik you are using is right.

But you have to define the variable, you are expecting.
Code:
hinoVar.writing="";
hinoVar.valid="";
Logged

happy flashing
Cool
Ronald
hinomotoblade
Seasoned Programmer
***
Posts: 131


Flash Never Die :D


View Profile
« Reply #8 on: 01/16/10, 02:55 »

Ow thank you Smiley

wew yey i have some development, the data can send to the database, i just make the publish setting to access network..

but there is some trouble when i input the data.. see in my mysql database, whereas i just input once T.T, this picture below



see in the id thats my primary key extra auto increment, it seems overload.. huhuhuh ..

How to fix that?.. :O

Thank you
Logged

Huihihi~ Cheesy
hinomotoblade
Seasoned Programmer
***
Posts: 131


Flash Never Die :D


View Profile
« Reply #9 on: 01/16/10, 03:28 »

Wew done done.. but i have 1 problem again.. maybe this is my last problem.. Smiley

When i try that in flash directly (Ctrl+Enter) that work, but when i published that, it didnt work..
I mean i open the swf file which made by default when we test movie in flash.. why?.. :O

Thank you very very much Smiley
Logged

Huihihi~ Cheesy
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6162


View Profile WWW Email
« Reply #10 on: 01/16/10, 04:31 »

if you start the swf, it must reside at the same host the data is comming from.
Sandbox is only extended while you are in development environment.

Just upload the swf to the server and start it from there with the browser.
Logged

happy flashing
Cool
Ronald
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6162


View Profile WWW Email
« Reply #11 on: 01/16/10, 04:34 »

if you want to check doubles in your table, you have to check the existance before you insert.
do a select with the fields first, and if it delivers a record, you deliver an error message and dont insert.
Logged

happy flashing
Cool
Ronald
hinomotoblade
Seasoned Programmer
***
Posts: 131


Flash Never Die :D


View Profile
« Reply #12 on: 01/16/10, 05:27 »

wiwi thank you.. um i have send a data from Flash to PHP, but can i send from PHP to flash?.. :O

For example i want to show the echo in PHP to flash TextField or whatever?.. :O

Thanks a lot Smiley
Logged

Huihihi~ Cheesy
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6162


View Profile WWW Email
« Reply #13 on: 01/16/10, 09:51 »

if you want to go deeper, and use a more intelligent way of communication, have a look into AMFPHP.

With the URLVariables you have to know what to expect - with AMFPHP you can transfer complete object structures.

Fore more information on how to communicate with the different methods, see our loading and saving tutorials.
Logged

happy flashing
Cool
Ronald
hinomotoblade
Seasoned Programmer
***
Posts: 131


Flash Never Die :D


View Profile
« Reply #14 on: 01/16/10, 10:24 »

ow yes i know amfphp, but did that can call more than 1 function?.. :O
can we put many php file in the services directory?..

because when i try to use that, in the flash side we just use 'call' method to call the amfPhp
and the connection is on the Gateway.php

nah how about we have more than 1 php files in the services folder?..
Which want the 'call' method call the php services in the services folder?..

Thanks in advance Smiley
Logged

Huihihi~ Cheesy
Pages: [1] 2 Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!