﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Armando Leopoldo Keller &#187; AMFPHP</title>
	<atom:link href="http://armandokeller.com/blog/category/amfphp/feed/" rel="self" type="application/rss+xml" />
	<link>http://armandokeller.com/blog</link>
	<description>Actionscript, AIR, Python, Engenharia Elétrica....</description>
	<lastBuildDate>Tue, 24 Jan 2012 19:26:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>AMFPHPconn Classe de conexão com AMFPHP</title>
		<link>http://armandokeller.com/blog/2007/12/amfphpconn-classe-de-conexao-com-amfphp/</link>
		<comments>http://armandokeller.com/blog/2007/12/amfphpconn-classe-de-conexao-com-amfphp/#comments</comments>
		<pubDate>Fri, 28 Dec 2007 17:04:59 +0000</pubDate>
		<dc:creator>Armando Leopoldo Keller</dc:creator>
				<category><![CDATA[AMFPHP]]></category>
		<category><![CDATA[AS 2.0]]></category>
		<category><![CDATA[Actionscript 2]]></category>
		<category><![CDATA[AMFPHPconn]]></category>
		<category><![CDATA[classe]]></category>
		<category><![CDATA[conexao]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://alkeller.wordpress.com/2007/12/28/amfphpconn-classe-de-conexao-com-amfphp/</guid>
		<description><![CDATA[Oi, AMFPHPconn é uma classe desenvolvida por mim para facilitar a conexão com o AMFPHP segue abaixo a classe:
// AMFPHPconn.as
import mx.remoting.Service;
import mx.services.Log;
class AMFPHPconn {
public var gateway:String;
public var log:Log;
public var servico:String;
public var Servico:Service;
public function AMFPHPconn (_gateway, _servico, _log) {
this.gateway = _gateway;
this.servico = _servico;
this.log = _log;
this.Servico = new Service(this.gateway, this.log, this.servico, null, null);
}
}

Para utilizar essa classe é só colocar o arquivo AMFPHPconn.as na mesma pasta do SWF.

um exemplo de como utilizar:

// importador.as
import mx.remoting.Service;
import mx.services.Log;
import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;
import mx.remoting.PendingCall;
import mx.remoting.RecordSet;

// no flash:

#include "importador.as"
var conn:AMFPHPconn = new AMFPHPconn("http://localhost/amfphp/gateway.php","Login");
// é opcional colocar log
//com log ficaria:
//var conn:AMFPHPconn = new AMFPHPconn("http://localhost/amfphp/gateway.php","Login",new log());
var pc_loga:PendingCall = conn.Servico.loga("armando","keller");
pc_loga.responder = new RelayResponder(this,"rpc_loga",null);
function rpc_loga(re:ResultEvent){
trace("retornou "+re.result);
}]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://armandokeller.com/blog/2007/12/amfphpconn-classe-de-conexao-com-amfphp/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div><div class="socialize-in-button socialize-in-button-vertical"><script>
			<!-- 
			var fbShare = {
				url: "http://armandokeller.com/blog/2007/12/amfphpconn-classe-de-conexao-com-amfphp/",
				size: "large",
				google_analytics: "true"
			}
			//-->
			</script>
                        <script src="http://widgets.fbshare.me/files/fbshare.js"></script></div><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript"><!-- 
		(function() {
		var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];
		s.type = 'text/javascript';
		s.async = true;
		s.src = 'http://widgets.digg.com/buttons.js';
		s1.parentNode.insertBefore(s, s1);
		})();
		//-->
		</script><a class="DiggThisButton " href="http://digg.com/submit?url=http%3A%2F%2Farmandokeller.com%2Fblog%2F2007%2F12%2Famfphpconn-classe-de-conexao-com-amfphp%2F"></a></div><div class="socialize-in-button socialize-in-button-vertical"><div class="delicious-button"><div class="del-top"><span id="5">0</span>saves</div><div class="del-bot"><a href="http://delicious.com/save" onclick="window.open('http://delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;">Save</a></div></div>
		<script>
			<!-- 
			function displayURL(data) { var urlinfo = data[0]; if (!urlinfo.total_posts) return;document.getElementById('5').innerHTML = urlinfo.total_posts;}
			//-->
		</script>
		<script src = "http://badges.del.icio.us/feeds/json/url/data?url=http://armandokeller.com/blog/2007/12/amfphpconn-classe-de-conexao-com-amfphp/&amp;callback=displayURL"></script></div></div><p>Oi, AMFPHPconn é uma classe desenvolvida por mim para facilitar a conexão com o <a href="http://www.amfphp.org/" title="AMFPHP site oficial" target="_blank">AMFPHP</a> segue abaixo a classe:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #009900; font-style: italic;">//  AMFPHPconn.as</span>
<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>remoting<span style="color: #000066; font-weight: bold;">.</span>Service<span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>services<span style="color: #000066; font-weight: bold;">.</span>Log<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #9900cc; font-weight: bold;">class</span> AMFPHPconn
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> gateway<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">log</span><span style="color: #000066; font-weight: bold;">:</span>Log<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> servico<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> Servico<span style="color: #000066; font-weight: bold;">:</span>Service<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> AMFPHPconn <span style="color: #000000;">&#40;</span>_gateway<span style="color: #000066; font-weight: bold;">,</span> _servico<span style="color: #000066; font-weight: bold;">,</span> _log<span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>gateway = _gateway<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>servico = _servico<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">log</span> = _log<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>Servico = <span style="color: #0033ff; font-weight: bold;">new</span> Service<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>gateway<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">log</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>servico<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Para utilizar essa classe é só colocar o arquivo AMFPHPconn.as  na mesma pasta do SWF.</p>
<p>um exemplo de  como utilizar:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #009900; font-style: italic;">// importador.as</span>
<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>remoting<span style="color: #000066; font-weight: bold;">.</span>Service<span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>services<span style="color: #000066; font-weight: bold;">.</span>Log<span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>rpc<span style="color: #000066; font-weight: bold;">.</span>RelayResponder<span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>rpc<span style="color: #000066; font-weight: bold;">.</span>FaultEvent<span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>rpc<span style="color: #000066; font-weight: bold;">.</span>ResultEvent<span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>remoting<span style="color: #000066; font-weight: bold;">.</span>PendingCall<span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>remoting<span style="color: #000066; font-weight: bold;">.</span>RecordSet<span style="color: #000066; font-weight: bold;">;</span></pre></td></tr></table></div>

<p>// no flash:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;">#include <span style="color: #990000;">&quot;importador.as&quot;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> conn<span style="color: #000066; font-weight: bold;">:</span>AMFPHPconn = <span style="color: #0033ff; font-weight: bold;">new</span> AMFPHPconn<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;http://localhost/amfphp/gateway.php&quot;</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #990000;">&quot;Login&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #009900; font-style: italic;">// é opcional colocar log</span>
<span style="color: #009900; font-style: italic;">//com log ficaria:</span>
<span style="color: #009900; font-style: italic;">//var conn:AMFPHPconn = new AMFPHPconn(&quot;http://localhost/amfphp/gateway.php&quot;,&quot;Login&quot;,new log());</span>
<span style="color: #6699cc; font-weight: bold;">var</span> pc_loga<span style="color: #000066; font-weight: bold;">:</span>PendingCall = conn<span style="color: #000066; font-weight: bold;">.</span>Servico<span style="color: #000066; font-weight: bold;">.</span>loga<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;armando&quot;</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #990000;">&quot;keller&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
pc_loga<span style="color: #000066; font-weight: bold;">.</span>responder = <span style="color: #0033ff; font-weight: bold;">new</span> RelayResponder<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #990000;">&quot;rpc_loga&quot;</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #339966; font-weight: bold;">function</span> rpc_loga<span style="color: #000000;">&#40;</span>re<span style="color: #000066; font-weight: bold;">:</span>ResultEvent<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;retornou &quot;</span><span style="color: #000066; font-weight: bold;">+</span>re<span style="color: #000066; font-weight: bold;">.</span>result<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://armandokeller.com/blog/2007/12/amfphpconn-classe-de-conexao-com-amfphp/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

