<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>arielsommeria.com/blog/</title>
	
	<link>http://arielsommeria.com/blog</link>
	<description>Flash, Flex, and Open Source</description>
	<lastBuildDate>Wed, 04 Nov 2009 16:17:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/arielsommeria/blog" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>Flexing with a Flasher : Integrating Flash Designs in Flex</title>
		<link>http://feedproxy.google.com/~r/arielsommeria/blog/~3/-3sAjVDZtmU/</link>
		<comments>http://arielsommeria.com/blog/2009/11/04/flexing-with-a-flasher-integrating-flash-designs-in-flex/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 16:17:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://arielsommeria.com/blog/?p=156</guid>
		<description><![CDATA[Up till now I’ve worked with designers who have given me images and guidelines on how to use them in Flex. So I would get a load of PNGs, and we would sit down together and toy with the animation that would use them in the application. Now I’m confronted with something a bit more [...]]]></description>
			<content:encoded><![CDATA[<p>Up till now I’ve worked with designers who have given me images and guidelines on how to use them in Flex. So I would get a load of PNGs, and we would sit down together and toy with the animation that would use them in the application. Now I’m confronted with something a bit more ambitious : Using Flash objects and communicating with them. This includes stuff like comboboxes designed in Flash. I&#8217;m working with <a href="http://www.moonpalace.fr/">this</a> guy, take a look.</p>
<p>This should be easy but somehow isn&#8217;t. As I understand the upcoming Flash Builder will ease some of the pain. In the meantime, I&#8217;ve spent quite a bit of time figuring out how to get things going with a minimum of a code and a maximum of help from the IDE. The best method for this is for the designer to do his work in Flash, and export all his elements in a Flash library. You may have seen these around, their file extension is .SWC. These files are actually zips which contain 2 things : the actual resources, like a SWF, and a catalog file describing what is inside.</p>
<p>If you import this SWC file in Flex, the Flex compiler has access to the exported objects contained in it, and they show up in the auto-complete dialog. If for example the Flash designer exports a  « Banner » clip, then you can use Banner directly in Flex. The main  problem is that you can’t include these in your typical Flex visual object. If you try to add the banner to a Flex object using the addChild method as you would with another Flex object, you will get the following compiler error :</p>
<p><span style="color: #ff0000;">TypeError: Error #1034: Type Coercion failed: cannot convert InscriptionTitre@d1ba4c1 to mx.core.IUIComponent.</span></p>
<p>There is however a workaround for this. You have to use a Flex object as a wrapper. The one I’ve found that works the best is mx.controls.Image. In MXML you would do the following :</p>
<p><span style="color: #0000ff;">&lt;mx:Image source=&#8221;{Banner}&#8221;/&gt;</span></p>
<p>Image recognises Banner as a static resource, instanciates it and shows it. That’s already a nice start. But what if you to do something which needs some interaction ? Suppose you have an animated banner, and you don’t want the animation to start straight away, but only when you call the play() method on it. Let’s call this AnimatedBanner. This code won&#8217;t cut it :</p>
<p><span style="color: #0000ff;">&lt;mx:Image source=&#8221;{AnimatedBanner}&#8221;/&gt;</span></p>
<p>This fails you because you don’t have a pointer to the AnimatedBanner instance. So what you can do is the following :</p>
<p><span style="color: #0000ff;">private var _animatedBanner :AnimatedBanner ;</span></p>
<p>In your MXML :</p>
<p><span style="color: #0000ff;">&lt;mx :Image id= « animatedBannerWrapper»/&gt;</span></p>
<p>In your init function :</p>
<p><span style="color: #0000ff;">_animatedBanner = new AnimatedBanner() ;</span></p>
<p><span style="color: #0000ff;">animatedBannerWrapper.source  = _animatedBanner ;</span></p>
<p>Voila !</p>
<p>In this way, when you are good and ready, you can call _animatedBanner.play() ;</p>
<p>There are a couple more issues that could use addressing in a follow up post, but that should get you started.</p>
<img src="http://feeds.feedburner.com/~r/arielsommeria/blog/~4/-3sAjVDZtmU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://arielsommeria.com/blog/2009/11/04/flexing-with-a-flasher-integrating-flash-designs-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://arielsommeria.com/blog/2009/11/04/flexing-with-a-flasher-integrating-flash-designs-in-flex/</feedburner:origLink></item>
		<item>
		<title>On Class Design and the Flex UIComponent</title>
		<link>http://feedproxy.google.com/~r/arielsommeria/blog/~3/2BApy5wfsEY/</link>
		<comments>http://arielsommeria.com/blog/2009/07/08/on-class-design-and-the-flex-uicomponent/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 17:00:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://arielsommeria.com/blog/?p=153</guid>
		<description><![CDATA[One of the best tips I’ve heard on class design is the following : Say the Class name and the member names out loud. If it doesn’t sound right, you’ve got to change something.
As a case study, let’s look at the Flex UIComponent. Ok it’s called UIComponent. Fair enough that’s a pretty good name. UI says [...]]]></description>
			<content:encoded><![CDATA[<p>One of the best tips I’ve heard on class design is the following : Say the Class name and the member names out loud. If it doesn’t sound right, you’ve got to change something.</p>
<p>As a case study, let’s look at the Flex <a href="http://livedocs.adobe.com/flex/3/langref/mx/core/UIComponent.html">UIComponent</a>. Ok it’s called UIComponent. Fair enough that’s a pretty good name. UI says user interface. It could be GUI which would be more precise, but as everything in Flash/Flex is geared towards graphics this can be forgiven. Component says that it isn&#8217;t just eye candy and that there is some functionality  behind it,  and is purposely vague, which is ok as it’s a base class.</p>
<p>Now let’s look at a few member functions and properties. The first thing that strikes you when you look at the doc is how many there are. That’s already a bad sign. I don’t think even the guy who wrote it knows everything that’s in it.</p>
<p>Next, there’s a whole lot of properties that have the word <a href="http://livedocs.adobe.com/flex/3/langref/mx/core/UIComponent.html#width">width </a>in it. Width is a good fit for UIComponent, it feels like it belongs there. The obvious advantage of this is that when you look for the « width » property, it’s where you expect it to be. But how about the following :</p>
<p>ExplicitMaxWidth, explicitMinWidth, explicitWidth, maxWidth, measuredMinWidth, measuredWidth, minWidth, percentWidth. Does this not strike you as a bit too much ? Couldn’t there be some more elegant way to access all this width goodness ?</p>
<p>But my favorite is the following : <a href="http://livedocs.adobe.com/flex/3/langref/mx/core/UIComponent.html#determineTextFormatFromStyles()">determineTextFormatFromStyles</a>. Why is that even in there ? Surely this could be in another class, maybe dedicated to styles or something ?</p>
<p>I&#8217;ll stop there. These are just a few examples of UIComponent overstepping its bounds. From a pretty clear cut idea and a good name for a class and concept the Flex team has somehow turned it into a monster with over 9000 lines of code. Maybe if they&#8217;d thought things through out loud things wouldn&#8217;t have got so far out of control.</p>
<img src="http://feeds.feedburner.com/~r/arielsommeria/blog/~4/2BApy5wfsEY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://arielsommeria.com/blog/2009/07/08/on-class-design-and-the-flex-uicomponent/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://arielsommeria.com/blog/2009/07/08/on-class-design-and-the-flex-uicomponent/</feedburner:origLink></item>
		<item>
		<title>generating todos from code comments in Flex Builder</title>
		<link>http://feedproxy.google.com/~r/arielsommeria/blog/~3/BQK8YT0NKhs/</link>
		<comments>http://arielsommeria.com/blog/2009/06/15/generating-todos-from-code-comments-in-flex-builder/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 13:34:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://arielsommeria.com/blog/?p=146</guid>
		<description><![CDATA[I was doing some wishful thinking about generating todos from code comments in Flex Builder over at Ted&#8217;s Blog and someone helpfully pointed me to someone who has the job for me. Here&#8217;s a plugin for Flex builder that does exactly that.
http://www.richinternet.de/blog/index.cfm?entry=911D4B57-0F0D-5A73-AF6F4D4D04099757
Share the love!
in French here
]]></description>
			<content:encoded><![CDATA[<p>I was doing some wishful thinking about generating todos from code comments in Flex Builder over at<a href="http://onflash.org/ted/2009/06/development-todo-lists.php?ext-ref=comm-sub-email"> Ted&#8217;s Blog</a> and someone helpfully pointed me to someone who has the job for me. Here&#8217;s a plugin for Flex builder that does exactly that.</p>
<p><a href="http://www.richinternet.de/blog/index.cfm?entry=911D4B57-0F0D-5A73-AF6F4D4D04099757">http://www.richinternet.de/blog/index.cfm?entry=911D4B57-0F0D-5A73-AF6F4D4D04099757</a></p>
<p>Share the love!</p>
<p>in French <a href="http://www.silexlabs.com/2009/06/generer-des-listes-de-taches-dans-flex-builder-a-partir-de-commentaires-dans-le-code/">here</a></p>
<img src="http://feeds.feedburner.com/~r/arielsommeria/blog/~4/BQK8YT0NKhs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://arielsommeria.com/blog/2009/06/15/generating-todos-from-code-comments-in-flex-builder/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://arielsommeria.com/blog/2009/06/15/generating-todos-from-code-comments-in-flex-builder/</feedburner:origLink></item>
		<item>
		<title>Flash at its best and its worst simultaneously</title>
		<link>http://feedproxy.google.com/~r/arielsommeria/blog/~3/H608p8dOC2E/</link>
		<comments>http://arielsommeria.com/blog/2009/06/10/flash-at-its-best-and-its-worst-simultaneously/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 07:46:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://arielsommeria.com/blog/?p=139</guid>
		<description><![CDATA[I&#8217;ve just found this website that has the dubious honour of being delicately entrancing and beautifully crafted, and at the same time one of the worst examples of Unnavigatable Flash Crap.
http://www.ark-plus.com/#/En/main/
It takes a lot from dontclick.it, which I&#8217;m a big fan of. At the end of my visit, engrossed in drawing shapes and zooming around [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just found this website that has the dubious honour of being delicately entrancing and beautifully crafted, and at the same time one of the worst examples of Unnavigatable Flash Crap.</p>
<p><a href="http://www.ark-plus.com/#/En/main/">http://www.ark-plus.com/#/En/main/</a></p>
<p>It takes a lot from <a href="http://dontclick.it">dontclick.it</a>, which I&#8217;m a big fan of. At the end of my visit, engrossed in drawing shapes and zooming around in their virtual environment thingy, I have no clue what the website is about or what they are selling.</p>
<p>thanks to <a href="http://www.hebiflux.com/blog/2009/06/09/arkplus-dessiner-cest-naviguer/">hebiflux </a>for the link.</p>
<p>in French <a href="http://www.silexlabs.com/2009/06/le-meilleur-et-le-pire-de-flash-simultanement/">here</a></p>
<img src="http://feeds.feedburner.com/~r/arielsommeria/blog/~4/H608p8dOC2E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://arielsommeria.com/blog/2009/06/10/flash-at-its-best-and-its-worst-simultaneously/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://arielsommeria.com/blog/2009/06/10/flash-at-its-best-and-its-worst-simultaneously/</feedburner:origLink></item>
		<item>
		<title>silex is sourceforge project of the month!</title>
		<link>http://feedproxy.google.com/~r/arielsommeria/blog/~3/jX0ObyVKLTE/</link>
		<comments>http://arielsommeria.com/blog/2009/06/03/silex-is-sourceforge-project-of-the-month/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 13:49:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://arielsommeria.com/blog/?p=135</guid>
		<description><![CDATA[I haven&#8217;t been posting much recently because I&#8217;ve busy with Silex. It has been well worth the trouble because Silex is project of the month on Sourceforge!
Read all about it here : http://sourceforge.net/community/june-project-of-the-month/
For those of you new to Silex, it&#8217;s a Flash based CMS. I could go on about what makes it so cool, but [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t been posting much recently because I&#8217;ve busy with<a href="http://silex-ria.org/"> Silex</a>. It has been well worth the trouble because Silex is project of the month on Sourceforge!<br />
Read all about it here : <a href="http://sourceforge.net/community/june-project-of-the-month/">http://sourceforge.net/community/june-project-of-the-month/</a></p>
<p>For those of you new to Silex, it&#8217;s a Flash based CMS. I could go on about what makes it so cool, but the best is to have a look for yourself : <a href="http://silex-ria.org/">http://silex-ria.org/</a></p>
<p>Finally, if you&#8217;re interested in participating, let me know! We need developers of course, but if you want to help with a community in your country, or do some design, we could use the help.</p>
<img src="http://feeds.feedburner.com/~r/arielsommeria/blog/~4/jX0ObyVKLTE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://arielsommeria.com/blog/2009/06/03/silex-is-sourceforge-project-of-the-month/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://arielsommeria.com/blog/2009/06/03/silex-is-sourceforge-project-of-the-month/</feedburner:origLink></item>
		<item>
		<title>Flash Player 10 for Firefox on Mac OS sucks: the limits of Flash cross-everything compatibility</title>
		<link>http://feedproxy.google.com/~r/arielsommeria/blog/~3/PO840bs1G2c/</link>
		<comments>http://arielsommeria.com/blog/2009/05/05/flash-player-10-for-firefox-on-mac-os-sucks-the-limits-of-flash-cross-everything-compatibility/#comments</comments>
		<pubDate>Tue, 05 May 2009 06:57:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://arielsommeria.com/blog/?p=129</guid>
		<description><![CDATA[I recently discovered that Flash 10 for Firefox on Mac OS has some pretty serious redraw problems. This is a pretty small subset of users, but nonetheless troubling. One of the main selling points of Flash, and maybe the main reason why I got interested in the platform in the first place is the idea [...]]]></description>
			<content:encoded><![CDATA[<p>I recently discovered that Flash 10 for Firefox on Mac OS has some pretty serious redraw problems. This is a pretty small subset of users, but nonetheless troubling. One of the main selling points of Flash, and maybe the main reason why I got interested in the platform in the first place is the idea that developers don&#8217;t have to deal with the mess that is cross-browser development. For those of you unfamiliar with the situation, development in HTML means toiling away to get your design look halfway decent in your browser of choice, and then seeing it look completely crappy in other browsers.With Flash, supposedly no more such problems!</p>
<p>OK, so I&#8217;m complaining, but in most cases Flash does what it says on the tin and does a good job of keeping Flash version problems out of your face. But obviously here there has been some slip ups. Maybe the team has gotten sloppy? Any feedback on what&#8217;s going on is welcome.</p>
<p>This post is available in French <a href="http://www.silex-labs.com/2009/05/flash-10-pour-firefox-mac-a-des-gros-problemes-les-limites-de-la-compatibilite-de-flash-avec-tout/">here</a></p>
<img src="http://feeds.feedburner.com/~r/arielsommeria/blog/~4/PO840bs1G2c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://arielsommeria.com/blog/2009/05/05/flash-player-10-for-firefox-on-mac-os-sucks-the-limits-of-flash-cross-everything-compatibility/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		<feedburner:origLink>http://arielsommeria.com/blog/2009/05/05/flash-player-10-for-firefox-on-mac-os-sucks-the-limits-of-flash-cross-everything-compatibility/</feedburner:origLink></item>
		<item>
		<title>My First Interview</title>
		<link>http://feedproxy.google.com/~r/arielsommeria/blog/~3/RlSM7RwpC8c/</link>
		<comments>http://arielsommeria.com/blog/2009/04/27/my-first-interview/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 16:45:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://arielsommeria.com/blog/?p=125</guid>
		<description><![CDATA[I now have some serious bragging rights and geek cred, I gave  my very first interview, and the blog I gave it to has Flex in its name.
http://www.flex888.com/1108/pearltrees-a-novel-approach-to-web.html
Thanks to Sravan at Flex888!
Ariel
]]></description>
			<content:encoded><![CDATA[<p>I now have some serious bragging rights and geek cred, I gave  my very first interview, and the blog I gave it to has Flex in its name.</p>
<p><a href="http://www.flex888.com/1108/pearltrees-a-novel-approach-to-web.html">http://www.flex888.com/1108/pearltrees-a-novel-approach-to-web.html</a></p>
<p>Thanks to Sravan at Flex888!</p>
<p>Ariel</p>
<img src="http://feeds.feedburner.com/~r/arielsommeria/blog/~4/RlSM7RwpC8c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://arielsommeria.com/blog/2009/04/27/my-first-interview/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://arielsommeria.com/blog/2009/04/27/my-first-interview/</feedburner:origLink></item>
		<item>
		<title>Firefox’s Zoom messes up Iframes with Flex. Here’s the fix</title>
		<link>http://feedproxy.google.com/~r/arielsommeria/blog/~3/AnOa84L08J4/</link>
		<comments>http://arielsommeria.com/blog/2009/04/22/firefoxs-zoom-messes-up-iframes-with-flex-heres-the-fix/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 06:45:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://arielsommeria.com/blog/?p=118</guid>
		<description><![CDATA[While working on IFrame integration for pearltrees I came across a pretty unfathomable bug that I haven&#8217;t seen documented elsewhere, so I thought I&#8217;d post about it here. Zooming in Firefox messes up IFrame positioning. Furthermore, Firefox remembers zooming for each individual page, so if perchance you zoomed in the application by accident, things will [...]]]></description>
			<content:encoded><![CDATA[<p style="margin-bottom: 0cm;" align="justify">While working on IFrame integration for <a href="http://www.pearltrees.com/ariel">pearltrees</a> I came across a pretty unfathomable bug that I haven&#8217;t seen documented elsewhere, so I thought I&#8217;d post about it here. Zooming in Firefox messes up IFrame positioning. Furthermore, Firefox remembers zooming for each individual page, so if perchance you zoomed in the application by accident, things will be permanently messed for that url. What it looked like at the offset was that on one computer only the Iframe would spill out of its bounds. Changing the name of the html file would somehow solve the problem. <img src='http://arielsommeria.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Once I&#8217;d identified the problem, here&#8217;s how I solved it. The fix only works if the host Flash application uses “noscale”, and would need to be slightly adapted if the application didn&#8217;t take the whole window. The main IFrame management code is inspired from <a href="http://www.deitte.com/archives/2006/08/finally_updated.htm">this</a>.</p>
<p style="margin-bottom: 0cm;" align="justify">The first step is to detect zooming. I drew inspiration from this <a href="http://novemberborn.net/javascript/page-zoom-ff3">post</a> to write the following:</p>
<p style="margin-bottom: 0cm;" align="justify">In the loading file I added a simple function to get the browser width:</p>
<p style="margin-bottom: 0cm;" align="justify">
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;">function getInnerWidth(){</span></span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;">return innerWidth;</span></span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;">}</span></span></p>
<p style="margin-bottom: 0cm;" align="justify">
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;">Using this function and the stage width I can deduce the zoom factor and apply it to my IFrame to size and position it : </span></span></p>
<p style="margin-bottom: 0cm;" align="justify">
<p style="margin-bottom: 0cm;" align="left"><span style="color: #000000;"> </span><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #3f5fbf;">/**</span></span></span></p>
<p style="margin-bottom: 0cm;" align="left"><span style="color: #3f5fbf;"> <span style="font-family: Courier New,monospace;"><span style="font-size: x-small;">* Adjust frame position to match the exposed area in the application.</span></span></span></p>
<p style="margin-bottom: 0cm;" align="left"><span style="color: #3f5fbf;"> <span style="font-family: Courier New,monospace;"><span style="font-size: x-small;">* </span></span></span></p>
<p style="margin-bottom: 0cm;" align="left"><span style="color: #3f5fbf;"> <span style="font-family: Courier New,monospace;"><span style="font-size: x-small;">*/</span></span></span></p>
<p style="margin-bottom: 0cm;" align="left"><span style="color: #000000;"> </span><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="color: #0033ff;"><strong>public</strong></span><span style="color: #000000;"> </span><span style="color: #339966;"><strong>function</strong></span><span style="color: #000000;"> moveIFrame(): </span><span style="font-size: x-small;"><strong>void{</strong></span></span></span></p>
<p style="margin-bottom: 0cm;" align="left"><span style="color: #000000;"> </span><span style="color: #000000;"><span style="font-size: x-small;"><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> localPt:Point = </span><span style="color: #0033ff;"><strong>new</strong></span><span style="color: #000000;"> Point(0, 0);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="left"><span style="color: #000000;"> </span><span style="color: #000000;"> </span><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> globalPt:Point = </span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.localToGlobal(localPt);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="left"><span style="color: #000000;"> </span><span style="color: #000000;"> </span><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> innerWidth:Number = ExternalInterface.call(</span><span style="color: #990000;"><strong>&#8220;getInnerWidth&#8221;</strong></span><span style="color: #000000;">);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="left"><span style="color: #000000;"> </span><span style="color: #000000;"> </span><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> browserScaling:Number = 1;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="left"><span style="color: #000000;"> </span><span style="color: #000000;"> </span><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #0033ff;"><strong>if</strong></span><span style="color: #000000;">(innerWidth &gt; 0){</span></span></span></p>
<p style="margin-bottom: 0cm;" align="left"><span style="color: #000000;"> </span><span style="color: #000000;"> </span><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;">browserScaling = innerWidth / </span><span style="color: #000000;"><strong>Application.application</strong></span><span style="color: #000000;">.width; </span></span></span></p>
<p style="margin-bottom: 0cm;" align="left"><span style="color: #000000;"> </span><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;">}</span></span></span></p>
<p style="margin-bottom: 0cm;" align="left"><span style="color: #000000;"> </span><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;">ExternalInterface.call(</span><span style="color: #990000;"><strong>&#8220;moveIFrame&#8221;</strong></span><span style="color: #000000;">, frameId, iframeId, globalPt.x * browserScaling, </span></span></span><span style="color: #000000;"> </span><span style="color: #000000;"> </span><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="color: #000000;">globalPt.y * browserScaling, </span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.width * browserScaling, </span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.height * </span></span></span><span style="color: #000000;"> </span><span style="color: #000000;"> </span><span style="color: #000000;"> </span><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="color: #000000;">browserScaling);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="left"><span style="color: #000000;"> <span style="font-family: Courier New,monospace;"><span style="font-size: x-small;">}</span></span></span></p>
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;">Finally, when should this resizing occur? On loading, obviously, but also when the user resizes during the session. So in the Iframe constructor I added the following callback that can be called from Javascript:</span></span></p>
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left"><span style="color: #000000;"> <span style="font-family: Courier New,monospace;"><span style="font-size: x-small;">ExternalInterface.addCallback(</span><span style="color: #990000;"><strong>&#8220;refreshIFrame&#8221;</strong></span><span style="color: #000000;">, moveIFrame);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;">Then I added the following event listener on the body element of the HTML container:</span></span></p>
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;">onresize=&#8221;document.getElementById(&#8217;Main&#8217;).refreshIFrame()&#8221; </span></span></p>
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;">Voilà! On the fly adaptation to a user zoom when using an Iframe in Flex. Added points would be for re-dimensioning the Iframe during the mouse scroll, but at least for now this is more than enough for my purposes. </span></span></p>
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="text-decoration: underline;">Update</span>: Of course, talk is nice, a working example is appreciated. <a href="http://arielsommeria.com/blog/content/iframe-zoom/FirefoxZoomTest.html">Here</a> we go</span></span></p>
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;" align="left">
<img src="http://feeds.feedburner.com/~r/arielsommeria/blog/~4/AnOa84L08J4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://arielsommeria.com/blog/2009/04/22/firefoxs-zoom-messes-up-iframes-with-flex-heres-the-fix/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		<feedburner:origLink>http://arielsommeria.com/blog/2009/04/22/firefoxs-zoom-messes-up-iframes-with-flex-heres-the-fix/</feedburner:origLink></item>
		<item>
		<title>Celebrate Request For Comment(RFC) Culture</title>
		<link>http://feedproxy.google.com/~r/arielsommeria/blog/~3/Twd2uLmtjHg/</link>
		<comments>http://arielsommeria.com/blog/2009/04/08/celebrate-request-for-commentrfc-culture/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 08:37:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://arielsommeria.com/blog/?p=113</guid>
		<description><![CDATA[The first RFC(Request For Comment) was written 40 years ago today, and the NYTimes has a piece on it here. I like RFCs, not particularly that they make pleasant reading, but that they are a great design methodology. It&#8217;s about saying&#8221; hey kids, I think there&#8217;s a technical need here, and here&#8217;s how we can [...]]]></description>
			<content:encoded><![CDATA[<p>The first RFC(Request For Comment) was written 40 years ago today, and the NYTimes has a piece on it <a href="http://www.nytimes.com/2009/04/07/opinion/07crocker.html?_r=2&amp;scp=1&amp;sq=how%20the%20internet%20got%20it%27s%20rules&amp;st=cse">here</a>. I like RFCs, not particularly that they make pleasant reading, but that they are a great design methodology. It&#8217;s about saying&#8221; hey kids, I think there&#8217;s a technical need here, and here&#8217;s how we can address it. If anyone feels they can improve, let me know, and we can maybe work something out. Feel free to roll your own!&#8221;. It clearly knocks the socks off death by committee which comes up with monsters like MPEG, USB, 1394&#8230; It&#8217;s also one of the roots of open source. I&#8217;ve personally slogged at implementing a protocol so that one toy could be compatible with another, and I have the RFCs to thank.</p>
<p>Happy birthday RFCs! Here&#8217;s a pearltree collecting a few RFCs that I find of interest.<br />
<a title="click here to see: RFC" href="http://www.pearltrees.com/ariel/map/1_359/" id="pt-pearl-1_359-415" target="_blank">RFC</a><br />
<script src="http://www.pearltrees.com/embed/pt-embed.js" type="text/javascript"></script><br />
<script type="text/javascript">ptInitTree('pt-pearl-1_359-415',1,20,1,359,1);</script><br />
Hit the link, press play, navigate the map, and please leave a comment!</p>
<img src="http://feeds.feedburner.com/~r/arielsommeria/blog/~4/Twd2uLmtjHg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://arielsommeria.com/blog/2009/04/08/celebrate-request-for-commentrfc-culture/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://arielsommeria.com/blog/2009/04/08/celebrate-request-for-commentrfc-culture/</feedburner:origLink></item>
		<item>
		<title>Why Extending Flex Sucks</title>
		<link>http://feedproxy.google.com/~r/arielsommeria/blog/~3/NYKWahUUrbU/</link>
		<comments>http://arielsommeria.com/blog/2009/04/03/why-extending-flex-sucks/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 07:10:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://arielsommeria.com/blog/?p=99</guid>
		<description><![CDATA[Flex has been open source for a while now, so you might wonder why there doesn&#8217;t seem to be more external, community-driven extensions to the library. It seems that the only source contributors are Adobe employees. I&#8217;ll pass on the theories on why Adobe might want to keep it this way. The purpose of this [...]]]></description>
			<content:encoded><![CDATA[<p style="margin-bottom: 0cm;" align="justify">Flex has been open source for a while now, so you might wonder why there doesn&#8217;t seem to be more external, community-driven extensions to the library. It seems that the only source contributors are Adobe employees. I&#8217;ll pass on the theories on why Adobe might want to keep it this way. The purpose of this post is to look at why from a strictly technical point of view it&#8217;s really discouraging to try to extend the library. I&#8217;ve tried, and these are the problems I&#8217;ve run into.</p>
<p style="margin-bottom: 0cm;" align="justify">
<ul>
<li>
<p style="margin-bottom: 0cm;" align="justify">Flex classes are 	huge. Adobe seems to have taken the « everything but the 	kitchen sink » approach to designing Flex, so you end up with 	huge blobs of code with tuff and features and whatnots that have 	nothing to do with the class&#8217;s purpose. So obviously a big class is 	harder to read and extend.</p>
</li>
<li>
<p style="margin-bottom: 0cm;" align="justify">mx_internal. 	Everywhere you look in Flex classes you find variables that are part 	of the namespace mx_internal. Since this isn&#8217;t documented, it&#8217;s 	anybody&#8217;s guess why the more traditional private, internal, 	protected and public declarations aren&#8217;t enough. The thing is you 	actually <em>can </em><span style="font-style: normal;">use mx_internal 	objects, <a href="http://raghuonflex.wordpress.com/2007/09/03/mx_internal-a-life-saver/">you just have to know how to</a>. So what it the 	intention? Don&#8217;t use mx_internal in your derived classes unless 	you&#8217;re really hardcore? I&#8217;m baffled, so if anyone has an explanation 	please leave it in the comments.</span></p>
</li>
<li>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-style: normal;">Using 	private instead of protected. Sometimes you need access to a 	variable from your subclass and it&#8217;s been declared private. This 	happens quite often. So you end up copying the class into your 	workspace to modify it instead of extending it as you should.</span></p>
</li>
<li>
<p align="justify"><span style="font-style: normal;">This isn&#8217;t so 	common as mx_internal, but still annoys. Instead of using a class 	reference, Flex sometimes uses a path reference to a file.  	« </span><span style="color: #0033ff;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="font-style: normal;"><strong>include</strong></span></span></span></span><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="font-style: normal;"> </span></span></span></span><span style="color: #990000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="font-style: normal;"><strong>&#8220;../core/Version.as&#8221;</strong></span></span></span></span><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="font-style: normal;">; ». </span></span></span></span><span style="color: #000000;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="font-style: normal;">Looks 	crappy, right? Yeah, it is.  Suppose you&#8217;ve copied the class locally, as mentioned above. The path reference won&#8217;t 	work, and you need to jump through even more hoops to get the job 	done. </span></span></span></span></p>
</li>
</ul>
<p align="justify"><span style="color: #000000;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="font-style: normal;">That wraps it up for now. To get a good exapmple of everything I mentioned, take a look at the mx.effects.effectClasses.MoveInstance class. It does a good job, but is long, unreadable and unextendable. Don&#8217;t get me wrong, I still like Flex otherwise I wouldn&#8217;t work with it and post about it, but sometimes it gets me down.</span></span></span></span></p>
<img src="http://feeds.feedburner.com/~r/arielsommeria/blog/~4/NYKWahUUrbU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://arielsommeria.com/blog/2009/04/03/why-extending-flex-sucks/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://arielsommeria.com/blog/2009/04/03/why-extending-flex-sucks/</feedburner:origLink></item>
	</channel>
</rss>
