<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Prashant's Weblog</title>
	<atom:link href="http://prashantbhagwat.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://prashantbhagwat.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Wed, 13 Aug 2008 14:48:12 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='prashantbhagwat.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/6c28dfc93f96a047603f7a3fc7ecb18c?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Prashant's Weblog</title>
		<link>http://prashantbhagwat.wordpress.com</link>
	</image>
			<item>
		<title>AIR_SWF communication</title>
		<link>http://prashantbhagwat.wordpress.com/2008/08/13/air_swf-communication/</link>
		<comments>http://prashantbhagwat.wordpress.com/2008/08/13/air_swf-communication/#comments</comments>
		<pubDate>Wed, 13 Aug 2008 14:48:12 +0000</pubDate>
		<dc:creator>prashantbhagwat</dc:creator>
				<category><![CDATA[Blogroll]]></category>
		<category><![CDATA[Communicating from AIR/Flex to SWF]]></category>
		<category><![CDATA[SWF to AIR/Flex communication]]></category>

		<guid isPermaLink="false">http://prashantbhagwat.wordpress.com/?p=6</guid>
		<description><![CDATA[Hi,
Below is example which gives the idea how to communicate between AIR/Flex application and SWF (which is created using Flash 8).
Step 1: Create a Flex Project (Desktop application) and copy paste the following code in mxml file.
&#60;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&#62;
&#60;mx:WindowedApplication xmlns:mx=&#8221;http://www.adobe.com/2006/mxml&#8221; layout=&#8221;vertical&#8221; creationComplete=&#8221;fnInit()&#8221;&#62;
&#60;mx:Script&#62;
&#60;![CDATA[
import mx.controls.Alert;
import flash.net.LocalConnection;
import flash.events.StatusEvent;
// This variable is used to accept the connection from SWF
private [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=prashantbhagwat.wordpress.com&blog=1513042&post=6&subd=prashantbhagwat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Hi,</p>
<p>Below is example which gives the idea how to communicate between AIR/Flex application and SWF (<em>which is created using Flash 8</em>).</p>
<p><em><strong>Step 1:</strong></em> Create a Flex Project (Desktop application) and copy paste the following code in mxml file.</p>
<p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt;<br />
&lt;mx:WindowedApplication xmlns:mx=&#8221;http://www.adobe.com/2006/mxml&#8221; layout=&#8221;vertical&#8221; creationComplete=&#8221;fnInit()&#8221;&gt;<br />
&lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
import mx.controls.Alert;<br />
import flash.net.LocalConnection;<br />
import flash.events.StatusEvent;</p>
<p>// This variable is used to accept the connection from SWF<br />
private var incommingConn : LocalConnection;<br />
// This variable is used to establish the connection with SWF<br />
private var outgoingConn : LocalConnection;</p>
<p>private function fnInit () : void<br />
{<br />
outgoingConn = new LocalConnection;<br />
outgoingConn.addEventListener (StatusEvent.STATUS, fnOnStatus);</p>
<p>incommingConn = new LocalConnection ();<br />
incommingConn.allowDomain();<br />
incommingConn.client = this;</p>
<p>try<br />
{<br />
incommingConn.connect ("SWFtoAIR");<br />
}<br />
catch (err : Error)<br />
{<br />
Alert.show ("Connection is already in use by other SWF. " + err.message);<br />
}<br />
}</p>
<p>private function fnOnStatus (evt : StatusEvent) : void<br />
{<br />
switch (evt.level)<br />
{<br />
case 'status':<br />
Alert.show ("LocalConnection is established.");<br />
break;<br />
case 'error':<br />
Alert.show ("LocalConnection is failed.");<br />
break;<br />
}<br />
}<br />
// This method establish the connection with SWF and call the SWF method 'fnRecieveMessage'.<br />
private function fnSendMessage (str : String) : void<br />
{<br />
outgoingConn.send("localhost:AIRtoSWF", "fnReceiveMessage", str);<br />
}<br />
// This method is called from SWF when connection is established successfully<br />
public function fnGetMessageFromSWF (str : String) : void<br />
{<br />
Alert.show ("Message recieved : " + str);<br />
}<br />
]]&gt;<br />
&lt;/mx:Script&gt;<br />
&lt;mx:Button id=&#8221;btnMsg&#8221; label=&#8221;Send Message&#8221; click=&#8221;fnSendMessage (&#8216;MSG from AIR&#8217;);&#8221;/&gt;<br />
&lt;/mx:WindowedApplication&gt;</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p><em><strong>Step 2:</strong></em> Create a Flash document file and copy paste the following code in file.</p>
<p><strong><br />
</strong></p>
<p>stop();<br />
// This variable accept the incomming connection from AIR application<br />
var incommingConn : LocalConnection;<br />
// This vaiable establish the connection with AIR application<br />
var outgoingConn : LocalConnection;<br />
//<br />
fnInit ();<br />
//<br />
function fnInit ()<br />
{<br />
outgoingConn = new LocalConnection ();<br />
//<br />
incommingConn = new LocalConnection ();<br />
incommingConn.allowDomain(&#8220;*&#8221;);<br />
incommingConn.connect(&#8220;AIRtoSWF&#8221;);<br />
}<br />
// This is a callback method called from AIR application when connection established successfully<br />
incommingConn.fnReceiveMessage = function (msg:String)<br />
{<br />
msg_txt.text = msg;<br />
}<br />
// This callback method indicate that it is ready to accept the request from AIR application<br />
incommingConn.allowDomain = function ()<br />
{<br />
return true;<br />
}<br />
// This method is called whenever SWF communicate with AIR application<br />
outgoingConn.onStatus = function (info:Object)<br />
{<br />
switch (info.level)<br />
{<br />
case &#8217;status&#8217;:<br />
debug_txt.text = &#8220;Local connection is succecced.&#8221;;<br />
break;<br />
case &#8216;error&#8217;:<br />
debug_txt.text = &#8220;Local connection fail to connect.&#8221;;<br />
break;<br />
}<br />
}<br />
// This method establish the connection with AIR and call the AIR method &#8216;fnGetMessageFromSWF&#8217;.<br />
function fnSendMessage ()<br />
{<br />
outgoingConn.send(&#8220;app#AIR-SWF-Communication:SWFtoAIR&#8221;, &#8220;fnGetMessageFromSWF&#8221;, &#8220;Message from SWF to AIR app.&#8221;);<br />
}</p>
<p><em><strong>Step 3:</strong></em> Run Flex application and SWF and test the code.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Small explanation about Flash code -<br />
In Flash file I have created two textfields, debug_txt to show the connection status, and msg_txt to display the message received from AIR/Flex application.</p>
<p>To send the message from Flash to AIR/Flex I have written the function <em>fnSendMessage</em>. In <em>fnSendMessage</em> I have passed three parameters. The first is the domain and connection name by which communication is established, second is AIR/Flex method to be invoked, and third parameter is message that is to be sending to AIR/Flex application. This method is called on button event as <span style="text-decoration:underline;">on (release){ fnSendMessage();}</span></p>
<p>You can get the correct domain name by tracing outgoingConn.domain () method. Use this string in outgoingConn.send() method to establish a connection, in this example I have used &#8220;app#AIR-SWF-Communication:SWFtoAIR&#8221;.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/prashantbhagwat.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/prashantbhagwat.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/prashantbhagwat.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/prashantbhagwat.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/prashantbhagwat.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/prashantbhagwat.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/prashantbhagwat.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/prashantbhagwat.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/prashantbhagwat.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/prashantbhagwat.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/prashantbhagwat.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/prashantbhagwat.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=prashantbhagwat.wordpress.com&blog=1513042&post=6&subd=prashantbhagwat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://prashantbhagwat.wordpress.com/2008/08/13/air_swf-communication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5bb84c788d72dccd488ae8aa4c3439be?s=96&#38;d=identicon" medium="image">
			<media:title type="html">prashantbhagwat</media:title>
		</media:content>
	</item>
		<item>
		<title>Multi Page printing in Flash MX using Javascript</title>
		<link>http://prashantbhagwat.wordpress.com/2008/06/05/multi-page-printing-in-flash-using-javascript/</link>
		<comments>http://prashantbhagwat.wordpress.com/2008/06/05/multi-page-printing-in-flash-using-javascript/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 18:07:09 +0000</pubDate>
		<dc:creator>prashantbhagwat</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MultiPage print in Flash MX]]></category>

		<guid isPermaLink="false">http://prashantbhagwat.wordpress.com/?p=4</guid>
		<description><![CDATA[Hi,
Using Flash MX, we are not able to print the data in multiple page. If we try to print the movieclip which has text to print and this movieclip exceeds the page limit, Flash print function compress the data into single page.
To over come this problem, we have another way to print the data using [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=prashantbhagwat.wordpress.com&blog=1513042&post=4&subd=prashantbhagwat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Hi,</p>
<p>Using Flash MX, we are not able to print the data in multiple page. If we try to print the movieclip which has text to print and this movieclip exceeds the page limit, Flash print function compress the data into single page.</p>
<p>To over come this problem, we have another way to print the data using Javascript.</p>
<p>Lets see how to do it -</p>
<p><strong>Step 1:</strong> Create a flash file from where we need to print the multipage data. Which have <em>input text field</em> and <em>print button</em>. Print button will call fscommand as <em>fscommand (&#8220;printContent&#8221;);</em></p>
<p><strong>Step 2:</strong> Publish the Flash file as Flash with FSCommand.</p>
<p><strong>Step 3:</strong> Add switch statement in published HTML which will handle the FSCommand send by Flash.</p>
<p>        switch (command)<br />
        {<br />
           case &#8220;printContent&#8221;:<br />
                   var str = &#8220;&lt;html&gt;&lt;body&gt;&#8221;<br />
                  str = str + args;<br />
                  str = str + &#8220;&lt;/body&gt;&lt;/html&gt;&#8221;<br />
                  parent.forPrintFrame.document.write(str);<br />
                 fnPrintContent ();<br />
                 break;<br />
       }</p>
<p>And some more script as -</p>
<p>var t;<br />
function fnPrintContent ()<br />
{<br />
 t = setTimeout(&#8220;parent.fnPrint();&#8221;,1000);<br />
}</p>
<p><em>fnPrintContent will call another function, fnPrint (which is present in parent frame) after 1 second.</em></p>
<p><strong>Step 4:</strong> Create a empty HTML file as <em>PrintData.html</em></p>
<p><strong>Step 5</strong>: Now create <em>index.html</em> which has 2 frames like -</p>
<p>&lt;FRAME SRC=&#8221;flashFile.html&#8221; NAME=&#8221;content&#8221; NORESIZE  FRAMEBORDER=&#8221;NO&#8221;&gt;<br />
 &lt;FRAME SRC=&#8221;PrintData.html&#8221; id=&#8221;printFrm&#8221; NAME=&#8221;forPrintFrame&#8221; NORESIZE FRAMEBORDER=&#8221;NO&#8221;&gt;</p>
<p>First frame has published flash file and second frame will have empty html file.</p>
<p>Now add following function in index.html file -</p>
<p>function fnPrint ()<br />
{<br />
 window.clearTimeout(content.t);<br />
 window.forPrintFrame.focus ();<br />
 window.print ();<br />
}</p>
<p><strong>Step 6:</strong> Now run the index.html file, write some data in flash file and click the Print button.</p>
<p> </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/prashantbhagwat.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/prashantbhagwat.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/prashantbhagwat.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/prashantbhagwat.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/prashantbhagwat.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/prashantbhagwat.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/prashantbhagwat.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/prashantbhagwat.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/prashantbhagwat.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/prashantbhagwat.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/prashantbhagwat.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/prashantbhagwat.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=prashantbhagwat.wordpress.com&blog=1513042&post=4&subd=prashantbhagwat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://prashantbhagwat.wordpress.com/2008/06/05/multi-page-printing-in-flash-using-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5bb84c788d72dccd488ae8aa4c3439be?s=96&#38;d=identicon" medium="image">
			<media:title type="html">prashantbhagwat</media:title>
		</media:content>
	</item>
		<item>
		<title>Hello world!</title>
		<link>http://prashantbhagwat.wordpress.com/2007/08/13/hello-world/</link>
		<comments>http://prashantbhagwat.wordpress.com/2007/08/13/hello-world/#comments</comments>
		<pubDate>Mon, 13 Aug 2007 06:35:27 +0000</pubDate>
		<dc:creator>prashantbhagwat</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=prashantbhagwat.wordpress.com&blog=1513042&post=1&subd=prashantbhagwat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Welcome to <a href="http://wordpress.com/">WordPress.com</a>. This is your first post. Edit or delete it and start blogging!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/prashantbhagwat.wordpress.com/1/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/prashantbhagwat.wordpress.com/1/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/prashantbhagwat.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/prashantbhagwat.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/prashantbhagwat.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/prashantbhagwat.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/prashantbhagwat.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/prashantbhagwat.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/prashantbhagwat.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/prashantbhagwat.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/prashantbhagwat.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/prashantbhagwat.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=prashantbhagwat.wordpress.com&blog=1513042&post=1&subd=prashantbhagwat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://prashantbhagwat.wordpress.com/2007/08/13/hello-world/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5bb84c788d72dccd488ae8aa4c3439be?s=96&#38;d=identicon" medium="image">
			<media:title type="html">prashantbhagwat</media:title>
		</media:content>
	</item>
	</channel>
</rss>