본문 바로가기
SNS | SNG

What's the Content-type: application/x-amf

by 두루물 2012. 4. 12.



Action Message Format (AMF) is a binary format used to serialize objects graphs such ActionScript objects and XML, or send messages between an Adobe Flash client and a remote service, usually a Flash Media Server or third party alternatives.

The format is often used in conjunction with Adobe's RTMP to establish connections and control commands for the delivery of streaming media. In this case, the AMF data is encapsulated in a chunk which has a header which defines things as the message length and type (whether it is a "ping", "command" or media data).


http://en.wikipedia.org/wiki/Action_Message_Format



Example: Native XML Communication

http://blog.naver.com/PostView.nhn?blogId=lack07kr&logNo=60066401753


Base64 with AS3.0

http://foxarc.com/blog/default.asp?cateID=3


AMF Link more (AMFPHP vs ZENDAMF)


http://mudchobo.tistory.com/424

http://www.flepstudio.org/forum/tutorials/3421-actionscript-3-0-zend-amf.html

http://framework.zend.com/download/latest

http://blog.jidolstar.com/164


http://www.silexlabs.org/amfphp/ Creative communities  amfPHP

http://groups.drupal.org/node/12470 AS3 - AMFPHP connection problems  Drupal Groups


http://blog.naver.com/PostView.nhn?blogId=logon77&logNo=110013703283&redirect=Dlog&widgetTypeCall=true




http://koko8829.tistory.com/758




샘플코드 

http://www.flepstudio.org/forum/tutorials/3421-actionscript-3-0-zend-amf.html


zendamf/index.php

<?PHP
error_reporting
(E_ALL|E_STRICT);

ini_set("display_errors","on");
ini_set("include_path",ini_get("include_path") . ":../frameworks");

require_once 
"Zend/Amf/Server.php";
require_once 
"Comments.php";

$server=new Zend_Amf_Server
();

//여기서 POST로 넘어온 파라미터로 각 클래스를 분기처리할수 있는것으로 보임..
//예) 가격정보테이블(SpecStore),유닛정보테이블(SpecUnit)

$server->setClass("Comments");//Comments 테이블을 담당하는 php 클래스 

echo(
$server->handle());//실행
?>


zendamf/Comments.php

<?php
class Comments
{
    public function 
__construct()
    {
        
mysql_connect("localhost","username","password");
        
mysql_select_db("database");
    }
    
    public function 
getAuthors()
    {
        
$result=mysql_query("SELECT * FROM wp_comments");
        
$t = array();
        
        while(
$row=mysql_fetch_assoc($result))
        {
            
array_push($t,$row);
        }
        
        return 
$t;
    }
}
?>


플래시 코드

var res:Responder=new Responder(onResult,onError);

my_ta.visible=false;

var wheel_mc:Wheel=new Wheel();
wheel_mc.width=wheel_mc.height=40;
wheel_mc.x=stage.stageWidth/2-wheel_mc.width/2;
wheel_mc.y=stage.stageHeight/2-wheel_mc.height/2;
addChild(wheel_mc);
nc.call("Comments.getAuthors",res);

function onResult(e:Object):void
{
	for(var i:int=0;i < e.length;i++)
	{
		my_ta.appendText((i+1)+" - "+e[i].comment_author+"\n");//필드명::클라이언트에서 테이블의 필드명을 명시적으로 사용할수 있음.
	}
	
	wheel_mc.stop();
	removeChild(wheel_mc);
	my_ta.visible=true;
}

function onError(e:Object):void
{
	wheel_mc.stop();
	removeChild(wheel_mc);
	my_ta.text=e.toString();
	my_ta.visible=true;
}


NetConnection.Call.Failed amfphp2.0