Communication between AS3 and an OOP PHP site
I have an OOP PHP site structured with a MVC pattern. A page on the site has an embedded SWF that needs to pull information from a database. In the past, I would have just had a procedural php file for the swf to load the data from the database from. However, that method doesn't seem like it would fit with a more objected oriented site.
What would be the "proper" way for the swf to load external data? Should I create a class and a MVC pattern in the normal structure of开发者_开发知识库 the site that can pull the data (e.g. mysite.com/flash/data) and just pass this path to the swf as a FlashVar?
I suggest that first you create a RESTful API based on the MVC code. Provided your framework is sane, this should be easy. Second, I suggest you use either AMF or JSON to pass data around. That way your SWF can make web calls in the background and get all the data it needs from your application.
You could write one or more classes that provide the data your flash program needs and then expose the classes' methods through SOAP with SoapServer. See here how to work with XML and namespaces.
精彩评论