<?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>Flash/Flex Developer &#187; flex veri alış-verişi</title>
	<atom:link href="http://blog.ismailsimsek.com/tag/flex-veri-alis-verisi/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.ismailsimsek.com</link>
	<description></description>
	<lastBuildDate>Thu, 22 Dec 2011 14:58:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Flex ile amfphp kullanmak</title>
		<link>http://blog.ismailsimsek.com/php/amfphp/flex-ile-amfphp-kullanmak.html</link>
		<comments>http://blog.ismailsimsek.com/php/amfphp/flex-ile-amfphp-kullanmak.html#comments</comments>
		<pubDate>Tue, 25 Aug 2009 21:30:28 +0000</pubDate>
		<dc:creator>İsmail Şimşek</dc:creator>
				<category><![CDATA[Amfphp]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[amfphp configuration]]></category>
		<category><![CDATA[flex builder]]></category>
		<category><![CDATA[flex veri alış-verişi]]></category>
		<category><![CDATA[remoteobject]]></category>
		<category><![CDATA[services-config]]></category>

		<guid isPermaLink="false">http://www.webtimi.com/ismail/blog/?p=95</guid>
		<description><![CDATA[Flex içinden veritabanına erişebilmek veritabanında işlem yapabilmek için server tarafında çalışacak olan bir yazılım diline ihtiyacımız var. Ben php kullanıyorum. Tabiki yakında asp de lazım olacak farklı işler için onu da öğrenmek lazım. Flash, flex için doğan bu ihtiyaçtan ötürü amfphp geliştirilmiş. Bu ara script ile veriler 10 kat daha hızlı iletiliyor ve alınıyor. (tabi bu hız sizin sql sorqularınıza göre değişiklik gösterecektir.) tek yapmanız gereken php dosyanızı sınıf şeklinde hazırlamak. Başka türlü bir verim [...]]]></description>
			<content:encoded><![CDATA[<p>Flex içinden veritabanına erişebilmek veritabanında işlem yapabilmek için server tarafında çalışacak olan bir yazılım diline ihtiyacımız var. Ben php kullanıyorum. Tabiki yakında asp de lazım olacak farklı işler için onu da öğrenmek lazım.</p>
<p>Flash, flex için doğan bu ihtiyaçtan ötürü <a title="Amfphp Home Page" href="http://www.amfphp.org/" target="_blank">amfphp</a> geliştirilmiş. Bu ara script ile veriler 10 kat daha hızlı iletiliyor ve alınıyor. (tabi bu hız sizin sql sorqularınıza göre değişiklik gösterecektir.) tek yapmanız gereken php dosyanızı sınıf şeklinde hazırlamak. Başka türlü bir verim alamazsınız amfphp den.<span id="more-95"></span></p>
<p>Öncelikle <a title="Amfphp indir" href="http://sourceforge.net/projects/amfphp/files/amfphp/amfphp%201.9%20beta2/amfphp-1.9.beta.20080120.zip/download" target="_blank">şu adresteki</a> amfphp dosyamızı bilgisayarımıza indirip localhostta uygun bir yere çıkartıyoruz. Daha sonra çıkarttığımız dosyaya şu adres ile ulaşıp (127.0.0.1 yerine localhost yazarsanız da sonuç değişmez bu benim tercihim :))“http://127.0.0.1/cikartiginiz_dosyanin_adi/browser/” tarayıcımızla ulaşıp karşımıza gelen ekranda hiçbir şeye dokunmadan “Save” diyoruz. (ben amfphp isimli bir dosyaya çıkarttım).</p>
<p><img class="alignnone size-full wp-image-96" title="1" src="/wp-content/uploads/2009/08/1.jpg" alt="1" width="537" height="362" /></p>
<p>Artık kullanıma hazır. Soldaki menüden hazırladığımız sınıflara ulaşabilir arayüz üzerinden direkt olarak bu sınıflara erişebilir hatta kullanabilir sonuçlarını görebiliriz.</p>
<p>Peki php de nasıl sınıf yazacağız. Aslında çok basit. Ben sadece basitçe göstereceğim. Siz sonra geliştirisiniz. Sınıf dosyalarımızı services isimli klasörde saklamamız gerekiyor.  küçük birkaç not eğer sınıf içinde sınıfımızla aynı ismi taşıyan bir fonksiyonumuz varsa bu otomatik olarak yapılandırıcı fonksiyon olarak atanır ve ilk olarak bu fonksiyon çalışır. Örneğin veritabanı gerektiren uygulamalarınızda veritabanı bağlantılarınızı bu fonksiyon içine tanımlayabilirsiniz.</p>
<div class="igBar"><span id="lphp-4"><a href="#" onclick="javascript:showPlainTxt('php-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-4">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;lt;?php</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> deneme1 <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> ilkdeneme<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$veri</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> &amp;quot;Gönderdiğiniz&nbsp; veri -&amp;gt; &amp;quot; . <span style="color:#0000FF;">$veri</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Bu şekilde ilk sınıfımızı oluşturduk. Browser panelimizi refresh ettiğimizde karşımıza sınıfımız gelecektir.<br />
Gördüğünüz gibi sınıfımız karşımızda ve direk kullanıma hazır.</p>
<p><img class="alignnone size-full wp-image-97" title="2" src="/wp-content/uploads/2009/08/2.jpg" alt="2" width="569" height="401" /></p>
<p>Ekrandaki text alanına herhangi bir şey yazıp call diyerek test edebiliriz.</p>
<p>Gelelim Flex tarafına.<br />
Öncelikle yeni bir flex Project oluşturup src dizinine bu adresten indireceğiniz xml dosyasını koyuyoruz. Bu dosya flex in amfphp ile iletişiminde hayati rol oynuyor bizim için. Burada dikkat etmemiz gerekn nokta şu dosya içerisinde bir yeri amfphp yi attığımız yere göre kendimiz düzeltmeliyiz (benim dosyamı indirdiğiniz için benim dosyanın yolu yazıyor.)<br />
<span style="color: #ff0000;"><strong>&lt;endpoint uri=”http://127.0.0.1/sizin_amfphp_icerigini_cikarttiginiz_klasor_ismi/gatewat.php”/&gt;</strong></span></p>
<p>Aşağıdaki örnek görüntüde daha iyi göreceksiniz değiştirmeniz gereken yeri.</p>
<p><img class="alignnone size-full wp-image-98" title="3" src="/wp-content/uploads/2009/08/3.jpg" alt="3" width="713" height="284" /></p>
<p>Daha sonra flex navigatörden oluşturduğumuz projeye sağ tıklayıp “Properties” i seçiyoruz.</p>
<p><img class="alignnone size-full wp-image-99" title="4" src="/blog/wp-content/uploads/2009/08/4.jpg" alt="4" width="303" height="493" /></p>
<p>Buradan “Flex Compiler” seçeneğine tıklayarak karşımıza gelen text alanına şunları ekliyoruz. Parantezler içindeki bölüm (evet en başta boşluk var)</p>
<p>( -services "services-config.xml") son olarak görüntü aşağıdaki gibi olmalı.</p>
<p><img class="alignnone size-full wp-image-100" title="5" src="/wp-content/uploads/2009/08/5.jpg" alt="5" width="625" height="536" /></p>
<p>Bu kısmıda Apply ve OK diyerek geçtikten sonra artık kodlamaya geçebiliriz. Çok karışık değil bunları bi kere yapacağız gerisi sınıf dosyasını ve flex uygulamamızı geliştirdikçe gelişecek…ayrıca bunları bir kere yapınca kopyala yapıştır ile diğer projelerinizede aktarabilirsiniz ben öyle yapıyorum J</p>
<p>Öncelikle çalışma alanımıza bir adet TextInput, bir adet Button ve bir adet label yerleştiriyoruz. textInput’a id olarak “gonderilenVeri“ yazıyoruz. Butona da “gonder” id sini verelim.. Butona tıklandığında “veriGonder” fonksiyonunu çalıştırmasını söyleyelim.  Ve uygulamamıza amfphp yi remoteobject olarak ekliyelim. Bu durumda</p>
<p>Sonuç olarak:</p>
<div class="igBar"><span id="lactionscript-5"><a href="#" onclick="javascript:showPlainTxt('actionscript-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-5">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;lt;?<span style="color: #0066CC;">xml</span> <span style="color: #0066CC;">version</span>=&amp;quot;<span style="color: #cc66cc;color:#800000;">1</span>.<span style="color: #cc66cc;color:#800000;">0</span>&amp;quot; encoding=&amp;quot;utf-<span style="color: #cc66cc;color:#800000;">8</span>&amp;quot;?&amp;gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;lt;mx:Application xmlns:mx=&amp;quot;http:<span style="color: #808080; font-style: italic;">//www.adobe.com/2006/mxml&amp;quot;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; layout=&amp;quot;absolute&amp;quot;&amp;gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &amp;lt;mx:Script&amp;gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &amp;lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">Alert</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">FaultEvent</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">ResultEvent</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> veriGonder<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//yapılacak&nbsp; işlemler.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> ilkDenemeSonuc<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:ResultEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//yapılacak&nbsp; işlemler.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> hata<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:FaultEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//hata döndüren handler....</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span>&amp;quot;Hata&nbsp; Kodu:\n&amp;quot; + <span style="color: #0066CC;">e</span>.<span style="color: #006600;">fault</span>.<span style="color: #006600;">faultCode</span> + &amp;quot;\n\n&amp;quot; + &amp;quot;Hata&nbsp; Mesajı:\n&amp;quot; + <span style="color: #0066CC;">e</span>.<span style="color: #006600;">fault</span>.<span style="color: #006600;">faultString</span> + &amp;quot;\n\nHata Detayı:\n&amp;quot; + <span style="color: #0066CC;">e</span>.<span style="color: #006600;">fault</span>.<span style="color: #006600;">faultDetail</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>&amp;gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &amp;lt;/mx:Script&amp;gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &amp;lt;mx:RemoteObject id=&amp;quot;amf&amp;quot;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; fault=&amp;quot;hata<span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span>&amp;quot;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; showBusyCursor=&amp;quot;true&amp;quot;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; source=&amp;quot;deneme1&amp;quot;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; destination=&amp;quot;amfphp&amp;quot;&amp;gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &amp;lt;mx:method <span style="color: #0066CC;">name</span>=&amp;quot;ilkdeneme&amp;quot;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; result=&amp;quot;ilkDenemeSonuc<span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span>&amp;quot;/&amp;gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &amp;lt;/mx:RemoteObject&amp;gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &amp;lt;mx:TextInput id=&amp;quot;gonderilenVeri&amp;quot;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;x=&amp;quot;<span style="color: #cc66cc;color:#800000;">120</span>&amp;quot;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;y=&amp;quot;<span style="color: #cc66cc;color:#800000;">10</span>&amp;quot;/&amp;gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &amp;lt;mx:<span style="color: #0066CC;">Button</span> id=&amp;quot;gonder&amp;quot;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; x=&amp;quot;<span style="color: #cc66cc;color:#800000;">167</span>.<span style="color: #cc66cc;color:#800000;">5</span>&amp;quot;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; y=&amp;quot;<span style="color: #cc66cc;color:#800000;">40</span>&amp;quot;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; label=&amp;quot;Gönder&amp;quot;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; click=&amp;quot;veriGonder<span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span>&amp;quot;/&amp;gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;lt;/mx:Application&amp;gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Burada RemoteObject kısmını açıklayacak olursak; id ile RemoteObject nesnemize bir id veriyoruz daha sonra bu isim ile ulaşacağız kendisine. fault ile gönderim ya da alım sırasında bir hata oluştuğunda tetiklenecek olan fonksiyonu belirledik. Burada hata fonksiyonu hata kodunu hata mesajını ve deyaını bize alert olarak gösterecektir. showBusyCursor ile veri alışverişi sırasında flexe özgü bekleme cursor unun gösterilmesini sağlıyoruz. Source ise amfphp deki sınıf dosyamızın adı. Destination ise amfphp dosyamızın bulunduğu hedef klasör benim bilgisayarımda bu klasörün adı amfphp. Sınıf içerisinde tanımladığımız fonksiyonlara erişmek için RemoteObject nesnesi tagları arasına method taglarını yazıyoruz. Burada ilkdeneme methodumun adını (Dikkat: aynı zamanda php deki fonksiyon ismi)result ise bu method dan dönen sonuçların hangi fonksiyona aktarılacağını gösteriyor.</p>
<p>Burada dikkat edeceğimiz ikinci nokta şu: tanımladığımız fonksiyonlara gelen verilerin türleri. Hata fonksiyonunda FaultEvent tetiklenir.  ilkDenemeSonuc fonksiyonunda ResultEvent tetiklenir.<br />
Şimdi de veriGonder fonksiyonumuza kodlarımızı yazalım.</p>
<p>amf.getOperation(<strong>"ilkdeneme"</strong>).send(gonderilenVeri.text);</p>
<p>Burada yaptığımız şey şu: ilk deneme isimli methoda gonderilenVeri deki veriyi gönderdik. Hangi methoda veri göndereceksek bu şekilde verimizi gönderebiliriz.  İstediğimiz kadar veri gönderebiliriz. Sadece aralarına virgül koymamız yeterli. Tabi php tarafında da bu verileri karşılamamız lazım ki sonra sen 3 gönderdim ama bu tarafta 1 bekleniyordu hataları almayasınız.<br />
Dönen veriyi ekranda göstermek için ilkDenemeSonuc fonksiyonuna şu kodları yazıyoruz:</p>
<p>Alert.show(e.message.body.toString(),"Dönen Veri");</p>
<p>Yani e ye dönen mesajın gövdesindeki değeri stringe çevir ve alert ile göster dedik. Fonksiyonlarımızın son halleri şu şekilde oldu:</p>
<div class="igBar"><span id="lactionscript-6"><a href="#" onclick="javascript:showPlainTxt('actionscript-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-6">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> veriGonder<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; amf.<span style="color: #006600;">getOperation</span><span style="color: #66cc66;">&#40;</span>&amp;quot;ilkdeneme&amp;quot;<span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">send</span><span style="color: #66cc66;">&#40;</span>gonderilenVeri.<span style="color: #0066CC;">text</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> ilkDenemeSonuc<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:ResultEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">message</span>.<span style="color: #006600;">body</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, &amp;quot;Dönen&nbsp; Veri&amp;quot;<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Artık çalıştırabiliriz. Burada güzel olan şu dosyanızın uzantısı html olarak kalıyor dosyanızı localhost içersine aymanıza gerek yok çift tıklayarak çalıştırdığınızda o kendi dosyayı bulacaktır artık. Service-config.xml dosyası bu işe yarıyor. Sonucu hep birlikte görelim:</p>
<p><img class="alignnone size-full wp-image-101" title="6" src="/wp-content/uploads/2009/08/6.jpg" alt="6" width="434" height="248" /></p>
<p>Evet sonuc başarılı. İlk veri alış verişini gerçekleştirdik. Bu olayı geliştirmek size kalıyor. Sorularınızı bana iletebilirsiniz. Aşağıdaki linkten uygulamanın dosyalarına erişebilirsiniz. (uygulama zip halinde bunu flex içersine import etmeniz gerekiyor. nasıl yaparım diyorsanız buyurun sizi şöyle alalım.)</p>
<p><a href="../../amfphpinflex.rar" target="_blank">Buradan indirelim...</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ismailsimsek.com/php/amfphp/flex-ile-amfphp-kullanmak.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

