flash remoting with SWX and CakePHP

So, you want to learn how to create a sexy blog in flash, creating posts, comments, database storage, …? Are you afraid of spending hours writing complex queries, parsing XML data or writing loads of php files? Don’t be, and see the power of cakephp and SWX combined. CakePHP being a rapid development framework for PHP and SWX, the native data format for the flash platform!

If you don’t have a running webserver with PHP + mysql + phpmyadmin yet, you’ll have to install these packages first.

  • Windows users can install WAMP, which will install these packages at once on your development machine.
  • Mac users can install MAMP, which does the same (there is a MAMP bundle on swxformat, but we won’t use this one, as we’ll need to copy SWX to another directory anyway to work with cakephp).

When you have your webserver set up, we’ll download the latest version of cakephp. Unzip it to you webroot (WAMP default: C:\wamp\www – MAMP default: /Applications/MAMP/htdocs) and rename the unzipped directory to “flashblog”. You now have the following file structure:

  • WWW
    • flashblog
      • app
      • cake
      • docs
      • index.php
      • vendors

If you are deploying on a webserver, make sure the app/tmp/ directory and it’s subdirectories are writeable (chmod 777).

After that, we’ll add cakeswxphp to our cake install. Download cakeswxphp and unzip it somewhere on your computer. Copy/Paste the content of the app and vendors dir of cakeswxphp to the same directories of your flashblog directory. If you did everything correctly, you can point your browser to: http://localhost/flashblog/explorer/. This opens the SWX Service Explorer. Set the amf path to http://localhost/flashblog/amf.php (default).

This should give you an overview of the remoting services, which we can call via flash. Right now, the only service is amfphp/discovery_service…

Now that we have cakephp & cakeswxphp installed, we will setup our database for our blog. Point your browser to the phpMyAdmin on your development machine (WAMP default: http://localhost/phpmyadmin – MAMP default: http://localhost/phpMyAdmin/).

Using phpmyadmin, create a new database called “flashblog”.

afbeelding-1.png

Execute the following SQL to create the tables for our blog:

CREATE TABLE `comments` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
`post_id` INT(11) NOT NULL,
`nickname` VARCHAR(64) NOT NULL,
`title` VARCHAR(64) NOT NULL,
`content` text NOT NULL,
PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE `posts` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
`nickname` VARCHAR(64) NOT NULL,
`title` VARCHAR(64) NOT NULL,
`content` text NOT NULL,
PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

That’s it, our database is set up! Now it is time to write our cakephp classes to work with our database…

First of all, we need to tell cakephp how to access our database. Rename flashblog/app/config/database.php.default to database.php and open it in your favorite text/php editor. You can adjust the database configuration in the $default var in this file. In my case, it looks like this:

var $default = array('driver' => 'mysql',
	'connect' => 'mysql_connect',
	'host' => 'localhost',
	'login' => 'root',
	'password' => 'root',
	'database' => 'flashblog',
	'prefix' => '');

If you point your browser to http://localhost/flashblog/ you should get the message that cake is able to connect to the database. If not, check your database settings again in flashblog/app/config/database.php.

So, we can connect to our database. Now we’ll define our post and comment models in php so that cakephp knows how to read and write posts and comments to the database. We could use the cake bake script to do this, but right now we’ll just write the code ourselves.

First of all, we’ll adjust the default model. Create app_model.php in flashblog/app/ with the following contents:

<?php
class AppModel extends Model {
	 function beforeSave(){
		if(!empty($this->data)){
			while(!empty($this->data[$this->name])
					 && !empty($this->data[$this->name][$this->name])
					 && is_object($this->data[$this->name][$this->name])){
				$this->data[$this->name] = get_object_vars($this->data[$this->name][$this->name]);
			}
		}
		if(!empty($this->data[$this->name][$this->primaryKey])){
			eval('$this->' . $this->primaryKey . ' =  $this->data[$this->name][$this->primaryKey];');
		}
		return true;
  }
}
?>

Now, we can define our post and comments models. Create a file called post.php in flashblog/app/models/:

<?php
class Post extends AppModel {
	var $name = 'Post';
	var $hasMany = array(
			'Comment' =>
				array('className' => 'Comment',
						'foreignKey' => 'post_id',
						'dependent' => true
				),
	);
}
?>

Then, create comment.php in that same directory (flashblog/app/models/) :

<?php
class Comment extends AppModel {
	var $name = 'Comment';
	var $belongsTo = array(
			'Post' =>
				array('className' => 'Post',
						'foreignKey' => 'post_id'
				),
	);
}
?>

CakePHP now knows how to read and write posts and related comments to the database! Next, we will create our remoting methods (cake controllers) which we will call from flash.

Create posts_controller.php in flashblog/app/controllers:

<?php
class PostsController extends AppController {
	var $name = 'Posts';
	var $uses = array('Post');
	function getPosts() {
		return $this->Post->findAll();
	}
	function getPost($id) {
		return $this->Post->read(null, $id);
	}
	function savePost($post) {
		if($this->Post->save($post)) {
			return $this->Post->id;
		}else{
			return false;
		}
	}
	function deletePost($id) {
		if($this->Post->del($id)) {
			return true;
		}else{
			return false;
		}
	}
}
?>

Then, create the controller for our comments (flashblog/app/controller/comments_controller.php):

<?php
class CommentsController extends AppController {
	var $name = 'Comments';
	var $uses = array('Comment');
	function saveComment($comment) {
		if($this->Comment->save($comment)) {
			return $this->Comment->id;
		}else{
			return false;
		}
	}
	function deleteComment($id) {
		if($this->Comment->del($id)) {
			return true;
		}else{
			return false;
		}
	}
}
?>

And here ends the PHP side of our flash blog. Let’s have some fun with Flash & ActionScript, shall we?

Launch up flash and create a new fla (Actionscript 2). Save it somewhere as “flashblog.fla”. Now we’ll write the methods to read/write/delete blogposts and comments. SWX remoting doesn’t really need extra classes (you loadMovie your data), but using the classes makes you code a lot smaller and easier to write. So download the SWX ActionScript library and extract the “org” folder to the same directory as your flashblog.fla file.

When you’ve got the org folder in the same folder as your flashblog.fla file, go back to your flashblog.fla file, select frame one and open the actions panel. We’ll start with importing the SWX class and setting up our gateway:

import org.swxformat.*;
var swx:SWX = new SWX();
swx.gateway = "http://localhost/flashblog/swx.php";
swx.encoding = "POST";

Now we can write our actionscript functions to communicate with our swx php classes. The following function sends a new post to our php class, which inserts it in the database:

/**
* function to create a new post
*/
function createPost(nickname:String, title:String, content:String):Void{
	var callDetails:Object = {
		serviceClass: "PostsController",
		method: "savePost",
		args: [nickname, title, content],
		result: [this, savePostResultHandler]
	}
	swx.call(callDetails);
}
/**
* called when the post was saved
*/
function savePostResultHandler(resultObj:Object):Void{
	trace(resultObj.result); //nr of saved post or false when failed
}

That’s all it takes. No query writing. No XML parsing. No complex php files…
Now, let’s complete our actionscript code with the other functions to communicate with php:

//we import the SWX classes
import org.swxformat.*;
//create a new SWX instance
var swx:SWX = new SWX();
//location of the SWX gateway
swx.gateway = "http://localhost/flashblog/swx.php";
//we'll transfer data using POST.
swx.encoding = "POST";
/**
*get all posts from the server
*/
function getPosts():Void{
	var callDetails:Object = {
		serviceClass: "PostsController",
		method: "getPosts",
		result: [this, getPostsResultHandler]
	}
	swx.call(callDetails);
}
/*
* called when we receive the posts from the server
*/
function getPostsResultHandler(resultObj:Object):Void{
	var posts_length:Number = resultObj.result.length;
	for(var i:Number = 0; i < posts_length; i++){
		var post:Object = resultObj.result[i];
		trace(post.Post.title);
		trace(post.Post.content);
	}
}
/**
*get a post with given id
*/
function getPost(id:Number):Void{
	var callDetails:Object = {
		serviceClass: "PostsController",
		method: "getPost",
		args: [id],
		result: [this, getPostResultHandler]
	}
	swx.call(callDetails);
}
/*
* called when we receive the posts from the server
*/
function getPostResultHandler(resultObj:Object):Void{
	trace(resultObj.result.Post.title);
	trace(resultObj.result.Comment);
}
/**
* function to create a new post
*/
function createPost(nickname:String, title:String, content:String):Void{
	var callDetails:Object = {
		serviceClass: "PostsController",
		method: "savePost",
		args: [{Post: {nickname: nickname, title: title, content: content}}],
		result: [this, savePostResultHandler]
	}
	swx.call(callDetails);
}
/**
* function to edit a post
*/
function editPost(id:Number, nickname:String, title:String, content:String):Void{
	var callDetails:Object = {
		serviceClass: "PostsController",
		method: "savePost",
		args: [{Post: {id: id, nickname: nickname, title: title, content: content}}],
		result: [this, savePostResultHandler]
	}
	swx.call(callDetails);
}
/**
* called when the post was saved
*/
function savePostResultHandler(resultObj:Object):Void{
	trace(resultObj.result); //nr of saved post or false when failed
}
/*
* called when we receive the posts from the server
*/
function getPostResultHandler(resultObj:Object):Void{
	trace(resultObj.result.Post.title);
	var comments_length:Number = resultObj.result.Comment.length;
	for(var i:Number = 0; i < comments_length; i++){
		var comment:Object = resultObj.result.Comment[i];
		trace(comment.title);
		trace(comment.content);
	}
}
/**
*delete a post with given id
*/
function deletePost(id:Number):Void{
	var callDetails:Object = {
		serviceClass: "PostsController",
		method: "deletePost",
		args: [id],
		result: [this, deletePostResultHandler]
	}
	swx.call(callDetails);
}
/*
* called when we receive the posts from the server
*/
function deletePostResultHandler(resultObj:Object):Void{
	trace(resultObj.result);
}
/**
* function to create a new comment
*/
function createComment(post_id:Number, nickname:String, title:String, content:String):Void{
	var callDetails:Object = {
		serviceClass: "CommentsController",
		method: "saveComment",
		args: [{Comment: {post_id: post_id, nickname: nickname, title: title, content: content}}],
		result: [this, saveCommentResultHandler]
	}
	swx.call(callDetails);
}
/**
* function to edit a comment
*/
function editComment(id:Number, post_id:Number, nickname:String, title:String, content:String):Void{
	var callDetails:Object = {
		serviceClass: "CommentsController",
		method: "saveComment",
		args: [{Comment: {id: id, post_id: post_id, nickname: nickname, title: title, content: content}}],
		result: [this, saveCommentResultHandler]
	}
	swx.call(callDetails);
}
/**
* called when the comment was saved
*/
function saveCommentResultHandler(resultObj:Object):Void{
	trace(resultObj.result); //nr of saved post or false when failed
}
/**
*delete a comment with given id
*/
function deleteComment(id:Number):Void{
	var callDetails:Object = {
		serviceClass: "CommentsController",
		method: "deleteComment",
		args: [id],
		result: [this, deleteCommentResultHandler]
	}
	swx.call(callDetails);
}
/*
* called when we receive the posts from the server
*/
function deleteCommentResultHandler(resultObj:Object):Void{
	trace(resultObj.result);
}

You can test the functions by calling them manually through AS code. The next thing todo is create a gui to show posts, edit posts, etc. But that’s beyond the scope of this tutorial…

Happy flashing!

49 Responses to “flash remoting with SWX and CakePHP”


  • Thanks for the nice tutorial dude! SWX rulezz ;-)

  • Good article Wouter. I really need to spend some time playing around with these new things. Been way to busy lately at work and don’t even have the time to blog.

    I does feel however that the SWX API is not that intuitive to developers using Flash Remoting. It’s weird to create the call details and then pass them into the service call.

    I would have expected someting like:
    var swxService:SWXService = new SWXService(gateway, serviceName);
    var call:AsyncToken = swxService.myRemoteMethod(arg1, arg2);
    call.addResponder(firstResponder);
    call.addResponder(secondResponder);

    This has several advantages IMO, for instance that you don’t need to remember the keys of the call details object. You can add multiple responders to the service call. Same way of working as with Flash Remoting.

    Anyway, again nice post. I’ll give it a try when I find the time.

    regards,
    Christophe

  • Hey Christophe. I can agree it looks a bit “weird” if you’re used to working with Flash Remoting (& amfphp). However, especially for new flash-remote-data users, flash remoting with Service classes & responders is very abstract at first. Sending a parameter object with a SWX call show you exactly what is going on. A data call to a remoting gateway. Both methods have their (dis)advantages I think. Maybe the SWXService could be added to the next swx release…?

  • Hi Christophe,

    I think that Wouter summarized the philosophy behind the SWX API in his comment. SWX RPC is an RPC protocol but it is not Flash Remoting. The philosophy behind it is about simplicity and clarity. That said, I can definitely see the advantage of having an alternative for developers who are familiar with Flash Remoting and/or want to port their Remoting code to SWX. I can see, for example, how this might have a use-case if you have an existing web application that uses Remoting that you want to convert to Flash Lite (and thus would have to use SWX). Although, in the real world, I don’t know how many people would have this requirement — not more than a handful would be my optimistic guess. If implemented, this would definitely have to be positioned as an _advanced_/_porting_ feature, however, and I would hate to see it popularized as the primary means of using SWX RPC as it would scare people as much as Flash Remoting does today and that would actively hurt what SWX is trying to achieve.

    Would this be something you would have time to contribute to the project? Do you think that anyone will use it (i.e., do you believe that there is a real world use case for this or is the adept Flash Remoting developer who wants to use SWX merely a theoretical construct?) :)

    Take care + looking forward to hearing your thoughts

  • I’ve run into a problem and I don’t see any message boards to go for help. First, if there is a message board please direct me there. Second, I get this error when I try to amp path.

    (mx.rpc::Fault)#0
    errorID = 0
    faultCode = “Client.Error.MessageSend”
    faultDetail = “Channel.Connect.Failed error NetConnection.Call.BadVersion: : url: ‘http://www.pbjs.com/rcd/flashBlog/cake_amf_gateway.php’”
    faultString = “Send failed”
    message = “faultCode:Client.Error.MessageSend faultString:’Send failed’ faultDetail:’Channel.Connect.Failed error NetConnection.Call.BadVersion: : url: ‘http://www.pbjs.com/rcd/flashBlog/cake_amf_gateway.php””
    name = “Error”
    rootCause = (Object)#1
    code = “NetConnection.Call.BadVersion”
    description = “”
    details = “”
    level = “error”

    Help!

  • Got it working…please ignore my previous post…

    Thanks for the great tutorial!

  • I’m getting timeouts when I call all the methods both from my swf file, and from the SWX explorer. I went to IRC for help, no one responded…any ideas?

  • So I figured out why things weren’t working for me. In the tutorial it doesn’t say that you have to put your controllers in the ‘components’ folder. I had my in the exact path you specified: flashblog/app/controller/comments_controller.php

    I was getting timeout whenever I called a method. When I moved the my controller files into the components folder everything seems to be working.

    lashblog/app/controller/components/comments_controller.php

    Not sure if this is an issue with my setup or what, but I thought you should know in case it’s just a typo in the tutorial.

    - Ryan

  • hmm, that’s really strange, they _shoud_ be in the controller folder, not in the components folder… cakephp does require mod_rewrite to be activated on your server install, perhaps it isn’t activated and it looks in the wrong paths? Otherwise, I could have a look at your source files if you’ll mail them to wouter [at] aboutme.be…

  • It’s me again, are you sick of me yet?

    You are correct, It wasn’t actually working. I went through your tutorial a third time, this time on a mac, and set up the database locally using MAMP. I’m not getting any timeouts now. SO…Beyond looking to make sure I have mod_rewrite activated on my web server, do you have any other ideas why my method calls could be timing out?

    I’ll package up my source files and send you a link. If you have time to take a look at them that would be awesome. I want to try out the mod_rewrite thing first before I waste your time.

    Thanks again,
    Ryan

  • Hey Ryan,

    If you’re deploying on a website, you should make the app/tmp dir + subdirs writable. I added this to the tutorial now :-)

  • Hi,

    great, are there any plans to make it compatible to cakephp 1.2?
    cheers,
    Nik

  • Hey Nik,

    I still need to check out the cakephp 1.2 plugin architecture and how to implement cakeswxphp into this. But I am looking into this, can’t give you a release date though..

    Wouter

  • Hey guis,
    ice work. I can do nearly everything I need with swx and cakephp. There is only one thing I didn’t work out:

    Is it posible to do some file upload out of a flash application and save the file on the server?

    I managed to do this inside cakephp. But I’m stuck doing it with cakeswxphp.

    Can anybody give me a hint?

    Cheers and thanks again for this nice work!

    Mike

  • Hey biguhuna,

    You can’t upload file through remoting as far as I know. You need to use a seperate php file, which handles the upload. The php file is no more then:

    < ?php
    if(!empty($_FILES)){
    move_uploaded_file($_FILES['Filedata']['tmp_name'], dirname(__FILE__) . '/upload/' . $_FILES['Filedata']['name']);
    }
    ?>

    and upload it from flash with a FileReference to the target php file…

  • Hi wouter,
    thanx for the hint.
    cheers…

  • thanks for the tutorial i totally understand it now. I am going to test if this works well in my tiny cakephp application : )

    take care,
    goed

  • I think there are a lot of errors related to where the ROOT / APP_DIR and CAKE_CORE_INCLUDE_PATH are setup

    I found this through Firebug Fatal error: Class ‘CakeGateway’ not found in

    In CakeGateway.php, there is a reference made as such which seems to be the fault of all of this : dirname(dirname(dirname(dirname(…. u see where im going… Shouldnt this be relative to the ROOT constant ?

  • Well, it should be important to note that there are two vendors folder.

    One is outside the ‘app’ folder
    One is inside the ‘app’ folder

    The files for SWX need to go INSIDE the ‘app’ folder… Hope this helps!!

  • Hi,

    why not cover the basics. I am new to flash actionscript and going through lynda tutorials trying to figure out how I can send data to mysql database through flash. This Tutorial didn’t help. I can see how cakephp app shell(framework if you will) can be prepaired to use with swx rpc but what do you do in flash to send info to mysql database?

    created a form with input fields(nick, title, content) in flash and have a movieclip which is a submit button so..

    Submit.onPress = function():Void{
    createPost(nick, title , content);
    };

    SWX.call INFO: No progress handler defined.
    SWX.call INFO: No timeout handler defined.
    SWX.call INFO: No fault handler defined.
    SWX LoadManager INFO: Initialized.
    ExternalAsset.load() info: Sending data using POST encoding.
    SWX.prepare: _level0.SWXLoadManagerClip.holder0.innerHolder
    256 levels of recursion were exceeded in one action list.
    This is probably an infinite loop.
    Further execution of actions has been disabled in this movie.

    seems to me all this is just hype. All the sites are using regular html websites discussing these things and people who do use this stuff just post games and apps which are linked to from html websites and people discuss them on regular web pages.

  • Zee,

    The code posted in this tutorial should work, by calling the functions themselves. Your problem might have something to do with function scope issues (which is a known “problem” in actionscript 1/2). I sent you an email, so we can figure out where your problem lays.

    I do not agree on the hype thing. Flash (and flash remoting) is here to stay. There were always be cases where html is the appropriate technology, and where flash is the way to go (especially for marketing products, integrating multi-media and situations where highly-interactive websites / web applications are needed). So, this is not a hype, Flash exists 11 years now, and it doesn’t look it is going to end soon….

  • Hi,

    I sent a reply to your email.

    Looking forward to a reply.

  • Ummm, I’m probably being a little bit stupid, and have done something wrong in the “installation”.

    I have downloaded all nessecary and setup the directory structure. I can view the service browser, however when I try to enter the url specified:

    http://localhost/flashblog/cake_amf_gateway.php which I have changed appropriately. I get an error from the service browser saying:

    cannot connect to amf getway.

    Have a got something extremly wrong???
    I have had a look around and there is no file of this name, so it must be a ‘tidy url’ for Cake unless I have something mising. I did find amf.php in the webroot directory, but this throws an error on line 10 when I run it directly through the web browser.

    I’d love to get this working if anyone can help it would be extremely appreciated.

    Cheers,
    J

  • OK, 3 things
    1) I’m not that bright
    2) I downloaded the wrong cakephpswx file (school boy error)
    3) the url should have just been amf.php as the filename (worked for me anyway)
    Sorry to clog the comments…
    Great Tutorial thanks…

  • and the view the cake for posts, add and delete?? where its
    please respond me

  • Hi im having trouble with the installation ( >.< ) im not sure what im doing wrong, I have all the files where I THINK they should be ( going by the tutorial ) but it says webpage can not be found when I point my browser to

    http://localhost/flashblog/explorer

    I know im proberbly doing something retarded im just a little new to all this ( php and mysql, have only been using flash cs3 with actionscript by itself ).

    Any suggestions?

  • Hey Marschall,

    It might be a problem with our webserver installation / configuration:

    - try adding a trailing slash to your url: http://localhost/flashblog/explorer/

    - is mod_rewrite running on your server? Try http://localhost/flashblog/app/webroot/explorer/

    Good luck!

  • Great tutorial. Worked like a charm (Except for the gateway that should be http://localhost/flashblog/amf.php).

    I’m new to Flash, so I didn’t come up with the GUI for handling the posts/comments. However, I called a function in AS and when compiling the flash movie it saved a comment in the DB. Just the expected result.

    Great way to get started. Thank you very much.

  • mihai,

    Thanks for the feedback! I updated the post with the correct gateway location…

  • “# 6 Discorax
    Oct 11th, 2007 at 1:11 am

    Got it working…please ignore my previous post…

    Thanks for the great tutorial!”

    Help Discorax,

    how you make it work CakeSwxPhp with CakePHP 1.2 ?

    I have the same problem while trying to set the path in explorer

    Help !!

  • nice tuto…
    but i’m a beginner and really need some help…
    after that, i don’t know how can i create the design of my blog in flash and how can i link the actionscript code with my design…please write the next tuto, the next step on flash for beginner like me…
    bye

  • Hi,

    I’m running into the same error Discorax reported earlier. What is the solution? The error i below.

    Take care,

    Arald

    (mx.rpc::Fault)#0
    errorID = 0
    faultCode = “Client.Error.MessageSend”
    faultDetail = “Channel.Connect.Failed error NetConnection.Call.BadVersion: : url: ‘http://www.pbjs.com/rcd/flashBlog/cake_amf_gateway.php’”
    faultString = “Send failed”
    message = “faultCode:Client.Error.MessageSend faultString:’Send failed’ faultDetail:’Channel.Connect.Failed error NetConnection.Call.BadVersion: : url: ‘http://www.pbjs.com/rcd/flashBlog/cake_amf_gateway.php””
    name = “Error”
    rootCause = (Object)#1
    code = “NetConnection.Call.BadVersion”
    description = “”
    details = “”
    level = “error”

  • Arald,

    The correct path would be http://www.pbjs.com/rcd/flashBlog/amf.php instead of cake_amf_gateway.php

    Good luck,

  • Thanks Wouter for your response. I re-installed everything and used the correct URL but I still get the following:

    (mx.rpc::Fault)#0
    errorID = 0
    faultCode = “Client.Error.MessageSend”
    faultDetail = “Channel.Connect.Failed error NetConnection.Call.BadVersion: : url: ‘http://localhost/flashblog/amf.php’”
    faultString = “Send failed”
    message = “faultCode:Client.Error.MessageSend faultString:’Send failed’ faultDetail:’Channel.Connect.Failed error NetConnection.Call.BadVersion: : url: ‘http://localhost/flashblog/amf.php””
    name = “Error”
    rootCause = (Object)#1
    code = “NetConnection.Call.BadVersion”
    description = “”
    details = “”
    level = “error”

  • Hi, I had same problems as Discorax and Arald. First I was getting the error Arald explained in last comment. After removing $uses variable definition in the AppController error disappeared, but I still have problems with timeout when calling a method from explorer. I’m using ACL and Auth for authorization and authentication, maybe this is the reason, but I couldn’t find any relation between those two and SWX. I didn’t manage to find solution for the timeout, and if anyone find’s it, please post it.

    Thanks

  • Hi everyone, it seems that I had a problem with one of the behaviors I’m using in my application. It’s an upload behavior, so if someone uses it I’ll be glad to explain where was the problem in detail.

    Regards

  • Great tutorial. Thank you for the great work.

    Took me a while to get it going but I found that if you accidentally put the cakeswx and swx folders in both vendor files (one in app and the one under the root) the amf fails for some reason.

    Correct way is to put the vendor files in the vendor file under the app.

  • I’m experiencing problems in IE7 for some reason. I have a membership based site (that uses the 1.2 Auth component) in which members logged in and start a flash application to learn Japanese. I’m using swx and cakephp to pull the user’s information (last level, last lesson e.t.c).

    Only problem is that it works perfectly fine in firefox, safari but fails (timesout) in IE7 because it appears the session is killed. I tried changing session security settings (low, medium and high) but all failed.

    Any ideas?

  • Hi

    I’m hoping someone could help me. I’ve followed the tutorial carefully, but I’m experiencing problems with both the flashblog.swf and explorer working properly. I can see the controllers and the methods in explorer, but all of them time out.

    I’m using AS 2.0, flash player 10, CakePHP v1.2.0.7692 RC3, cakeswxphp v1.2, PHP 5.2, apache with mod_rewrite functioning.

    Upon compiling in flash, I get this output:

    SWX.call INFO: No progress handler defined.
    SWX.call INFO: No timeout handler defined.
    SWX.call INFO: No fault handler defined.
    SWX LoadManager INFO: Initialized.
    ExternalAsset.load() info: Sending data using POST encoding.
    SWX.prepare: _level0.SWXLoadManagerClip.holder0.innerHolder

    In actionscript I’m just calling:

    createPost(‘nick’, ‘I hope’, ‘this works’);

    I then publish it, and copy AC_RunActiveContent.js, flashblog.html, and flashblog.swf into the webroot folder.

    When I try to go to flashblog.html, the browser with firebug I can see that 4 files are being loaded: AC_RunActiveContent.js, flashblog.html, flashblog.swf and swx.php.

    When I try to use explorer to make method calls, it hangs. For instance, I created a manual entry in Posts (id=1). Then I go into explorer, choose Post control and deletePost method with id 1. When I click call, the timer just spins.

    I’m running out of ideas. Any help is very much appreciated.

    Alex

  • Alex,

    It seems like the php does not return a response because of an error there… You might find an answer in your php_error log files.

    If not, feel free to send me your app files (wouter at aboutme dot be) so I can have a look at them

  • i had a problem on my app. it was working great on a local server, but when i put it on a dedicated one, it was no more working. the swf was here but no data in it. swx explorer was quite working (listing controllers, actions ,..) but when trying to get data, nothing…

    my problem was in cake_gateway_init.php
    i replaced this line :
    ini_set(‘include_path’,ini_get(‘include_path’).PATH_SEPARATOR.CAKE_CORE_INCLUDE_PATH.PATH_SEPARATOR.ROOT.DS.APP_DIR.DS);

    by

    ini_set(‘include_path’,CAKE_CORE_INCLUDE_PATH.PATH_SEPARATOR.ROOT.DS.APP_DIR.DS);

    and now it’s working.

  • Gracias por el tutorial…

    Es el mas completo que hay en la Red…

  • So Interestingly site style of site. What CMS do you use ?

  • Very amazing portal design. What CMS do you use ?

  • Very cool guestbook design. What CMS do you use ?

  • eval(‘$this->’ . $this->primaryKey . ‘ = $this->data[$this->name][$this->primaryKey];’);
    should be written as
    $this->{$this->primaryKey} = $this->data[$this->name][$this->primaryKey];

  • someone help me~!

    i have the same problem as Marshall.

    i cant seem to open localhost/flashblog/explorer/ .
    (also tried localhost/flashblog/app/explorer)

    i can straight go into flashblog/app/ folder and start up index page
    but can not open with the links above.

    im totally new to MAMP and cakephp~! someone save me~~~~

  • hello i am back and ready to get started best place where to by tramadol http://www.wheretobuytramadol.com
    buy cheap tramadol

  • Your website and infors are very impressive and very inspirational!
    Thank you for posting great content Enjoy!

Leave a Reply