<?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>Flexmaniak.pl &#187; Flex</title>
	<atom:link href="http://blog.flexmaniak.pl/category/flex/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.flexmaniak.pl</link>
	<description>Flex, Papervision3D, PHP, Symfony</description>
	<lastBuildDate>Sun, 02 Oct 2011 08:36:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>[Modules] Check if class implements interface</title>
		<link>http://blog.flexmaniak.pl/actionscript/modules-check-if-class-implements-interface</link>
		<comments>http://blog.flexmaniak.pl/actionscript/modules-check-if-class-implements-interface#comments</comments>
		<pubDate>Sun, 02 Oct 2011 07:36:49 +0000</pubDate>
		<dc:creator>damian</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://blog.flexmaniak.pl/?p=1485</guid>
		<description><![CDATA[Problem: I have module that implements my interface: class MyModule extends ModuleBase implmenets IMyInterface &#123; ... &#125; After loading module from external file: var moduleInfo:IModuleInfo = ModuleManager.getModule&#40;'module_path.swf'&#41;; moduleInfo.addEventListener&#40;ModuleEvent.READY, this_READY &#41;; moduleInfo.load&#40;null,null,null ,FlexGlobals.topLevelApplication.moduleFactory&#41;; And creating module object: private function this_READY&#40; moduleEvent:ModuleEvent &#41;:void &#123; var moduleInfo:IModuleInfo = moduleEvent.module; var m:Object = moduleInfo.factory.create&#40;&#41;; &#125; The expression: m is IMyInterface; returns [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem:</strong></p>
<p>I have module that implements my interface:</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">class</span> MyModule <span style="color: #0066CC;">extends</span> ModuleBase implmenets IMyInterface<br />
<span style="color: #66cc66;">&#123;</span><br />
...<br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p>After loading module from external file:</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">var</span> moduleInfo:IModuleInfo = ModuleManager.<span style="color: #006600;">getModule</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'module_path.swf'</span><span style="color: #66cc66;">&#41;</span>;<br />
moduleInfo.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ModuleEvent.<span style="color: #006600;">READY</span>, this_READY <span style="color: #66cc66;">&#41;</span>;<br />
moduleInfo.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">null</span>,<span style="color: #000000; font-weight: bold;">null</span>,<span style="color: #000000; font-weight: bold;">null</span> ,FlexGlobals.<span style="color: #006600;">topLevelApplication</span>.<span style="color: #006600;">moduleFactory</span><span style="color: #66cc66;">&#41;</span>;</div></div>
<p>And creating module object:</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> this_READY<span style="color: #66cc66;">&#40;</span> moduleEvent:ModuleEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">var</span> moduleInfo:IModuleInfo = moduleEvent.<span style="color: #006600;">module</span>;<br />
<span style="color: #000000; font-weight: bold;">var</span> m:<span style="color: #0066CC;">Object</span> = moduleInfo.<span style="color: #006600;">factory</span>.<span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p>The expression:</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">m is IMyInterface;</div></div>
<p>returns <strong>false</strong> instead of <strong>true</strong>.</p>
<p>&nbsp;</p>
<p><strong>Solution:</strong></p>
<p>The solution for this problem is following:</p>
<p>After creating the module object using factory, we must use the expression presented above. I do not know why, but after the first use of this expression or casting (operator <em>as</em>) it behaves right.</p>
<p>Therefore we must add the following line:</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> this_READY<span style="color: #66cc66;">&#40;</span> moduleEvent:ModuleEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">var</span> moduleInfo:IModuleInfo = moduleEvent.<span style="color: #006600;">module</span>;<br />
<span style="color: #000000; font-weight: bold;">var</span> m:<span style="color: #0066CC;">Object</span> = moduleInfo.<span style="color: #006600;">factory</span>.<span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<br />
m is IMyInterface;<br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p>It looks like error in Flex for me, as I cannot find an explanation for it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flexmaniak.pl/actionscript/modules-check-if-class-implements-interface/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Two way data binding</title>
		<link>http://blog.flexmaniak.pl/flex/two-way-data-binding</link>
		<comments>http://blog.flexmaniak.pl/flex/two-way-data-binding#comments</comments>
		<pubDate>Fri, 23 Sep 2011 12:48:04 +0000</pubDate>
		<dc:creator>Piotr Wierzgała</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[data binding]]></category>

		<guid isPermaLink="false">http://blog.flexmaniak.pl/?p=1476</guid>
		<description><![CDATA[If you bind a variable to some component&#8217;s property by just adding [Bindable] metatag above it you may notice that component&#8217;s property changes when variable changes but it doesn&#8217;t work in the opposite direction. So what to do in order to achieve to way data binding? In MXML you have to add twoWay=&#8221;true&#8221; attribute to [...]]]></description>
			<content:encoded><![CDATA[<p>If you bind a variable to some component&#8217;s property by just adding [Bindable] metatag above it you may notice that component&#8217;s property changes when variable changes but it doesn&#8217;t work in the opposite direction. So what to do in order to achieve to way data binding?<span id="more-1476"></span></p>
<p>In MXML you have to add <strong>twoWay=&#8221;true&#8221;</strong> attribute to your Binding tag.</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #66cc66;">&lt;</span>fx:Binding source=<span style="color: #ff0000;">&quot;slider_1.value&quot;</span> destination=<span style="color: #ff0000;">&quot;slider_2.value&quot;</span> twoWay=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
<br />
<span style="color: #66cc66;">&lt;</span>s:HSlider id=<span style="color: #ff0000;">&quot;slider_1&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
<span style="color: #66cc66;">&lt;</span>s:HSlider id=<span style="color: #ff0000;">&quot;slider_2&quot;</span><span style="color: #66cc66;">/&gt;</span></div></div>
<p>In ActionScript you have to add <strong>@</strong> before binded variable in component&#8217;s property.</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span><br />
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> value:<span style="color: #0066CC;">Number</span>;<br />
<br />
<span style="color: #66cc66;">&lt;</span>s:HSlider value=<span style="color: #ff0000;">&quot;@{value}&quot;</span><span style="color: #66cc66;">/&gt;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.flexmaniak.pl/flex/two-way-data-binding/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>png2swf: a way to keep transparency and small PNG file size</title>
		<link>http://blog.flexmaniak.pl/flex/png2swf-a-way-to-keep-transparency-and-small-png-file-size</link>
		<comments>http://blog.flexmaniak.pl/flex/png2swf-a-way-to-keep-transparency-and-small-png-file-size#comments</comments>
		<pubDate>Sun, 07 Aug 2011 19:06:59 +0000</pubDate>
		<dc:creator>Piotr Wierzgała</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[PNG]]></category>
		<category><![CDATA[SWF]]></category>
		<category><![CDATA[SWFTools]]></category>
		<category><![CDATA[transparency]]></category>

		<guid isPermaLink="false">http://blog.flexmaniak.pl/?p=1451</guid>
		<description><![CDATA[png2swf utility is a part of SWFTools package. It is capable of converting PNG to SWF format and it can really save your life if you are in need of having small PNG files. PNG supports transparency and it has good compression for images consisting of solid blocks of colors but if it comes to [...]]]></description>
			<content:encoded><![CDATA[<p>png2swf utility is a part of <a href="http://www.swftools.org/download.html">SWFTools</a> package. It is capable of converting PNG to SWF format and it can really save your life if you are in need of having small PNG files.<span id="more-1451"></span></p>
<p>PNG supports transparency and it has good compression for images consisting of solid blocks of colors but if it comes to photo-like quality PNG is really terrible. With png2swf you can combine transparency of PNG and small size of JPEG format. In order to compress your PNG image (with preservation of transparent pixels) you need to specify -j flag with it&#8217;s quality level (1-100).</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">png2swf -j 70 -o output_file.swf input_file.png</div></div>
<p>Here are several examples of my results (quality 70):</p>
<ol>
<li>315KB (PNG) -> 58KB (SWF) output is 18% of input</li>
<li>294KB (PNG) -> 60KB (SWF) output is 20% of input</li>
<li>101KB (PNG) -> 29KB (SWF) output is 28% of input</li>
<li>193KB (PNG) -> 45KB (SWF) output is 23% of input</li>
<li>203KB (PNG) -> 72KB (SWF) output is 35% of input</li>
</ol>
<p>If you are going to use this solution you may be also interested in the follwing two posts:</p>
<ul>
<li><a href="http://blog.flexmaniak.pl/actionscript/bytearray-to-bitmapdata-loading-image-in-swf-format">ByteArray to BitmapData. Loading image in SWF format</a>.</li>
<li><a href="http://blog.flexmaniak.pl/actionscript/bitmapdata-and-transparency">BitmapData and transparency</a>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.flexmaniak.pl/flex/png2swf-a-way-to-keep-transparency-and-small-png-file-size/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Embeding assets</title>
		<link>http://blog.flexmaniak.pl/flex/embeding-assets</link>
		<comments>http://blog.flexmaniak.pl/flex/embeding-assets#comments</comments>
		<pubDate>Thu, 14 Jul 2011 13:06:36 +0000</pubDate>
		<dc:creator>Piotr Wierzgała</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://blog.flexmaniak.pl/?p=1326</guid>
		<description><![CDATA[Embeding assets allows you to complie some external data into your SWF file. There are two ways of doing it. In first of them you create ActionScript Class object embeding your resource: &#91;Embed&#40;source=&#34;image.png&#34;, mimeType=&#34;image/png&#34;&#41;&#93; public var ImageClass:Class; and use it MXML tag: &#60;s:Image source=&#34;{ImageClass}&#34;/&#62; The other way is to embed your resource directly in MXML [...]]]></description>
			<content:encoded><![CDATA[<p>Embeding assets allows you to complie some external data into your SWF file. </p>
<p>There are two ways of doing it. In first of them you create ActionScript Class object embeding your resource:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;image.png&quot;</span><span style="color: #000066; font-weight: bold;">,</span> mimeType=<span style="color: #990000;">&quot;image/png&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><br />
<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> ImageClass<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html"><span style="color: #004993;">Class</span></a><span style="color: #000066; font-weight: bold;">;</span></div></div>
<p>and use it MXML tag:</p>
<div class="codecolorer-container mxml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="mxml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Image</span> source=<span style="color: #ff0000;">&quot;{ImageClass}&quot;</span><span style="color: #7400FF;">/&gt;</span></span></div></div>
<p>The other way is to embed your resource directly in MXML tag:</p>
<div class="codecolorer-container mxml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="mxml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Image</span> source=<span style="color: #ff0000;">&quot;@Embed(source='image.png')&quot;</span> <span style="color: #7400FF;">/&gt;</span></span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.flexmaniak.pl/flex/embeding-assets/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to disable databinding warnings?</title>
		<link>http://blog.flexmaniak.pl/flex/how-to-disable-databinding-warnings</link>
		<comments>http://blog.flexmaniak.pl/flex/how-to-disable-databinding-warnings#comments</comments>
		<pubDate>Thu, 14 Jul 2011 12:29:34 +0000</pubDate>
		<dc:creator>Piotr Wierzgała</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[data binding]]></category>

		<guid isPermaLink="false">http://blog.flexmaniak.pl/?p=1320</guid>
		<description><![CDATA[Sometimes when you put a variable into MXML tag you get a warning: &#8220;Data binding will not be able to detect assignments to &#8230;&#8221;. You can get rid of it by making your variable bindable but what if you are completly sure that the variable will not change and you don&#8217;t want to make it [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes when you put a variable into MXML tag you get a warning: &#8220;Data binding will not be able to detect assignments to &#8230;&#8221;. You can get rid of it by making your variable bindable but what if you are completly sure that the variable will not change and you don&#8217;t want to make it bindable? </p>
<p>In order to turn off all annoying warnings at once you can add the following code to your compiler options:</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">-show-binding-warnings=<span style="color: #ff0000;">&quot;false&quot;</span></div></div>
<p>The second solution is to add the following tag:</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;__NoChangeEvent__&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></div></div>
<p>before each variable you don&#8217;t want to be bindable and to be source of the warning. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flexmaniak.pl/flex/how-to-disable-databinding-warnings/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to capture image from web camera?</title>
		<link>http://blog.flexmaniak.pl/flex/how-to-capture-image-from-web-camera</link>
		<comments>http://blog.flexmaniak.pl/flex/how-to-capture-image-from-web-camera#comments</comments>
		<pubDate>Sat, 09 Jul 2011 20:30:48 +0000</pubDate>
		<dc:creator>Piotr Wierzgała</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[VideoDisplay]]></category>

		<guid isPermaLink="false">http://blog.flexmaniak.pl/?p=1306</guid>
		<description><![CDATA[If you have a web camera connected to your computer and you want to capture image from it then in the following text you will see how to do it. Create VideoDisplay object and a button &#60;mx:VideoDisplay id=&#34;videoDisplay&#34; width=&#34;640&#34;&#160; height=&#34;480&#34; &#160; &#160; creationComplete=&#34;videoDisplay_CREATION_COMPLETE()&#34;/&#62; &#60;s:Button id=&#34;captureImageButton&#34; label=&#34;Capture image&#34; &#160; &#160; click=&#34;captureImageButton_CLICK()&#34;/&#62; Attach camera to the VideoDisplay [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a web camera connected to your computer and you want to capture image from it then in the following text you will see how to do it.<br />
<span id="more-1306"></span></p>
<h4>Create VideoDisplay object and a button</h4>
<div class="codecolorer-container mxml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="mxml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:VideoDisplay</span> id=<span style="color: #ff0000;">&quot;videoDisplay&quot;</span> width=<span style="color: #ff0000;">&quot;640&quot;</span>&nbsp; height=<span style="color: #ff0000;">&quot;480&quot;</span> </span><br />
<span style="color: #000000;">&nbsp; &nbsp; creationComplete=<span style="color: #ff0000;">&quot;videoDisplay_CREATION_COMPLETE()&quot;</span><span style="color: #7400FF;">/&gt;</span></span><br />
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;captureImageButton&quot;</span> label=<span style="color: #ff0000;">&quot;Capture image&quot;</span> </span><br />
<span style="color: #000000;">&nbsp; &nbsp; click=<span style="color: #ff0000;">&quot;captureImageButton_CLICK()&quot;</span><span style="color: #7400FF;">/&gt;</span></span></div></div>
<h4>Attach camera to the VideoDisplay</h4>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> videoDisplay_CREATION_COMPLETE<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">camera</span> = <span style="color: #0066CC;">Camera</span>.<span style="color: #006600;">getCamera</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">camera</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; videoDisplay.<span style="color: #006600;">attachCamera</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">camera</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Your camera is not detected.&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p>On this stage you shoud be able to see on the VideoDisplay the view registered by your camera .</p>
<h4>Capture image from the camera</h4>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> captureImageButton_CLICK<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> bitmapData:BitmapData = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span>videoDisplay.<span style="color: #0066CC;">width</span>, videoDisplay.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; bitmapData.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span>videoDisplay<span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p>Note that the maximum resolution registered by the camera is camera.width <em>x</em> camera.height. You can adjust it with <strong>setMode() </strong>method from Camera class.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flexmaniak.pl/flex/how-to-capture-image-from-web-camera/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Localizing Flex Applications (static)</title>
		<link>http://blog.flexmaniak.pl/flex/localizing-flex-applications-static</link>
		<comments>http://blog.flexmaniak.pl/flex/localizing-flex-applications-static#comments</comments>
		<pubDate>Sat, 02 Jul 2011 18:05:20 +0000</pubDate>
		<dc:creator>Piotr Wierzgała</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[localization]]></category>
		<category><![CDATA[ResourceManager]]></category>

		<guid isPermaLink="false">http://blog.flexmaniak.pl/?p=1285</guid>
		<description><![CDATA[Localization is a process of adapting an application to a particular language. Flex offers it&#8217;s own tools and techniques to make this feature available. Localization can be done statically or dynamically. This post describes how to localize an apllication statically, which means that nobody will be able to change localized strings after compilation. Create localized [...]]]></description>
			<content:encoded><![CDATA[<p>Localization is a process of adapting an application to a particular language. Flex offers it&#8217;s own tools and techniques to make this feature available. Localization can be done statically or dynamically. This post describes how to localize an apllication statically, which means that nobody will be able to change localized strings after compilation.<br />
<span id="more-1285"></span></p>
<h3>Create localized framework resources</h3>
<ol>
<li>Go to the &#8220;{Flex_SDK_folder}/bin&#8221;.</li>
<li>Execute in your console: <strong>copylocale en_US xx_XX</strong>, where xx_XX is your new locale resource.</li>
<li>Make sure that new locale resource appeared {Flex_SDK_folder}/frameworks/locale.</li>
</ol>
<h3>Create project locales</h3>
<ol>
<li>Create &#8220;locale&#8221; folder in your project.</li>
<li>For each language create a subfolder named as locale (e.g. pl_PL).</li>
<li>In each folder create a file named &#8220;<strong>resource_name</strong>&#8220;.properties (e.g. localization.properties).</li>
</ol>
<p>localization.properties file has a &#8220;<strong>locale_name = value</strong>&#8221; structure and is encoded with UTF-8:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">name = localized name<br />
country = localized country</div></div>
<h3>Set project properties</h3>
<ol>
<li>Open your project properties window and go to &#8220;Flex Compiler&#8221;.</li>
<li>Add following compiler arguments: <strong>-locale=xx_XX,yy_YY -source-path=locale/{locale}</strong>, where xx_XX and yy_YY are your locales.</li>
</ol>
<h3>Write application code</h3>
<ol>
<li>
Add the following metadata to your application:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight: bold;">&lt;</span>fx<span style="color: #000066; font-weight: bold;">:</span>Metadata<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#91;</span>ResourceBundle<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;resource_name&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><br />
<span style="color: #000066; font-weight: bold;">&lt;/</span>fx<span style="color: #000066; font-weight: bold;">:</span>Metadata<span style="color: #000066; font-weight: bold;">&gt;</span></div></div>
<p>Note that &#8220;resource_name&#8221; is the same we used to name project&#8217;s locales.
</li>
<li>
From this moment you can refer to you localizations using ResourceManager. If you are in a subclass of UIComponent use:</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">resourceManager.<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;resource_name&quot;</span>, <span style="color: #ff0000;">&quot;locale_name&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></div>
<p>and if you are any other class use:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ResourceManager<span style="color: #000066; font-weight: bold;">.</span>getInstance<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span>getString<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;resource_name&quot;</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #990000;">&quot;locale_name&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></div>
</li>
<li>
If you want to change your application language you just need to set localeChanin property of your ResourceManager:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">resourceManager<span style="color: #000066; font-weight: bold;">.</span>localeChain = <span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;pl_PL&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></div></div>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.flexmaniak.pl/flex/localizing-flex-applications-static/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to regenerate html-template in Flash Builder</title>
		<link>http://blog.flexmaniak.pl/flex/how-to-regenerate-html-template</link>
		<comments>http://blog.flexmaniak.pl/flex/how-to-regenerate-html-template#comments</comments>
		<pubDate>Sat, 02 Jul 2011 11:15:13 +0000</pubDate>
		<dc:creator>Piotr Wierzgała</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[html-template]]></category>

		<guid isPermaLink="false">http://blog.flexmaniak.pl/?p=1282</guid>
		<description><![CDATA[Recently I have accidentally deleted &#8220;html-template&#8221; folder from one of my projects and I needed to restore it. Here is how I did it: Open project&#8217;s properties window. Go to &#8220;Flex Complier&#8221;. Under &#8220;HTML wrapper&#8221; uncheck &#8220;Generate HTML wrapper file&#8221; and click &#8220;Apply&#8221;. Check &#8220;Generate HTML wrapper file&#8221; and click &#8220;Apply&#8221;. After that you should [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I have accidentally deleted &#8220;html-template&#8221; folder from one of my projects and I needed to restore it. Here is how I did it:</p>
<ol>
<li>Open project&#8217;s properties window.</li>
<li>Go to &#8220;Flex Complier&#8221;.</li>
<li>Under &#8220;HTML wrapper&#8221; uncheck &#8220;Generate HTML wrapper file&#8221; and click &#8220;Apply&#8221;.</li>
<li>Check &#8220;Generate HTML wrapper file&#8221; and click &#8220;Apply&#8221;.</li>
</ol>
<p>After that you should have &#8220;html-template&#8221; folder generated in you project.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flexmaniak.pl/flex/how-to-regenerate-html-template/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FlexPrintJob makes printed component disappear</title>
		<link>http://blog.flexmaniak.pl/flex/flexprintjob-makes-printed-component-disapper</link>
		<comments>http://blog.flexmaniak.pl/flex/flexprintjob-makes-printed-component-disapper#comments</comments>
		<pubDate>Mon, 25 Apr 2011 22:39:30 +0000</pubDate>
		<dc:creator>Piotr Wierzgała</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[FlexPrintJob]]></category>

		<guid isPermaLink="false">http://blog.flexmaniak.pl/?p=1260</guid>
		<description><![CDATA[When I was testing some piece of code which was responsible for printing a component I found out that if I cancel a printing dialog box the component disappers. I didn&#8217;t put much attention to this problem and I don&#8217;t know why exactly it happend but I found a solution. To prevent component from disappering [...]]]></description>
			<content:encoded><![CDATA[<p>When I was testing some piece of code which was responsible for printing a component I found out that if I cancel a printing dialog box the component disappers. I didn&#8217;t put much attention to this problem and I don&#8217;t know why exactly it happend but I found a solution. To prevent component from disappering you need to cancel printing procedure if start method form FlexPrintJob class returns false.</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">printJob</span>:FlexPrintJob = <span style="color: #000000; font-weight: bold;">new</span> FlexPrintJob<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">printJob</span>.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span>;<br />
<span style="color: #0066CC;">printJob</span>.<span style="color: #006600;">addObject</span><span style="color: #66cc66;">&#40;</span>someUIComponent, FlexPrintJobScaleType.<span style="color: #006600;">SHOW_ALL</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0066CC;">printJob</span>.<span style="color: #0066CC;">send</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.flexmaniak.pl/flex/flexprintjob-makes-printed-component-disapper/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Własna czcionka i przycisk (button)</title>
		<link>http://blog.flexmaniak.pl/flex/wlasna-czcionka-i-przycisk-button</link>
		<comments>http://blog.flexmaniak.pl/flex/wlasna-czcionka-i-przycisk-button#comments</comments>
		<pubDate>Mon, 31 May 2010 14:18:10 +0000</pubDate>
		<dc:creator>damian</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[custom font]]></category>
		<category><![CDATA[embeed]]></category>
		<category><![CDATA[embeed font]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[font-family]]></category>

		<guid isPermaLink="false">http://blog.flexmaniak.pl/?p=443</guid>
		<description><![CDATA[Dzisiaj spotkałem się z problemem podczas wstawiania do aplikacji własnej embeed&#8217;owanej czcionki. Robi się to w CSSie w ten sposób: @font-face { src: url("../fonts/moja-czcionka.ttf"); fontFamily: MyFont; } Następnie w prosty sposób można ustawić czcionke dla np. Aplikacji: Application { fontFamily: MyFont; } Do tej pory wszystko działa bez zarzutu. Jednak, gdy ustawiałem czcionke dla przycisku: [...]]]></description>
			<content:encoded><![CDATA[<p>Dzisiaj spotkałem się z problemem podczas wstawiania do aplikacji własnej embeed&#8217;owanej czcionki. Robi się to w CSSie w ten sposób:</p>
<pre class="brush:css">@font-face {
src: url("../fonts/moja-czcionka.ttf");
fontFamily: MyFont;
}</pre>
<p>Następnie w prosty sposób można ustawić czcionke dla np. Aplikacji:</p>
<pre class="brush:css">Application {
fontFamily: MyFont;
}</pre>
<p>Do tej pory wszystko działa bez zarzutu. Jednak, gdy ustawiałem czcionke dla przycisku:</p>
<pre class="brush:css">Button {
fontFamily: MyFont;
}</pre>
<p>no to coś nie grało, bo czcionka nie pojawiała się. Była to zwykła polska czcionka:</p>
<ul>
<li>styl &#8211; normalny</li>
<li>grubość &#8211; normalna</li>
</ul>
<p>Okazało się, że problemem był fakt, że Flex jako domyślną grubość czcionki dla przycisków ustawia <strong>bold</strong>, a moja czcionka była <strong>normalnej</strong> grubości. Stąd, po dodaniu jednej linijki do stylu przycisku:</p>
<pre class="brush:css">Button {
fontFamily: MyFont;
fontWeight: normal;
}</pre>
<p>wszystko działało. Trochę mnie zdenerwowała taka błahostka, bo spędziłem nad nią trochę czasu, dlatego mam nadzieje, że ten wpis go komuś zaoszczędzi.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flexmaniak.pl/flex/wlasna-czcionka-i-przycisk-button/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

