Welcome, Guest. Please login or register.
Did you miss your activation email?
05/22/12, 05:49
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
|-+  Server side Scripting and Database Support
| |-+  Flash Remoting with AMF (Moderators: Flash-db, Musicman, Jorge Solis, papachan, nothingGrinder)
| | |-+  Hello AMFPHP tutorial
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 Print
Author Topic: Hello AMFPHP tutorial  (Read 5586 times)
BeechyBoy
Server what's that
*
Posts: 22


View Profile Email
« on: 03/25/08, 08:37 »

Hi there,
I have been following the tutorial here:http://www.flash-db.com/Tutorials/helloAS3/helloAS3.php?page=2
I got the simple example to work fine and it would save and load data. I'm having trouble with the second Flash example. I think it must be something to do with the directories and paths being in the wrong place?! Where do I place the 'com' folder inside the 'FlashVO' directory? I'm just not sure everything is connecting up right... any idea what I'm doing wrong?

Here is the error I'm getting:
Code:
Error #2044: Unhandled NetStatusEvent:. level=error, code=NetConnection.Call.BadVersion
at com.flashdb::VOExample$iinit()
at flash.display::Sprite/flash.display:Sprite::constructChildren()
at flash.display::Sprite$iinit()
at flash.display::MovieClip$iinit()
at remoting2_fla::MainTimeline$iinit()
Please HELP!  Sad
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #1 on: 03/25/08, 09:48 »

There's an error that I forget to update ( http://www.flash-db.com/Board/index.php?topic=18264.0 )
Updated rigth now, please redownload the files, put all the content of amfphp_files folder inside your services folder (as stated in readme.txt)

Jorge
Logged

BeechyBoy
Server what's that
*
Posts: 22


View Profile Email
« Reply #2 on: 03/25/08, 16:58 »

Thanks for this swift response. I will try it out today. I'm really lookiong forward to mastering Flash and AMFPHP. I totally agree with your faith for Flash. Are there any other examples/tutorials you've found useful over the internet?
Cheers mate,
BeechyBoy
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #3 on: 03/25/08, 17:05 »

If you mean advanced use of Remoting, check http://www.flash-db.com/Tutorials/newstore/ (is in AS2)

Jorge
Logged

BeechyBoy
Server what's that
*
Posts: 22


View Profile Email
« Reply #4 on: 03/25/08, 17:08 »

Hi again,
just had a really quick try again with the new version, but got the same error. Do I need to move the 'com' folder inside the FlashVO directory to anywhere? Where else can I be going wrong perhaps?
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #5 on: 03/25/08, 17:11 »

Did you read the README file?

Jorge
Logged

BeechyBoy
Server what's that
*
Posts: 22


View Profile Email
« Reply #6 on: 03/26/08, 03:56 »

I think I've got the classes properly linked now, and they are in my class repository.
This just leaves this error in Charles I'm getting and the error in Flash's output window:
Charles:
Code:
Parse error: syntax error, unexpected T_STRING, expecting ')' in /Applications/MAMP/htdocs/amfphp/services/TestPerson.php
Flash:
Code:
Error #2044: Unhandled NetStatusEvent:. level=error, code=NetConnection.Call.BadVersion
at com.flashdb::VOExample$iinit()
at flash.display::Sprite/flash.display:Sprite::constructChildren()
at flash.display::Sprite$iinit()
at flash.display::MovieClip$iinit()
at remoting2_fla::MainTimeline$iinit()
Whats the fix? Is the answer in the errors?
Please help?! Sad
BeechyBoy
« Last Edit: 03/26/08, 04:07 by BeechyBoy » Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« Reply #7 on: 03/26/08, 04:12 »

you have dollar signs inside of methode names - this cannot work ok.
Logged

happy flashing
Cool
Ronald
BeechyBoy
Server what's that
*
Posts: 22


View Profile Email
« Reply #8 on: 03/26/08, 05:31 »

Thanks Ronald,
Your talking about dollar signs in the classes? What might have caused this? What should the syntax for the methods be here?
Cheers,
BeechyBoy
« Last Edit: 03/26/08, 05:36 by BeechyBoy » Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #9 on: 03/26/08, 06:12 »

Dollar signs are used by the compiler to mark internal methods begin\end in AS3, so is not in the code and is not an error. The error is in Person.php, but is strange, because I'm using the same file that I have uploaded and give no errors. Anyway I note I forget to delete the com folder (now included inside vo folder) so I reuploaded.
Open directly Person.php trough the browser to see if it outputs some error: http://localhost/amfphp/services/vo/com/flashdb/Person.php (or modify if you have another path)
If it outputs some error, post all Person.php code here

Jorge

Logged

BeechyBoy
Server what's that
*
Posts: 22


View Profile Email
« Reply #10 on: 03/26/08, 06:57 »

Gonna take a look at it now...

So re downloaded the files and set them all up. When you say
Quote
Open directly Person.php trough the browser
, you mean the FireFox rather than the Service browser?

Anyway I opened directly through the browser in FireFox and could see anything flagged up that stood out in Charles.
Code:
http://localhost:8888/amfphp/services/vo/com/flashdb/Person.php
I also opened it's services in the service browser. It calls (null) on the Load Data service and true in the Save Data service. A person.txt file is also written in the same directory as the Person.php file. Does this help you figure out whats up here?

When you run the SWF in the browser and press save it does this, but nothing when you load:



What is this "T_STRING" error in TestPerson.php too? What else might you need from me to sort this... very frustrating  Grin



« Last Edit: 03/26/08, 07:37 by BeechyBoy » Logged
BeechyBoy
Server what's that
*
Posts: 22


View Profile Email
« Reply #11 on: 03/26/08, 08:07 »

Here is the Person.php code I have anyhow:
Code:
<?php
class Person {
var $name;
var $age;
var $address;
// explicit actionscript package
var $_explicitType "com.flashdb.Person";

/**
* Constructor with default values
*/
function Person($name=""$age=0$address=""){
$this->name $name;
$this->age $age;
$this->address $address;
}
/**
* Load person data from a textfile
*/
function loadData(){
$fp fopen("person.txt""r");
$contents fread($fpfilesize("person.txt"));
fclose($fp);
$data explode("|"$contents);
$this->name $data[0];
$this->age $data[1];
$this->address $data[2];
}
/*
* Saves person data to a textfile
* @return Boolean on succes
*/
function logData(){
$fp fopen("person.txt""w");
if(fwrite($fp$this->name."|".$this->age."|".$this->address)){
fclose($fp);
return true;
};
return false;
}
}
?>
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #12 on: 03/26/08, 10:15 »

Sorry, the error seems to be in TestPerson.php (inside services folder) This is the class  that manage the services. Again strange, because is rigth. Open also directly trough the browser (but if the Service browser works, the example should work also)

Jorge
Logged

BeechyBoy
Server what's that
*
Posts: 22


View Profile Email
« Reply #13 on: 03/26/08, 10:27 »

"Parse error: syntax error, unexpected T_STRING, expecting ')' in /Applications/MAMP/htdocs/amfphp/services/TestPerson.php on line 18"
This is the error it spits out... line 18 is:
Code:
function savePerson(Person $p){
Heres the full code I have:
Code:
<?php
class TestPerson {
/**
* returns a data populated Person instance
* loaded from a textfile
* @return a Person instance
*/
function getPerson() {
include_once("vo/com/flashdb/Person.php");
$p = new Person();
$p->loadData();
return $p;
}
/**
* saves person instance data to a textfile
* @param p (a Person instance sended from Flash)
*/
function savePerson(Person $p){
$msg $p->logData();
return $msg;
}
}
?>

So the error says
Quote
expecting ')'
. What should be done here?
BeehyBoy
« Last Edit: 03/26/08, 10:33 by BeechyBoy » Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #14 on: 03/26/08, 10:37 »

Are you using PHP5 ?

Jorge
Logged

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!