<?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>The Open Coder &#187; Flex</title>
	<atom:link href="http://www.opencoder.co.uk/tag/flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.opencoder.co.uk</link>
	<description>Helping the fellow geek</description>
	<lastBuildDate>Fri, 15 Apr 2011 12:25:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>instanceof is bad in ActionScript</title>
		<link>http://www.opencoder.co.uk/2011/04/instanceof-is-bad-in-actionscript/</link>
		<comments>http://www.opencoder.co.uk/2011/04/instanceof-is-bad-in-actionscript/#comments</comments>
		<pubDate>Fri, 15 Apr 2011 12:25:41 +0000</pubDate>
		<dc:creator>Chris McDonald</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[General ramblings]]></category>
		<category><![CDATA[actionscript]]></category>

		<guid isPermaLink="false">http://www.opencoder.co.uk/?p=460</guid>
		<description><![CDATA[This is a quick post to let everyone aware that instanceof should be avoided like the plague in your Flex/ActionScript 3 projects. Coming from a Java development background I was quite familiar with using instanceof to test if a class is of a certain type, in Java this also matches interfaces, not so in ActionScript. [...]]]></description>
			<content:encoded><![CDATA[<p>This is a quick post to let everyone aware that <em>instanceof</em> should be avoided like the plague in your Flex/ActionScript 3 projects. Coming from a Java development background I was quite familiar with using <em>instanceof</em> to test if a class is of a certain type, in Java this also matches interfaces, not so in ActionScript.</p>
<p>To illustrate the problem, here are some simple classes and an interface:</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;"><span class="kw3">public</span> <span class="kw2">class</span> Vehicle <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">var</span> <span class="kw3">_name</span>:<span class="kw3">String</span>;</p>
<p>&nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> Vehicle<span class="br0">&#40;</span><span class="kw3">name</span>:<span class="kw3">String</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">_name</span> = <span class="kw3">name</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> <span class="kw3">get</span> <span class="kw3">name</span><span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">String</span><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw3">_name</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> drive<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">trace</span><span class="br0">&#40;</span><span class="st0">&quot;Vehicle named &quot;</span>+<span class="kw3">_name</span>+<span class="st0">&quot; drove.&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="kw3">public</span> <span class="kw3">interface</span> IManualGears <span class="br0">&#123;</span></p>
<p>&nbsp; &nbsp; <span class="kw2">function</span> changeGear<span class="br0">&#40;</span>gear:<span class="kw3">int</span><span class="br0">&#41;</span>:<span class="kw3">void</span>;</p>
<p><span class="br0">&#125;</span></p>
<p><span class="kw3">public</span> <span class="kw2">class</span> ManualCar <span class="kw3">extends</span> Vehicle <span class="kw3">implements</span> IManualGears <span class="br0">&#123;</span></p>
<p>&nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> ManualCar<span class="br0">&#40;</span><span class="kw3">name</span>:<span class="kw3">String</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">super</span><span class="br0">&#40;</span><span class="kw3">name</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> changeGear<span class="br0">&#40;</span>gear:<span class="kw3">int</span><span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">trace</span><span class="br0">&#40;</span><span class="st0">&quot;Vehicle named &quot;</span>+<span class="kw3">_name</span>+<span class="st0">&quot; changed gear to &quot;</span>+gear<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p><span class="br0">&#125;</span></div>
</div>
<p>If I were to create a new instance of ManualCar and tested for the interface IManualGears using instanceof it would fail, as shown below;</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;"><span class="kw2">var</span> car:ManualCar = <span class="kw2">new</span> ManualCar<span class="br0">&#40;</span><span class="st0">&quot;Ford Escort&quot;</span><span class="br0">&#41;</span>;</p>
<p><span class="kw2">var</span> isVehicle:<span class="kw3">Boolean</span> = <span class="br0">&#40;</span>car <span class="kw3">instanceof</span> Vehicle<span class="br0">&#41;</span>; &nbsp;<span class="co1">//isVehicle would be true</span></p>
<p><span class="kw2">var</span> isManualCar:Booelan = <span class="br0">&#40;</span>car <span class="kw3">instanceof</span> ManualCar<span class="br0">&#41;</span>; &nbsp;<span class="co1">//isManualCar would be true</span></p>
<p><span class="kw2">var</span> hasGears:<span class="kw3">Boolean</span> = <span class="br0">&#40;</span>car <span class="kw3">instanceof</span> IManualGears<span class="br0">&#41;</span>; &nbsp;<span class="co1">//hasGears would be false</span></p>
<p>hasGears:<span class="kw3">Boolean</span> = <span class="br0">&#40;</span>car is IManualGears<span class="br0">&#41;</span>; &nbsp;<span class="co1">//hasGears would be true;</span></div>
</div>
<p>To be fair this is stated in the flex documentation, but it did catch me out. So the moral of the story is to always use <em>is</em> instead of <em>instanceof</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opencoder.co.uk/2011/04/instanceof-is-bad-in-actionscript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>URL regular expression</title>
		<link>http://www.opencoder.co.uk/2011/01/url-regular-expression/</link>
		<comments>http://www.opencoder.co.uk/2011/01/url-regular-expression/#comments</comments>
		<pubDate>Wed, 05 Jan 2011 13:30:26 +0000</pubDate>
		<dc:creator>Chris McDonald</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[regular expressions]]></category>

		<guid isPermaLink="false">http://www.opencoder.co.uk/?p=461</guid>
		<description><![CDATA[This is just a quick post to share a regular expression for a URL I had to come up with when needing to validate a URL in a Flex app. The code below is for Flex, but would only require a few minor changes for another language, the double backslash before the ? appears to [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a quick post to share a regular expression for a URL I had to come up with when needing to validate a URL in a Flex app. The code below is for Flex, but would only require a few minor changes for another language, the double backslash before the ? appears to be required for Flex, using a single backslash does not work, read more about that in this <a title="Flex regular expression issues" href="http://www.opencoder.co.uk/2010/03/regexpvalidator-issues/" target="_blank">older post</a>. This also contains what would be capturing brackets in other languages, I could have used non-capturing brackets but that would have made this already complicated example even more difficult to read.</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;">linkValidator = <span class="kw2">new</span> RegExpValidator<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
linkValidator.<span class="me1">expression</span> = <span class="st0">&quot;(http(s)?:<span class="es0">\/</span><span class="es0">\/</span>)?(([a-z]+[a-z0-9<span class="es0">\-</span>]*[.])?([a-z0-9]+[a-z0-9<span class="es0">\-</span>]*[.])+[a-z]{2,3}|localhost)(<span class="es0">\/</span>[a-z0-9_-]+[a-z0-9_ -]*)*<span class="es0">\/</span>?(<span class="es0">\\</span>?[a-z0-9_-]+=[a-z0-9 ',.-]*(&amp;amp;[a-z0-9_-]+=[a-z0-9 ',.-]*)*)?(#[a-z0-9/_-]*)?$&quot;</span>;<br />
linkValidator.<span class="me1">noMatchError</span> = resourceManager.<span class="me1">getString</span><span class="br0">&#40;</span><span class="st0">&quot;lang&quot;</span>, <span class="st0">&quot;invalidURL&quot;</span><span class="br0">&#41;</span>;<br />
linkValidator.<span class="me1">flags</span> = <span class="st0">&quot;i&quot;</span>;<br />
linkValidator.<span class="me1">source</span> = linkTextArea;<br />
linkValidator.<span class="me1">property</span> = <span class="st0">&quot;text&quot;</span>;<br />
linkValidator.<span class="me1">trigger</span> = linkTextArea;<br />
linkValidator.<span class="me1">triggerEvent</span> = Event.<span class="me1">CHANGE</span>;</div>
</div>
<p>I&#8217;ll break it down to the individual sections with a brief explaination.</p>
<pre>
//protocol and subdomain
(http(s)?:\/\/)?(([a-z]+[a-z0-9\-]*[.])?
</pre>
<p>The first part includes the protocol (http:// or https://), I am only dealing with web http urls here and it is optional in my app hence the ? at the end of the first group, the rest includes an optional subdomain which should start with one or more letters followed by zero or more letters/numbers/hyphens and a dot. This first subdomain and dot is also optional. So far this would match: <em>[empty string] http:// https//www. https://ww2</em> etc.</p>
<pre>
//server hostname
([a-z0-9]+[a-z0-9\-]*[.])+[a-z]{2,3}|localhost)
</pre>
<p>This next part includes the rest of the web host, the first grouping (first enclosing brackets) specifies the start of the hostname or a further subdomain which must start with a letter or number followed by a dot (the dot as a character set is how to represent the dot in Flex, you might be able to just use <em>\.</em>). This can be repeated many times, but then should be followed by 2 or three characters. Alternatively the hostname localhost can be used instead, the extra closing bracket matches the additional opening one after the protocol. This section should match: <em>www.example.com localhost example.com example.co.uk co.uk</em> etc.</p>
<pre>
//web path
(\/[a-z0-9_-]+[a-z0-9_ -]*)*\/?
</pre>
<p>This next part consists of the optional path (directory from the web root), it starts with a forward slash and can be any number of letters, numbers, underscores, spaces or hyphens, but can not start with a space (you might need to backslash escape your hypen in a different language. The trailing backslash is also optional as is the entire path. This part should match: <em>[empty string] / /directory /a/b/</em> etc.</p>
<pre>
//query string
(\\?[a-z0-9_-]+=[a-z0-9 ',.-]*(&amp;amp;[a-z0-9_-]+=[a-z0-9 ',.-]*)*)?
</pre>
<p>This part contains the optional query string part of the URL. Starting with a ? (may require only a single backslash in a different language), followed by the first parameter made up of one or more letters/numbers/underscores/hyphens the equals sign, followed by an optional parameter value made up of letters/numbers/spaces/apostrophes/commas/dots/hypens. This parameter=value part of the query string can be repeated several times after that but each extra parameter should be preceded with the ampersand (you would normally use just the &#038; for this, but flex requires the encoded version). This section could match: <em>[empty string] ?a= ?a=bc ?a=b&#038;c=d&#038;e=f</em> etc.</p>
<pre>
//fragment
(#[a-z0-9/_-]*)?$
</pre>
<p>Finally the last part of the expression contains the optional url fragment (the part with a #). In my case I specified zero or more letters/numbers/forward slashes/underscores/hypens (flex does not require escaping the forward slash when it is included in a character set). Then the dollar sign specifies that there should not be anything else after this. This could match: <em>[empty string] # #value #a/b/c</em> etc.</p>
<p>I hope this is useful to those struggling to create their own URL regular expression matchers. Flex devs remember to double escape the ? for the query string part of the URL.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opencoder.co.uk/2011/01/url-regular-expression/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>RegExpValidator issues</title>
		<link>http://www.opencoder.co.uk/2010/03/regexpvalidator-issues/</link>
		<comments>http://www.opencoder.co.uk/2010/03/regexpvalidator-issues/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 13:32:46 +0000</pubDate>
		<dc:creator>Chris McDonald</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[General ramblings]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[mxml]]></category>
		<category><![CDATA[regular expressions]]></category>

		<guid isPermaLink="false">http://www.opencoder.co.uk/?p=170</guid>
		<description><![CDATA[Today I came across an annoying problem involving the RegExpValidator class in Flex. In flex app for one of our projects StickyWorld, we allow users to upload images, pdfs, 3d models and most recently, reference YouTube movies inside a virtual room where people can comment on them, adding sticky notes in context. In our upload [...]]]></description>
			<content:encoded><![CDATA[<p>Today I came across an annoying problem involving the RegExpValidator class in Flex. In flex app for one of our projects <a title="StickyWorld online collaborative design review" href="http://www.stickyworld.com" target="_blank">StickyWorld</a>, we allow users to upload images, pdfs, 3d models and most recently, reference YouTube movies inside a virtual room where people can comment on them, adding sticky notes in context. In our upload window, users can choose what type of media they want to add to the room, in the case of a YouTube video only the video id is required. To make it a bit more flexible we decided to allow the users to specify a url to a video as well as just the video id. The app needed to handle urls in several different formats, e.g.</p>
<ul>
<li>http://www.youtube.com/watch?v=[videoid]</li>
<li>http://www.youtube.com/v/[videoid]</li>
<li>http://www.youtube.com/[userchannel]/[somepath]/[videoid]</li>
</ul>
<p>Sounds like a job for a regular expression right? Since we also wanted to do some validation on the field to make sure we were given a valid YouTube video url or video id, it seemed that the RegExpValidator class was perfect for the job. However after adding the RegExpValidator in MXML I had a problem that took a good while to figure out what was wrong.</p>
<p>Below is the snippet of code containing the regular expression string, its use in the validator and a validation handler function, apologies for the wrapping of the regular expression, I have split it below where the main formats are separated by pipes.</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;"><span class="br0">&#91;</span>Bindable<span class="br0">&#93;</span><br />
<span class="kw3">private</span> <span class="kw2">var</span> youtubeRegExp:<span class="kw3">String</span> = <br />
<span class="st0">&quot;^(?:http:<span class="es0">\/</span><span class="es0">\/</span>(?:www<span class="es0">\.</span>)?youtube<span class="es0">\.</span>com<span class="es0">\/</span>watch(?:<span class="es0">\?</span>|#!)v=(.<span class="es0">\{</span>11<span class="es0">\}</span>)(?:&amp;.*)?<br />
|(.<span class="es0">\{</span>11<span class="es0">\}</span>)<br />
|http:<span class="es0">\/</span><span class="es0">\/</span>(?:www<span class="es0">\.</span>)?youtube<span class="es0">\.</span>com<span class="es0">\/</span>(?:v|[A-Za-z0-9#<span class="es0">\/</span>_<span class="es0">\-</span>]*)<span class="es0">\/</span>(.<span class="es0">\{</span>11<span class="es0">\}</span>))$&quot;</span>;</p>
<p><span class="kw3">private</span> <span class="kw2">function</span> youtubeValid<span class="br0">&#40;</span>ev:ValidationResultEvent<span class="br0">&#41;</span>:<span class="kw3">void</span><br />
<span class="br0">&#123;</span><br />
    <span class="kw1">if</span> <span class="br0">&#40;</span>ev.<span class="kw3">type</span> == ValidationResultEvent.<span class="me1">VALID</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
        <span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw2">var</span> i:<span class="kw3">int</span> = <span class="nu0">0</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i <span class="sy0">&lt;</span> ev.<span class="me1">results</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span>.<span class="me1">matchedSubstrings</span>.<span class="kw3">length</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i++<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
             <span class="kw1">if</span> <span class="br0">&#40;</span>ev.<span class="me1">results</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span>.<span class="me1">matchedSubstrings</span><span class="br0">&#91;</span>i<span class="br0">&#93;</span> <span class="sy0">!</span>= <span class="kw2">null</span><span class="br0">&#41;</span><br />
                  youtubeVidId = ev.<span class="me1">results</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span>.<span class="me1">matchedSubstrings</span><span class="br0">&#91;</span>i<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp;     <span class="br0">&#125;</span><br />
        txtName.<span class="kw3">text</span> = youtubeVidId;<br />
        btnSubmit.<span class="kw3">enabled</span> = txtYouTube.<span class="kw3">text</span>.<span class="me1">length</span><span class="sy0">&gt;</span><span class="nu0">0</span>;<br />
    <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
         btnSubmit.<span class="kw3">enabled</span> = <span class="kw2">false</span>;<br />
    <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">&lt;</span>mx :RegExpValidator id=<span class="st0">&quot;youtubeValidator&quot;</span> <br />
&nbsp; &nbsp; source=<span class="st0">&quot;{txtYouTube}&quot;</span> property=<span class="st0">&quot;text&quot;</span> <br />
&nbsp; &nbsp; expression=<span class="st0">&quot;{youtubeRegExp}&quot;</span> valid=<span class="st0">&quot;youtubeValid(event)&quot;</span><br />
&nbsp; &nbsp; invalid=<span class="st0">&quot;youtubeValid(event)&quot;</span> <br />
&nbsp; &nbsp; noMatchError=<span class="st0">&quot;YouTube video url/id invalid&quot;</span><br />
&nbsp; &nbsp; trigger=<span class="st0">&quot;{txtYouTube}&quot;</span><span class="sy0">/&gt;</span></div>
</div>
<p>The problem was, nothing was coming out as valid, not even the videoid just by itself. So wrote a test using the regular expression, creating a RegExp object using the expression and testing some urls using the exec function and it appeared to be working fine, so why not with the validator? In the end it turned out to be that the problem was down to several characters needing to be escaped. The correct expression that worked is below:</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;">youtubeRegExp = <br />
<span class="st0">&quot;^(?:http:<span class="es0">\/</span><span class="es0">\/</span>(?:www<span class="es0">\.</span>)?youtube<span class="es0">\.</span>com<span class="es0">\/</span>watch(?:<span class="es0">\\</span>?|#!)v=(.<span class="es0">\{</span>11<span class="es0">\}</span>)(?:&amp;;.*)?<br />
|(.<span class="es0">\{</span>11<span class="es0">\}</span>)<br />
|http:<span class="es0">\/</span><span class="es0">\/</span>(?:www<span class="es0">\.</span>)?youtube<span class="es0">\.</span>com<span class="es0">\/</span>(?:v|[A-Za-z0-9#<span class="es0">\/</span>_<span class="es0">\-</span>]*)<span class="es0">\/</span>(.<span class="es0">\{</span>11<span class="es0">\}</span>))$&quot;</span>;</div>
</div>
<p>Since the regular expression used in RegExpValidator needs to be a String and the String is used as a bound property in MXML the curly brackets need to be be preceded with a backslash, because without them in MXML it means a data binding. That didn&#8217;t make much sense to me, since I was binding a String variable which contained the expression, but ok, I can kind of see the problem. What made even less sense was that I needed to double escape the ? when I actually wanted to include a literal ? in the expression. So I suppose since it is a string and I want to include the backslash character before the question mark I need to escape the backslash itself, leaving \\?, but then shouldn&#8217;t I have to do that for all the other times I need to include a backslash in the expression? Well it turns out the answer is no, I do not really understand it and only figured this out after a lot of debugging.</p>
<p>Another pitfall to avoid, if you are binding on a condition in MXML and you need to use logical operators, you will need to encode the logical AND &amp;&amp; should be &amp;amp;&amp;amp;, the less than &lt; should be &amp;lt; or greater than signs &gt; should be &amp;gt;, logical OR || works fine. However in those cases you should really be binding to a function which returns the boolean result you are looking for.</p>
<p>Working with MXML is cool because you can create data-bindable UI components quickly and easily, but it really isn&#8217;t when you have to worry about silly issues like wondering why your regular expressions are not working.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opencoder.co.uk/2010/03/regexpvalidator-issues/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Bug in Flash Player FileReference browse affecting Macs</title>
		<link>http://www.opencoder.co.uk/2009/09/bug-in-flash-player-filereference-browse-affecting-macs/</link>
		<comments>http://www.opencoder.co.uk/2009/09/bug-in-flash-player-filereference-browse-affecting-macs/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 12:36:40 +0000</pubDate>
		<dc:creator>Chris McDonald</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://www.opencoder.co.uk/?p=58</guid>
		<description><![CDATA[After updating my debugger version of Adobe Flash Player to 10.0.32.18 I noticed that Mouse Events were no longer working correctly. There appears to be a bug in the more recent flash player which appears to break the mouse events. It only appears to affect Macs, I am having the problem on both Safari 4.0.3 [...]]]></description>
			<content:encoded><![CDATA[<p>After updating my debugger version of Adobe Flash Player to 10.0.32.18 I noticed that Mouse Events were no longer working correctly.</p>
<p>There appears to be a bug in the more recent flash player which appears to break the mouse events. It only appears to affect Macs, I am having the problem on both Safari 4.0.3 and FireFox 3.5.3. I made a test app below which adds a few mouse event listeners to the white box and informs you of the events being received. Try it out below and comment on your results.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_testfilerefbrowse_418702720"
			class="flashmovie"
			width="625"
			height="313">
	<param name="movie" value="/wp-content/flash/testfilerefbrowse.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/wp-content/flash/testfilerefbrowse.swf"
			name="fm_testfilerefbrowse_418702720"
			width="625"
			height="313">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>If you do not have a problem, do not upgrade your flash player or you will. This has been reported as a bug to Adobe <a href="https://bugs.adobe.com/jira/browse/FP-2785" target="_blank">here</a> and <a href="https://bugs.adobe.com/jira/browse/FP-2674" target="_blank">here</a>, more people are starting to notice it, hopefully Adobe will fix it soon.</p>
<h4>Update 25/09/09</h4>
<p>So far the results of people trying out the above test on a mac have been varied. The problem seems to be occuring in Snow Leopard 1.6, with most people FireFox being the only browser experiencing the bug. I have witnessed someone running Leopard with the same versions of FireFox and Safari as myself with no problems at all. Most people who are running Snow Leopard appear to only experience the bug in FireFox with safari working fine. However, as I mentioned above,  I am having the bug appear both in Safari and FireFox. I don&#8217;t know what is so different about my set up, apart from that I have installed the latest debugger version of the Flash Player and that my system is 32-bit only.</p>
<p>If you do try out the test above and want to report your results, please provide as much information as you can, what versions of browser you are using, what is your flash player version, what OS version, 32 or 64-bit etc? Some people think the problem is with FireFox but I am not so sure.</p>
<h4>Update 06/10/09</h4>
<p>Ok, I am pretty sure now that this problem is not to do with a flash player upgrade, it is to do with Snow Leopard!</p>
<p>Recently my hard disk died, I reinstalled Snow Leopard and then restored my files from a time machine backup, I did not restore my applications.</p>
<p>Upon reinstalling Flex Builder I noticed that my flash player was now at version 9, which gave me an opportunity to test if this bug was still happening and it is, both in Safari and FireFox for Flash Player 9,0,124,0 as well. This almost definitely means the problem is down to the operating system, either Apple needs to fix it or Adobe need to come up with a fix in Flash Player. I can not run my demo test app above using flash 9 as the demo is set to require 10, but in other test apps I am getting the same broken behaviour with mouse events being lost after loading the FileReference browser. Looks like we will need to put a warning for Snow Leopard users on our flash apps.</p>
<p><strong>Update 22/11/09</strong></p>
<p>Adobe Labs have recently released Flash Player 10.1, which has fixed the issue detailed above. I have tried out the new player, but while the problems above have been fixed, many others new problems are present. For example, it appears that key events are duplicated, every keystroke entered appears twice and filtering by file type does not appear to work with FileReference. I realise this is a pre-release version constantly being improved, so hopefully these will be fixed soon. Unfortunately there is no debugger version of the new player, which is quite strange since the people who are going most likely to try out a pre-release are developers who would require the debugging features.</p>
<p>So far it appears I am the only one that has experienced these problems with the latest player, I think this is somehow related to my system being 32 bit only. It appears that most of the development efforts into Flash on the Mac are on 64 bit support, which makes sense since Apple is shifting eveything to 64 bit. If you too try out the new beta flash player and experience other bugs please report them here and on the adobe bug reporting site. This new flash player update proves that an active Flash community can get flash bugs fixed quicker and help improve the flash platform for all. Thanks to all who commented on their issues experienced with the demo.</p>
<p>You can try out the new 10.1 player at the <a title="Adobe Labs" href="http://labs.adobe.com/technologies/flashplayer10/" target="_blank">Adobe Labs site</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opencoder.co.uk/2009/09/bug-in-flash-player-filereference-browse-affecting-macs/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
	</channel>
</rss>

