<?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>Digicorp &#187; salesforce</title>
	<atom:link href="http://dev.digi-corp.com/category/salesforce/feed/" rel="self" type="application/rss+xml" />
	<link>http://dev.digi-corp.com</link>
	<description>&#62;&#62; Developer Blog</description>
	<lastBuildDate>Wed, 22 Jun 2011 14:13:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Run SWF file in Salesforce Environment</title>
		<link>http://dev.digi-corp.com/2009/08/run-swf-file-in-salesforce-environment/</link>
		<comments>http://dev.digi-corp.com/2009/08/run-swf-file-in-salesforce-environment/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 09:50:24 +0000</pubDate>
		<dc:creator>nishant.shah</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[salesforce]]></category>
		<category><![CDATA[scontrol]]></category>
		<category><![CDATA[swf]]></category>

		<guid isPermaLink="false">http://dev.digi-corp.com/?p=1210</guid>
		<description><![CDATA[For all the developers who are just starting development in Salesforce may find this article useful. I am going to tell you how you can run an SWF file in Salesforce. First of all add a reference to the Salesforce namespace to  mx:Application tag and create a connection to the Salesforce.com server. Eg. &#60;mx:Application xmls:mx=&#8221;http://www.adobe.com/2006/mxml&#8221;    [...]]]></description>
			<content:encoded><![CDATA[<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<p style="margin-bottom: 0in">For all the developers who are just starting development in Salesforce may find this article useful. I am going to tell you how you can run an SWF file in Salesforce.</p>
<p style="margin-bottom: 0in">First of all add a reference to the Salesforce namespace to  mx:Application tag and create a connection to the Salesforce.com server.</p>
<p style="margin-bottom: 0in"><span style="color: #800000">Eg.</span></p>
<p style="margin-bottom: 0in; padding-left: 30px;"><span style="color: #800000"> &lt;mx:Application xmls:mx=&#8221;http://www.adobe.com/2006/mxml&#8221;                      		                                          	         xmls:salesforce=&#8221;com.salesforce.*&#8221; layout = &#8220;absolute&#8221;/&gt;</span></p>
<p style="margin-bottom: 0in; padding-left: 30px;"><span style="color: #800000"> &lt;salesforce:Connection id=&#8221;apex&#8221;/&gt;</span></p>
<p style="margin-bottom: 0in"><span style="color: #000000"> The Connection object is already created, so to activate it,Prepare a LoginRequest object by populating the username and password fields. We have to define Callback function(loginResult)</span> <span style="color: #000000">that will be fired off when the login response from the Salesforce.com server is received.</span></p>
<p style="margin-bottom: 0in"><span style="color: #800000">Eg.</span></p>
<p style="margin-bottom: 0in; padding-left: 30px;"><span style="color: #800000"> private function login():void</span></p>
<p style="margin-bottom: 0in; padding-left: 30px;"><span style="color: #800000"> {</span></p>
<p style="margin-bottom: 0in; padding-left: 60px;"><span style="color: #800000"> var lr:LoginRequest = new LoginRequest;</span></p>
<p style="margin-bottom: 0in; padding-left: 60px;"><span style="color: #800000"> lr.username = username.txt;</span></p>
<p style="margin-bottom: 0in; padding-left: 60px;"><span style="color: #800000"> lr.password = password.txt;</span></p>
<p style="margin-bottom: 0in; padding-left: 60px;"><span style="color: #800000"> //  lr.server_url = Application.application.parameters.server_url;</span></p>
<p style="margin-bottom: 0in; padding-left: 60px;"><span style="color: #800000"> // lr.session_id = Application.application.parameters.session_id;</span></p>
<p style="margin-bottom: 0in; padding-left: 60px;"><span style="color: #800000"> lr.callback = new AsyncResponder(loginResult);</span></p>
<p style="margin-bottom: 0in; padding-left: 60px;"><span style="color: #800000"> apex.login(lr);</span></p>
<p style="margin-bottom: 0in; padding-left: 30px;"><span style="color: #800000"> }</span></p>
<p style="margin-bottom: 0in">No need to give lr.session_id and lr.server_url when running application on local machine.</p>
<p style="margin-bottom: 0in"><strong>Deployment</strong></p>
<p style="margin-bottom: 0in">We have three choices to deploy our application.</p>
<ol>
<li>
<p style="margin-bottom: 0in">Deploy it to own server.</p>
</li>
<li>
<p style="margin-bottom: 0in">Deploy it on Salesforce 	Environment as an S-Control.</p>
</li>
<li>
<p style="margin-bottom: 0in">Compile application as an Adobe 	AIR application and use the new runtime to use the application on 	the desktop without an application or Web-Server.</p>
</li>
</ol>
<p style="margin-bottom: 0in"><strong>Deploy application on Salesforce Environment as an S-Control</strong></p>
<p style="margin-bottom: 0in">To embed the Flex application as an S-Control , compile application for use in Salesforce by modifying the LoginRequest object in code to use the lr.server_url and lr.session_id arguments instead of lr.username and lr.password.</p>
<p style="margin-bottom: 0in">Now log in to Developer account of Salesforce.com and perform following steps.</p>
<ol>
<li>
<p style="margin-bottom: 0in">Click on Setup.</p>
</li>
<li>
<p style="margin-bottom: 0in">Expand the Develop menu and create 	S-Control.</p>
</li>
<li>
<p style="margin-bottom: 0in">Create a new one and give it 	memorable label and name.</p>
</li>
<li>
<p style="margin-bottom: 0in">The type will be HTML</p>
</li>
<li>
<p style="margin-bottom: 0in">In the filename field, browse and 	select the swf file.</p>
</li>
<li>
<p style="margin-bottom: 0in">In the content area wirte the 	following code.</p>
</li>
</ol>
<p style="margin-bottom: 0in"><span style="color: #800000">&lt;embed src=&#8221;{!Scontrol.JavaArchive}&#8221; play=&#8221;true&#8221;   bgcolor=&#8221;#f3f3ec&#8221;  width=&#8221;100%&#8221; height=&#8221;100%&#8221; name=&#8221;FlexSalesforce&#8221;  Align=&#8221;middle&#8221; 		flashvars=&#8221;session_id={!API.Session_ID}&amp; server_url=    {!API.Partner_Server_URL_90}&#8221; loop=&#8221;false&#8221;allowScriptAccess=&#8221;always&#8221; type=&#8221;application/x-shockwave-flash&#8221;  pluginspage=&#8221;http://www.adobe.com/go/getflashplayer&#8221;&lt;/embed&gt;</span></p>
<p style="margin-bottom: 0in">Here there are three Salesforce.com variables.</p>
<ol>
<li>
<p style="margin-bottom: 0in"><span style="color: #000000">Scontrol 	JavaArchive.</span></p>
</li>
<li>
<p style="margin-bottom: 0in"><span style="color: #000000">API.Session_ID.</span></p>
</li>
<li>
<p style="margin-bottom: 0in"><span style="color: #000000">API.Partner_Server_URL_90.</span></p>
</li>
</ol>
<p style="margin-bottom: 0in">The last two are passed into the SWF when it loads in the browser. These maintain session state. So no need to login while running SWF file.</p>
<p style="margin-bottom: 0in">Now create Tab to house S-Control just created. Create a New Web-Tab with type of Custom S-Control. In step three , Select the S-Control just created to be the content on that tab. Click next through steps four and five. A new tab appear on the top of the screen.</p>
<p>Click on the tab. SWF file will run without required login details.</p>
<p>I hope you found this article useful. Let me know if there are any better ways to do the same thing.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.digi-corp.com/2009/08/run-swf-file-in-salesforce-environment/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

