<?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>.:. blog.screenshot.at .:. Flash, Flex, RIA .:. &#187; Flashplayer</title>
	<atom:link href="http://www.screenshot.at/blog/category/flash/flashplayer/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.screenshot.at/blog</link>
	<description>This blog is about Flash, Flex, RIA related stuff</description>
	<lastBuildDate>Mon, 11 May 2015 18:06:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.38</generator>
	<item>
		<title>Unity will support Flash platform</title>
		<link>http://www.screenshot.at/blog/2011/02/28/unity-will-support-flash-platform/</link>
		<comments>http://www.screenshot.at/blog/2011/02/28/unity-will-support-flash-platform/#comments</comments>
		<pubDate>Mon, 28 Feb 2011 16:22:42 +0000</pubDate>
		<dc:creator><![CDATA[Manfred Karrer]]></dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flashplayer]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex Builder]]></category>
		<category><![CDATA[Unity3D]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[3d World]]></category>
		<category><![CDATA[Alternatives To Flash]]></category>
		<category><![CDATA[Animation Tool]]></category>
		<category><![CDATA[Applica]]></category>
		<category><![CDATA[Competitor]]></category>
		<category><![CDATA[Deep Impact]]></category>
		<category><![CDATA[Derivates]]></category>
		<category><![CDATA[Desktop Apps]]></category>
		<category><![CDATA[Development Environment]]></category>
		<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[Flashbuilder]]></category>
		<category><![CDATA[Great News]]></category>
		<category><![CDATA[Inventors]]></category>
		<category><![CDATA[Iphone]]></category>
		<category><![CDATA[Linux Player]]></category>
		<category><![CDATA[Mac Apps]]></category>
		<category><![CDATA[Mac Pc]]></category>
		<category><![CDATA[Pc Desktop]]></category>
		<category><![CDATA[Unity Web]]></category>
		<category><![CDATA[Web Application Development]]></category>
		<category><![CDATA[Web Player]]></category>
		<category><![CDATA[World Flash]]></category>

		<guid isPermaLink="false">http://www.screenshot.at/blog/?p=557</guid>
		<description><![CDATA[Great news!: Unity will support the Flash platform in future! Wow that is really an exciting move! I have had recently a look to Unity in search for alternatives to Flash, and was wondering why they are not supporting the Flash Player. They already supports a lot of different platforms, but Flash was missing. I [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Great news!: <a href="http://blogs.unity3d.com/2011/02/27/unity-flash-3d-on-the-web/comment-page-2/#comment-22481" target="_blank">Unity will support the Flash platform in future!</a><br />
Wow that is really an <span class="hl">exciting move!</span></p>
<p><img class="alignnone size-full wp-image-569" src="http://www.screenshot.at/blog/wp-content/uploads/2011/02/bildschirmfoto-2011-02-28-um-1741381.png" alt="" width="573" height="240" /></p>
<p>I have had recently a look to <a href="http://unity3d.com/unity/" target="_blank">Unity</a> in search for <span class="hl">alternatives to Flash</span>, and was wondering why they are not supporting the Flash Player. They already supports a lot of different platforms, but Flash was missing. I thought the technical limitations and differences would be a too hard barrier.</p>
<p>But now they released the news that they are working on the support for exporting Unity projects to the Flash platform as well as to Android, IPhone (and the rest of the I&#8230; derivates), XBox, Mac/PC desktop apps and their Unity Web Player (Linux Player is in development). It is becoming a real tough multi-platform tool! This could have a deep impact, as Unity seems from technological point of view much more advanced then Flash and the main barrier for using it in the web, was the low player penetration of the Unity Web Player. So it was locked to the special cases where the installation of a new plugin is no problem for users, but unfortunately for 90% of the mainstream clients and projects this is a no go. But with this strategy they will get in one move the support of the 99% penetration of the flash player (ok, with the latest player version that is not correct, but people don´t care so much about an update of the Flash Player then about a new installation of an unknown plugin).<br />
And Adobe is getting a real strong competitor, so hopefully they are forced to pay more attention to performance and development environment. The current Flashbuilder is compared to the tools available for Java or .NET not very competitive, to express it friendly. I have not worked with Unity yet, but will use the next opportunity to try it out.</p>
<p>I am also wondering how much they can cover outside the classical 3D world? Flash has started as a pure animation tool and has become a main player for web application development. I bet the inventors didn´t expect this. So why should not Unity become a tool also for classical applications, 3D comes free if needed, and it seems that <span class="hl">3D</span> will become more and more an <span class="hl">intrinsic part of up to date software</span>. 3D-TV sets and Mobiles are currently the hot thing and I think it´s only a question of (hopefully not too much) time, until 3D displays are common also at desktops. 3D content will be the missing link then.</p>
<p><span class="hl">Unity is just ready to take off!</span></p>
<p>Looking forward also to the new Flash Player (<a href="http://www.adobe.com/newsletters/edge/january2011/articles/article1/" target="_blank">Molehill</a>) which brings GPU-accelerated 3D to the Flash platform.</p>
<p><iframe title="YouTube video player" width="530" height="328" src="http://www.youtube.com/embed/tgwi0lWgX8w?hd=1" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.screenshot.at/blog/2011/02/28/unity-will-support-flash-platform/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adobe whitepaper for performance optimization</title>
		<link>http://www.screenshot.at/blog/2010/02/15/adobe-whitepaper-for-performance-optimization/</link>
		<comments>http://www.screenshot.at/blog/2010/02/15/adobe-whitepaper-for-performance-optimization/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 22:22:13 +0000</pubDate>
		<dc:creator><![CDATA[Manfred Karrer]]></dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Compiler]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flashplayer]]></category>
		<category><![CDATA[CPU]]></category>
		<category><![CDATA[Flash Player 10.1]]></category>
		<category><![CDATA[garbage collector]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://www.screenshot.at/blog/?p=485</guid>
		<description><![CDATA[Thibault Imbert from Adobe has published a whitepaper for performance optimization, with a lot of useful information specially targeting Flash Player 10.1 and mobile content. Some parts sounds somehow strange, like the recommendation to avoid Event Dispatching as for every event an object has to be created. On the other hand they recommend object pooling [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.bytearray.org/" target="_blank">Thibault Imbert</a> from Adobe has published a <a href="http://help.adobe.com/en_US/as3/mobile/index.html" target="_blank">whitepaper</a> for performance optimization, with a lot of useful information specially targeting Flash Player 10.1 and mobile content.</p>
<p>Some parts sounds somehow strange, like the recommendation to avoid Event Dispatching as for every event an object has to be created. On the other hand they recommend object pooling for reusing objects. So the question pops up, why the native Event Dispatching is not implemented in the way that it benefits from a native object pooling? When performance optimization is leading to bad coding practice, something in the  technology seems to be wrong. The poor method execution performance in Flash is one of these issues.</p>
<p>Here just a few random issues discussed in the paper:</p>
<p>&#8211; Setting not used objects explicitely to null helps the garbage collector</p>
<p>&#8211; Call dispose() on the BitmapData object when not used anymore</p>
<p>&#8211; When using Filters 2 Bitmaps are created and kept in memory. Applying a filter is CPU intense, so try to use pre-rendered Bitmaps instead.</p>
<p>&#8211; Deactivate interactive objects when no Mouse interaction is needed (mouseEnabled, mouseChildren)</p>
<p>All in all it is good to see that Adobe is aware of the performance problems and hopefully will push the Flash Player forward using the optimization headroom available at the compiler level and the Flash Player itself. Maybe the current effort to make Flash &#8220;ready for mobile&#8221; will give us the same performance boost like with AS3 that was primarily introduced because of the greed of Flex which simply didn´t perform on the AVM1.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.screenshot.at/blog/2010/02/15/adobe-whitepaper-for-performance-optimization/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Open source project: LocalConnectionService</title>
		<link>http://www.screenshot.at/blog/2009/05/26/open-source-project-localconnectionservice/</link>
		<comments>http://www.screenshot.at/blog/2009/05/26/open-source-project-localconnectionservice/#comments</comments>
		<pubDate>Tue, 26 May 2009 21:02:08 +0000</pubDate>
		<dc:creator><![CDATA[Manfred Karrer]]></dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flashplayer]]></category>
		<category><![CDATA[Blitz]]></category>
		<category><![CDATA[Open Source Project]]></category>

		<guid isPermaLink="false">http://www.screenshot.at/blog/?p=386</guid>
		<description><![CDATA[LocalConnection is a great feature in flash, but unfortunately it has some limitations and the API is somehow &#8220;suboptimal&#8221;. Evan Gifford from Blitz has set up an open source project where the size limitations of 40 kb are bypassed and the project provides a nice API. Resources: http://labs.blitzagency.com/?p=650 http://code.google.com/p/flashlcs/ http://rockonflash.wordpress.com/2009/03/05/new-localconnection-api-rocks-and-its-os/ http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/LocalConnection.html]]></description>
				<content:encoded><![CDATA[<p><a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/LocalConnection.html" target="_blank">LocalConnection</a> is a great feature in flash, but unfortunately it has some limitations and the API is somehow &#8220;suboptimal&#8221;.<br />
Evan Gifford from <a href="http://blitzagency.com" target="_blank">Blitz</a> has set up an <a href="http://code.google.com/p/flashlcs/" target="_blank">open source</a> project where the size limitations of 40 kb are bypassed and the project provides a nice API.</p>
<p>Resources:<br />
<a href="http://labs.blitzagency.com/?p=650" target="_blank">http://labs.blitzagency.com/?p=650</a><br />
<a href="http://code.google.com/p/flashlcs/" target="_blank">http://code.google.com/p/flashlcs/</a><br />
<a href="http://rockonflash.wordpress.com/2009/03/05/new-localconnection-api-rocks-and-its-os/" target="_blank">http://rockonflash.wordpress.com/2009/03/05/new-localconnection-api-rocks-and-its-os/</a><br />
<a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/LocalConnection.html" target="_blank">http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/LocalConnection.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.screenshot.at/blog/2009/05/26/open-source-project-localconnectionservice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash high CPU usage in idle state</title>
		<link>http://www.screenshot.at/blog/2009/05/10/flash-high-cpu-usage-in-idle-state/</link>
		<comments>http://www.screenshot.at/blog/2009/05/10/flash-high-cpu-usage-in-idle-state/#comments</comments>
		<pubDate>Sun, 10 May 2009 20:24:55 +0000</pubDate>
		<dc:creator><![CDATA[Manfred Karrer]]></dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flashplayer]]></category>
		<category><![CDATA[AVM2]]></category>
		<category><![CDATA[Bug Report]]></category>
		<category><![CDATA[Cpu Consumption]]></category>
		<category><![CDATA[Cpu Idle]]></category>
		<category><![CDATA[Framerate]]></category>
		<category><![CDATA[grant skinner]]></category>
		<category><![CDATA[High Cpu Usage]]></category>
		<category><![CDATA[Interactivity]]></category>
		<category><![CDATA[Performance Problems]]></category>
		<category><![CDATA[Virtual Machine]]></category>

		<guid isPermaLink="false">http://www.screenshot.at/blog/?p=379</guid>
		<description><![CDATA[I have commited a bug report to Adobe about the high cpu usage in Flash applications at idle state. Please vote for this bug, so it has higher chances to get fixed soon. There is also another bug report by Grant Skinner regarding the same issue. Here is a copy of the bug report (if [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>I have commited a <a href="http://bugs.adobe.com/jira/browse/FP-1149" target="_blank">bug report</a> to Adobe about the high cpu usage in Flash applications at idle state.</p>
<p>Please <a href="http://bugs.adobe.com/jira/browse/FP-1149" target="_blank">vote</a> for this bug, so it has higher chances to get fixed soon.</p>
<p>There is also <a href="http://bugs.adobe.com/jira/browse/FP-2009" target="_blank">another bug report</a> by <a href="http://www.gskinner.com/blog/archives/2009/05/idle_cpu_usage.html" target="_blank">Grant Skinner</a> regarding the same issue.</p>
<p>Here is a copy of the bug report (if you are too lazy to register @ Adobe <img src="http://s.w.org/images/core/emoji/72x72/1f609.png" alt="&#x1f609;" class="wp-smiley" style="height: 1em; max-height: 1em;" /> ).<br />
<span id="more-379"></span><br />
Steps to reproduce:<br />
1. create a hight number (&gt;1000) of displayobjects and add them to the stage (visible area)<br />
2. set the framerate to a hight value (&gt;50)<br />
3. move the mouse over the stage and don´t move it (idle state)</p>
<p>Actual Results:<br />
idle cpu usage (taskmanager) is quite high (&gt;10%) depending on the framerate, cpu and number of displayobjects</p>
<p>Expected Results:<br />
in idle state there should be nearly no cpu consumption (in AS2 -&gt; AVM1 it was quite low)</p>
<p>Workaround (if any):<br />
reduce the framerate, set mouseEnable and mouseChildren to false whenever possible</p>
<p>Here is a detailed discription and testresults:</p>
<p>Problem:<br />
We are working on a huge flex application (170 000 lines of code) and run into some performance problems.<br />
We have set the framerate to 60 fps and the cpu consumption of the application was about 20% on a 3Ghz quadcore machine. there were no user interactivity and rendering going on.<br />
So we investigated the problem.<br />
After setting the framerate to 25 fps and setting the mouseEnable and mouseChildren property to false at the displayObjects where we don´t need mouse interactivity, we got an acceptable cpu consumption in the idle state. I am still wondering for the reasons for this behavior and specially for the different behavior in comparison to the old virtual machine (AS2). A strange observation was also that when moving the mouse over a textField the cpu consumption goes down to 0%.</p>
<p>Test situation:<br />
I Create 2000 displayObjects and add them on the stage (visible area). I give the flashplayer (standalone flashplayer 10.0.r12, release version) the focus and put the mouse over the playerwindow. I don´t move the mouse and there is no rendering going on. The cpu consumption is quite high depending on the framerate.<br />
The same test scenario with AS2 (AVM1) does not show such a high cpu consumption.</p>
<p>When I set mouseChildren at the stage to false the cpu consumtion goes down to 0%. Setting the mouseEnabled property at every Sprite to false has just a small effect on reducing cpu consumption. I tried it also with a container sprite in which all the 2000 sprites where added, setting the containers mouseChildren to false also reduced the cpu consumption radically. The same when I set mouseEnabled of the container AND of all Sprites to false but don´t set mouseChildren of the container to false. Setting mouseEnabled of all Sprites to false but not at the container has only a small effect. Seems like the flashplayer recognize if no children has mouseEnabled set to true and then don´t need to traverse throught the displaylist.<br />
For me it seems that the flashplayer has to check every frame for the mouseEnable properties and this consumes resources. If mouseChildren is set to false it has not to go further up the displaylist, so this is much faster.<br />
Regarding the TextField: As long a the selected property is set tot true it reduces cpu consumption down to 0%. It seems that when moving the mouse over a selectable textField that the flashplayer don´t has to check any other displayObjects for mouse interactivity.</p>
<p>In the flex profiler I have seen an high growth of the consumed time by [reap] (98%) and Timer.tick (1%). ([reap] is an internal process: Flash Player reclaims DRC (deferred reference counting) objects.)</p>
<p>I am wondering which changes in the AVM2 has causes these problems and if there are options for optimizations. I am also wondering why there is no event based (like os interrupts) model possible, it seem that the flashplayer has to check every frame for possible os input (mouse move,&#8230;).<br />
I am also wondering if the strategy I have seen in the flex frameworks core classes to set the framerate up to 1000 fps for speeding up rendering and then reset it to the original framerate, could has negative side effects due these behavior.<br />
Could it be that it is related to the native support for the mouseWheel event passed from the os to the flashplayer? Because this was a change from the old virtual machine, where the mouseWheel where not passed to the player.</p>
<p>Test results:<br />
AS3 code (-&gt; AVM2)<br />
AS3: framerate 24:<br />
mouse over the stage: 3%<br />
mouse over the textField: 0%<br />
mouse over the one sprite: 3%<br />
mouse over the stack of 1000 sprites: 3%<br />
AS3: framerate 120:<br />
mouse over the stage: 9-14%<br />
mouse over the textField: 0%<br />
mouse over the one sprite: 10-13%<br />
mouse over the stack of 1000 sprites: 14-18%<br />
AS3: framerate 1000:<br />
mouse over the stage: 36-40%<br />
mouse over the textField: 0%<br />
mouse over the one sprite: 22-40%<br />
mouse over the stack of 1000 sprites: 17-33%</p>
<p>AS2 code (-&gt; AVM1)<br />
AS2: framerate 24:<br />
mouse over the stage: 0%<br />
mouse over the textField: 0%<br />
mouse over the one sprite: 0%<br />
mouse over the stack of 1000 sprites: 0%<br />
AS2: framerate 120:<br />
mouse over the stage: 6%<br />
mouse over the textField: 0%<br />
mouse over the one sprite: 6%<br />
mouse over the stack of 1000 sprites: 6%<br />
AS2: framerate 1000:<br />
mouse over the stage: 8%<br />
mouse over the textField: 0%<br />
mouse over the one sprite: 8%<br />
mouse over the stack of 1000 sprites: 8%</p>
<p>Environment:<br />
Flashplayer 10.0.r12 (release version)<br />
OS: Win XP pro SP2<br />
3Ghz Singlecore<br />
2 GB Ram</p>
<p>AS3 code:<br />
stage.frameRate = 1000;<br />
for(var i:uint = 0; i &lt; 2000; i++)<br />
{<br />
addChild(getSprite());<br />
}</p>
<p>var tf:TextField = new TextField();<br />
tf.x = 120;<br />
tf.width = tf.height = 100;<br />
tf.text = &#8220;test&#8221;;<br />
addChild(tf);</p>
<p>var s:Sprite = getSprite(0xFF0000);<br />
s.x = s.y = 120;<br />
addChild(s);</p>
<p>function getSprite(col:uint = 0x00FF00):Sprite<br />
{<br />
var sprite:Sprite = new Sprite();<br />
with(sprite.graphics)<br />
{<br />
beginFill(col);<br />
drawRect(0, 0, 100, 100);<br />
endFill();<br />
}<br />
return sprite;<br />
}</p>
<p>AS2 code:<br />
this.frameRate = 1000;<br />
var i:Number;<br />
for(i = 0; i &lt; 2000; i++)<br />
{<br />
attachMovie(&#8220;mc&#8221;, &#8220;mc&#8221;+i, i);<br />
}</p>
<p>this.createTextField (&#8220;tf&#8221;, ++i, 120, 0, 100, 100);<br />
tf.text = &#8220;test&#8221;;</p>
<p>i++;<br />
var mc:MovieClip = attachMovie(&#8220;mc&#8221;, &#8220;mc&#8221;+i, i);;<br />
mc._x = mc._y = 120;</p>
<p>source file:<br />
<a href="http://bugs.adobe.com/jira/secure/attachment/27527/idleCpuTest.zip" target="_blank">http://bugs.adobe.com/jira/secure/attachment/27527/idleCpuTest.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.screenshot.at/blog/2009/05/10/flash-high-cpu-usage-in-idle-state/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Some nice tools and resources</title>
		<link>http://www.screenshot.at/blog/2009/05/09/some-nice-tools/</link>
		<comments>http://www.screenshot.at/blog/2009/05/09/some-nice-tools/#comments</comments>
		<pubDate>Sat, 09 May 2009 09:07:01 +0000</pubDate>
		<dc:creator><![CDATA[Manfred Karrer]]></dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Compiler]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flashplayer]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex Builder]]></category>
		<category><![CDATA[CSS Inspector]]></category>
		<category><![CDATA[Decompiler]]></category>
		<category><![CDATA[flexformatter]]></category>
		<category><![CDATA[Free Libraries]]></category>
		<category><![CDATA[Hp]]></category>
		<category><![CDATA[Libraries]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Opensource]]></category>
		<category><![CDATA[Security Analysis Tool]]></category>
		<category><![CDATA[Security Issues]]></category>
		<category><![CDATA[Security Tool]]></category>
		<category><![CDATA[swfscan]]></category>
		<category><![CDATA[Wishlist]]></category>

		<guid isPermaLink="false">http://www.screenshot.at/blog/?p=362</guid>
		<description><![CDATA[My wishlist for a CSS inspector has had been already fulfilled: http://code.google.com/p/fxspy A great code formatter as Eclipse plugin for Flex Builder: http://code.google.com/p/flexformatter Download: http://sourceforge.net/projects/flexformatter/ HP has published a security analysis tool for Flash content. It´s also a decompiler to inspect the Actionscript code: SWFScan Good overview about security issues in Flash: http://www.owasp.org/index.php/Category:OWASP_Flash_Security_Project http://www.adobe.com/devnet/flashplayer/articles/secure_swf_apps.html A [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>My wishlist for a <a href="http://www.mieuxcoder.com/data/2007/12/FlexSpy-1.2/dashboard.html" target="_blank">CSS inspector</a> has had been already fulfilled: <a href="http://code.google.com/p/fxspy" target="_blank">http://code.google.com/p/fxspy</a></p>
<p>A great code formatter as Eclipse plugin for Flex Builder: <a href="http://code.google.com/p/flexformatter" target="_blank">http://code.google.com/p/flexformatter</a><br />
Download: <a href="http://sourceforge.net/projects/flexformatter/" target="_blank">http://sourceforge.net/projects/flexformatter/</a></p>
<p>HP has published a security analysis tool for Flash content. It´s also a decompiler to inspect the Actionscript code: <a href="https://h30406.www3.hp.com/campaigns/2009/wwcampaign/1-5TUVE/index.php?key=swf&amp;jumpid=go/swfscan" target="_blank">SWFScan</a></p>
<p>Good overview about security issues in Flash:<br />
<a href="http://www.owasp.org/index.php/Category:OWASP_Flash_Security_Project" target="_blank">http://www.owasp.org/index.php/Category:OWASP_Flash_Security_Project</a><br />
<a href="http://www.adobe.com/devnet/flashplayer/articles/secure_swf_apps.html" target="_blank">http://www.adobe.com/devnet/flashplayer/articles/secure_swf_apps.html</a></p>
<p>A great resource for open source flash/flex tools and projects: <a href="http://www.flashchemist.com/104-free-opensource-apis-libraries-and-tools-for-the-flash-platform.html" target="_blank">http://www.flashchemist.com/104-free-opensource-apis-libraries-and-tools-for-the-flash-platform.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.screenshot.at/blog/2009/05/09/some-nice-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The infamous callLater()</title>
		<link>http://www.screenshot.at/blog/2009/05/05/the-infamous-calllater/</link>
		<comments>http://www.screenshot.at/blog/2009/05/05/the-infamous-calllater/#comments</comments>
		<pubDate>Tue, 05 May 2009 23:03:24 +0000</pubDate>
		<dc:creator><![CDATA[Manfred Karrer]]></dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flashplayer]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[SDK]]></category>
		<category><![CDATA[anatomy of a frame]]></category>
		<category><![CDATA[Asynchronism]]></category>
		<category><![CDATA[AVM2]]></category>
		<category><![CDATA[CallLater]]></category>
		<category><![CDATA[Half-Fram]]></category>
		<category><![CDATA[Layout Engine]]></category>
		<category><![CDATA[Layout Mechanism]]></category>
		<category><![CDATA[Life-Cycle]]></category>
		<category><![CDATA[Marshalled Slice]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Phased Instantiation]]></category>
		<category><![CDATA[player events]]></category>
		<category><![CDATA[player render]]></category>
		<category><![CDATA[prerender event]]></category>
		<category><![CDATA[Render]]></category>
		<category><![CDATA[Sean Christmann]]></category>
		<category><![CDATA[UsePhasedInstantiation]]></category>
		<category><![CDATA[user code]]></category>

		<guid isPermaLink="false">http://www.screenshot.at/blog/?p=298</guid>
		<description><![CDATA[At my first posts I wrote about my favorite Flex feature: Databinding Now I will take a look at the opposite, IMHO the most precarious &#8220;feature&#8221; in Flex: callLater() If you have a dodgy problem that a certain property is not available when it already should be and you ask someone at flexcoders you often [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>At my first posts I wrote about my favorite Flex feature: Databinding<br />
Now I will take a look at the opposite, IMHO the most precarious &#8220;feature&#8221; in Flex: <span class="hl">callLater()</span></p>
<p>If you have a dodgy problem that a certain property is not available when it already should be and you ask someone at <a href="http://tech.groups.yahoo.com/group/flexcoders/" target="_blank">flexcoders</a> you often get the advice, <em>&#8220;try callLater&#8221;</em> for a quick work-around. Sometimes this helps, but it leaves a bad smell, because often it´s just hiding some other problems in the code.<br />
So when we worked on a large-scale Flex application we have used it sometimes in the beginning, but after a while we decided to avoid callLater. To find and solve the real problem is simply the better solution &#8211; and we never needed it again &#8211; there was always another solution to solve a particular problem (maybe we just have had luck).</p>
<p>Unpleasantly we get confronted with the fact that callLater is used inside the Framework at the <strong>heart of the layout engine</strong>.<br />
We struggled with some strange problems. For instance we got a NullPointer exception in the updateDisplayList method of a custom component, which has already been cleaned up properly and removed from the displayList. It turned out that the layout mechanism delayed with callLater an invocation of updateDisplayList but our stuff there has already been removed and threw an exception.<br />
It was not hard to fix, but it demonstrated us that some asynchronous stuff was going on behind the scenes which was out of our direct control.</p>
<p>So for me callLater leaves always a certain bad smell.</p>
<p>Unfortunately I never found time to really investigate how it´s implemented and what are the concepts behind it.<br />
So it was time to <span class="hl">catch up</span> with this issue:<br />
CallLater is basically a method in UIComponent which delays a passed function to the next <strong>EnterFrame OR Render</strong> event.<br />
Often in den docs it´s just described that it will delay to the next frame, which is not correct because it could be that your function is executed already at the Render Event, which happens in the same frame and is the last opportunity where User code can be executed before the screen is rendered.</p>
<p>For more details about the internal concept of a frame in Flash and the relevant events see the great article by <a href="http://www.craftymind.com/2008/04/18/updated-elastic-racetrack-for-flash-9-and-avm2/" target="_blank">Sean Christmann</a>:</p>
<p>Here is a good illustration from his article about the <strong>anatomy of a frame</strong> in Flash:<br />
<span id="more-298"></span><br />
<img class="alignnone size-full wp-image-308" title="marshalledsliceexport" src="http://www.screenshot.at/blog/wp-content/uploads/2009/05/marshalledsliceexport.png" alt="marshalledsliceexport" width="500" height="220" /></p>
<p>All functions passed to callLater are queued up in an array and are executed at the EnterFrame event or Render event. It is possible that the executed function has some other callLater invocations again, so the final execution sequence could be delayed over several frames.</p>
<p>CallLater is used inside the Flex Framework in several classes. The main use case is probably inside the <strong>LayoutManager</strong>.<br />
There is a concept called <strong>phased instantiation</strong> which means basically that at application start-up the 3 phases in the UIComponents life-cycle (validate properties, validate size and validate displayList) are not executed in one pass, but are delayed with callLater to 3 half-frames. <strong>Half-frame</strong> because the Render event happens in the same frame as the EnterFrame event.<br />
This should reduce performance peaks at application-startup and should increase the UIs responsiveness.<br />
You can also use it later on in your application if you have to render heavy stuff, to balance the load across frames.</p>
<p><span class="hl">So far so good. But&#8230;</span><br />
First let me emphasis that I am sure that the SDK architects has had some good reasons for implementing callLater, but it <strong>introduces an asynchronism</strong> which could be hard to control. Normally with async stuff you have an event driven approach, so you get informed when the async task is done.<br />
With callLater it´s not so clear when the last callLater is really finished. There is an UpdateComplete event in UIComponent and LayoutManager which helps to get informed when the last callLater is executed, but in-between, you don´t have control about the distinct moments of your function calls.</p>
<p>Another issue is that you cannot control if your heavy load is really spread over 2 frames. It could be that it is just executed inside one frame at the EnterFrame event and at the Render event, so it could be that you don´t win anything from the load-balancing perspective.</p>
<p>Performance-wise there could also be perceptible delays caused by repeatedly callLater executions.</p>
<p>I guess there are many special situations in the framework code (probably mostly measurement stuff) which are difficult to handle, but i guess it <em>should</em> be possible (maybe I am too optimistic?).</p>
<p>There seems to be a problem to get the correct measurement when you set a new text in a TextField before the frame is actually rendered (see <a href="http://tech.groups.yahoo.com/group/flexcoders/message/121060" target="_blank"> this post</a> at flexcoders), but if this is an unsolvable problem then it should be urgently fixed in the Flash Player.</p>
<p>References@livedocs:<br />
<a href="http://livedocs.adobe.com/flex/3/langref/mx/core/UIComponent.html#callLater()" target="_blank">callLater()</a><br />
<a href="http://livedocs.adobe.com/flex/3/langref/mx/managers/LayoutManager.html#usePhasedInstantiation" target="_blank">usePhasedInstantiation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.screenshot.at/blog/2009/05/05/the-infamous-calllater/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
