<?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>Point47 &#187; ActionScript</title>
	<atom:link href="http://point47.com/journal/category/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://point47.com/journal</link>
	<description>less talk more code</description>
	<lastBuildDate>Tue, 08 May 2012 10:53:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Post data from Actionscript 3 to PHP</title>
		<link>http://point47.com/journal/2010/06/post-data-from-actionscript-3-to-php/</link>
		<comments>http://point47.com/journal/2010/06/post-data-from-actionscript-3-to-php/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 09:39:39 +0000</pubDate>
		<dc:creator>Sorin</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://point47.com/journal/?p=123</guid>
		<description><![CDATA[If you need to send some data to a PHP script and don&#8217;t want to use services like Zend_AMF you can try posting that data directly to the PHP script. With the code bellow I&#8217;ll actually send an email. // &#8230; <a href="http://point47.com/journal/2010/06/post-data-from-actionscript-3-to-php/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you need to send some data to a PHP script and don&#8217;t want to use services like <a href="http://framework.zend.com/download/amf" target="_blank">Zend_AMF</a> you can try posting that data directly to the PHP script.<br />
With the code bellow I&#8217;ll actually send an email.<br />
<span id="more-123"></span><br />
// ActionScript 3 Code<br />
// PostToPHP.as<br />
[actionscript]<br />
package<br />
{<br />
        import flash.events.Event;<br />
	import flash.events.HTTPStatusEvent;<br />
        import flash.net.URLLoader;<br />
	import flash.net.URLLoaderDataFormat;<br />
	import flash.net.URLRequest;<br />
	import flash.net.URLRequestMethod;<br />
	import flash.net.URLVariables;</p>
<p>    public class PostToPHP<br />
    {<br />
        // url to post<br />
        private var postToURL:String = &#8220;http://www.yourdomain.tld/post_receiver.php&#8221;;</p>
<p>        public function PostToPHP()<br />
        {<br />
            // create request<br />
            var request:URLRequest = new URLRequest( postToURL );</p>
<p>	    // set post variables<br />
            var requestVars:URLVariables = new URLVariables();<br />
            requestVars.emailTo 	 = &#8216;email.address@mailservice.tld&#8217;;<br />
            requestVars.subject 	 = &#8216;This is a test email&#8217;;<br />
            requestVars.message = &#8216;An this is the content of the message.&#8217;;</p>
<p>            // assign variables to the request and set request method type<br />
            request.data     = requestVars;<br />
            request.method = URLRequestMethod.POST;</p>
<p>            // load the request and listen for a response from the PHP script<br />
            var urlLoader:URLLoader = new URLLoader();<br />
            urlLoader.dataFormat = &#8220;text&#8221;;<br />
            urlLoader.addEventListener(Event.COMPLETE, urlLoader_handler, false, 0, true);<br />
            urlLoader.load(request);<br />
    }</p>
<p>    private function urlLoader_handler(e:Object):void<br />
    {<br />
           // the response given from the PHP script will be traced here<br />
	   trace(e.target.data);<br />
    }<br />
[/actionscript]</p>
<p>// PHP code<br />
// post_receiver.php</p>
<pre class="brush: php; title: ; notranslate">
// assign POST variables and clean them
// filter_var() is available from PHP 5.2.0
$emailTo 	= filter_var($_POST['emailTo'], FILTER_SANITIZE_EMAIL);
$subject 	= filter_var($_POST['subject'], FILTER_SANITIZE_STRING);
$message   = filter_var($_POST['message'], FILTER_SANITIZE_STRING);

// send mail and remember function response
// boolean response
$mailSent = mail($emailTo, $subject, $message);

// the echoed response will be traced in actionscript
if($mailSent == true)
{
    echo 'mail sent';
}
else
{
    echo 'mail NOT sent';
}
</pre>
<p>Simple.</p>
<p>Hey did you know about this?<br />
<a href="http://themeforest.net?ref=forapathy" title="wordpress themes, site templates, psd" target="_blank"><img src="http://envato.s3.amazonaws.com/referrer_adverts/tf_468x60_v4.gif" alt="wordpress themes, site templates" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://point47.com/journal/2010/06/post-data-from-actionscript-3-to-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Reverse la o animatie Flash cu ActionScript 3.0</title>
		<link>http://point47.com/journal/2008/11/reverse-la-o-animatie-flash-cu-actionscript-30/</link>
		<comments>http://point47.com/journal/2008/11/reverse-la-o-animatie-flash-cu-actionscript-30/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 15:10:07 +0000</pubDate>
		<dc:creator>Sorin</dc:creator>
				<category><![CDATA[ActionScript]]></category>

		<guid isPermaLink="false">http://point47.com/journal/?p=17</guid>
		<description><![CDATA[Exemplu: 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647/* @ ActionScript 3 * Reverse la o animatie ------------------------------------ Scena contine un movie clip cu nume de instanta: &#160;img Movie clipul e o animatie de 60 frame-uri in care se mareste poza. ----------------------------------------------------- */ // activeaza movie clip-ul &#8230; <a href="http://point47.com/journal/2008/11/reverse-la-o-animatie-flash-cu-actionscript-30/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Exemplu:</p>
<p><script language="javascript">
	if (AC_FL_RunContent == 0) {
		alert("This page requires AC_RunActiveContent.js.");
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', '400',
			'height', '300',
			'src', 'img_in_out',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'window',
			'devicefont', 'false',
			'id', 'img_in_out',
			'bgcolor', '#ffffff',
			'name', 'img_in_out',
			'menu', 'true',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', '/journal/wp-content/uploads/2008/11/img_in_out',
			'salign', ''
			); //end AC code
	}
</script><br />
<noscript><br />
	<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="400" height="300" id="img_in_out" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="false" /><param name="movie" value="/journal/wp-content/uploads/2008/11/img_in_out.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="/journal/wp-content/uploads/2008/11/img_in_out.swf" quality="high" bgcolor="#ffffff" width="400" height="300" name="img_in_out" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /><br />
	</object><br />
</noscript></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:610px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/*<br />
@ ActionScript 3<br />
* Reverse la o animatie<br />
------------------------------------<br />
Scena contine un movie clip cu nume de instanta: &nbsp;img<br />
Movie clipul e o animatie de 60 frame-uri in care se mareste poza.<br />
-----------------------------------------------------<br />
*/<br />
<br />
// activeaza movie clip-ul ca buton<br />
img.buttonMode = true;<br />
// dezactiveaza eventualele <br />
img.mouseChildren = false;<br />
<br />
// adauga 2 eventListener pe imagine<br />
// pentru mouse over<br />
img.addEventListener(MouseEvent.ROLL_OVER,overThat,false,0,true);<br />
// pentru mouse out<br />
img.addEventListener(MouseEvent.ROLL_OUT,outThat,false,0,true);<br />
<br />
// cand cursorul este peste mc adauga un nou eventListener<br />
// si activeaza functia &quot;inainte&quot;<br />
function overThat(event:MouseEvent):void {<br />
&nbsp; &nbsp; event.target.removeEventListener(Event.ENTER_FRAME,inapoi);<br />
&nbsp; &nbsp; event.target.addEventListener(Event.ENTER_FRAME,inainte,false,0,true);<br />
}<br />
<br />
// cand cursorul iese de pe zona mc-ului scoate eventListener-ul existent<br />
// si activeaza functia &quot;inapoi&quot;<br />
function outThat(event:MouseEvent):void {<br />
&nbsp; &nbsp; event.target.removeEventListener(Event.ENTER_FRAME,inainte);<br />
&nbsp; &nbsp; if (!event.target.hasEventListener(Event.ENTER_FRAME)) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; event.target.addEventListener(Event.ENTER_FRAME,inapoi,false,0,true);<br />
&nbsp; &nbsp; }<br />
}<br />
<br />
// atat timp cat mouse-ul este peste mc-ul &quot;img&quot; este activata aceasta functie<br />
// si merge pana da peste &quot;stop&quot; in timeline-ul din movie clip<br />
function inainte(event:Event):void {<br />
&nbsp; &nbsp; event.target.nextFrame();<br />
&nbsp; &nbsp; <br />
}<br />
<br />
// e reversul functiei &quot;inainte&quot;<br />
function inapoi(event:Event):void {<br />
&nbsp; &nbsp; event.target.prevFrame();<br />
}</div></td></tr></tbody></table></div>
<p>Sursele complete aici: <a href="http://point47.com/journal/wp-content/uploads/2008/11/img_in_out.fla">img_in_out.fla</a> (Flash CS3). Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://point47.com/journal/2008/11/reverse-la-o-animatie-flash-cu-actionscript-30/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

