The previous example on Flash, AMFPHP and CodeIgniter basically demonstrates how to return a simple string value to your flash movie. It’s a good idea to read that before doing this.

The following example details how to return a recordset from your database query in your CodeIgniter model. Assuming you got the setup working on the first example, the following should be relatively straightforward.

Today I’ve managed to return a recordset from the database and display entries from that recordset.

I’ll just post the code and go through it line by line.

CodeIgniter model (listingsmodel.php)

AMFPHP Service Class (Press.php)

ActionScript 2 code

The code for the Model function and the AMFPHP service class are relatively straightforward. Lines 14-20 in the Actionscript2 code show how to access the array contents.
Line 16 displays everything that is past back as one huge nested array.
Line 17 displays just the data from the records in the database
Line 18 displays the length of the data array
Line 19 displays a specific value of the specified fieldname from the specified record

You can of course modify the code to do a loop that will utilise the array contents however you like.

Useful links

AS3 FLASH REMOTING EXAMPLE
RECORDSETS
OBJECTDUMPER

Categories

Blog

2 Comments to “CodeIgniter, AMFPHP and Flash”

Hey,

I know this is an old post, but i came here first when looking for a solution.. just wanted to let you know we build a CI AMFPHP library solution to allow easy connection, and direct access to your models:
http://codeigniter.com/wiki/AMF_Codeigniter_Library_No_Zend_No_Hooks_Etc./

Phil

admin

Ah, thanks Phil. I’ll take a look at the link. First impressions are it definitely looks like a neater method.

Thanks!
KJ

Leave a Reply