<?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>DanDev.com &#187; Click</title> <atom:link href="http://www.dandev.com/tag/click/feed/" rel="self" type="application/rss+xml" /><link>http://www.dandev.com</link> <description>Daniel&#039;s Dev Blog..ish</description> <lastBuildDate>Sat, 28 Jan 2012 18:06:25 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" /> <item><title>Add a click event to a BitmapImage in Adobe Flex/AIR</title><link>http://www.dandev.com/software/add-a-click-event-to-a-bitmapimage-in-adobe-flexair/</link> <comments>http://www.dandev.com/software/add-a-click-event-to-a-bitmapimage-in-adobe-flexair/#comments</comments> <pubDate>Wed, 05 Oct 2011 04:00:29 +0000</pubDate> <dc:creator>Daniel</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[Flex]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[actionscript]]></category> <category><![CDATA[adobe]]></category> <category><![CDATA[AIR]]></category> <category><![CDATA[as3]]></category> <category><![CDATA[bitmapimage]]></category> <category><![CDATA[Click]]></category> <category><![CDATA[graphic]]></category> <category><![CDATA[MouseEvent]]></category> <guid
isPermaLink="false">http://www.dandev.com/?p=215</guid> <description><![CDATA[You may have noticed MouseEvent.Click is not an event available to be set on the BitmapImage Spark primitive(in the current Flex SDK). But, there is a simple workaround for this. All you have to do is place it inside of a Graphic primitive wrapper. In MXML it would look like this: 1 2 3 4 [...]]]></description> <content:encoded><![CDATA[<p>You may have noticed MouseEvent.Click is not an event available to be set on the BitmapImage Spark primitive(in the current Flex SDK). But, there is a simple workaround for this. All you have to do is place it inside of a Graphic primitive wrapper. In MXML it would look like this:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
</pre></td><td
class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>?<span style="color: #0066CC;">xml</span> <span style="color: #0066CC;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;</span>s:Application xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span>
			   xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span>
			   xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/mx&quot;</span><span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>fx:Script<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
			<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">Alert</span>;
&nbsp;
			protected <span style="color: #000000; font-weight: bold;">function</span> graphic1_clickHandler<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
			<span style="color: #66cc66;">&#123;</span>
				Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Nope!'</span>, <span style="color: #ff0000;">'Click Event'</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>fx:Script<span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>fx:Declarations<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;!</span>-- Place non-visual elements <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>.<span style="color: #006600;">g</span>., services, value objects<span style="color: #66cc66;">&#41;</span> here --<span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>fx:Declarations<span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>s:HGroup id=<span style="color: #ff0000;">&quot;container&quot;</span><span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>s:Graphic click=<span style="color: #ff0000;">&quot;graphic1_clickHandler(event)&quot;</span><span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>s:BitmapImage source=<span style="color: #ff0000;">&quot;path/to/image.jpg&quot;</span>
						   smooth=<span style="color: #ff0000;">&quot;true&quot;</span>
						   smoothingQuality=<span style="color: #ff0000;">&quot;high&quot;</span> <span style="color: #66cc66;">/&gt;</span>
		<span style="color: #66cc66;">&lt;/</span>s:Graphic<span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>s:HGroup<span style="color: #66cc66;">&gt;</span>
&nbsp;
<span style="color: #66cc66;">&lt;/</span>s:Application<span style="color: #66cc66;">&gt;</span></pre></td></tr></table></div><p><a
href="http://www.dandev.com/samples/BitmapImage%20Click%20Event.fxp">Flex Builder Project</a></p><p>In AS3 it looks like this:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
</pre></td><td
class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>?<span style="color: #0066CC;">xml</span> <span style="color: #0066CC;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;</span>s:Application xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span>
			   xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span>
			   xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/mx&quot;</span>
			   creationComplete=<span style="color: #ff0000;">&quot;application1_creationCompleteHandler(event)&quot;</span><span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>fx:Script<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
			<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">Alert</span>;
			<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">events</span>.<span style="color: #006600;">FlexEvent</span>;
&nbsp;
			<span style="color: #0066CC;">import</span> spark.<span style="color: #006600;">primitives</span>.<span style="color: #006600;">BitmapImage</span>;
			<span style="color: #0066CC;">import</span> spark.<span style="color: #006600;">primitives</span>.<span style="color: #006600;">Graphic</span>;
&nbsp;
			protected <span style="color: #000000; font-weight: bold;">function</span> application1_creationCompleteHandler<span style="color: #66cc66;">&#40;</span>event:FlexEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">var</span> myBI:BitmapImage = <span style="color: #000000; font-weight: bold;">new</span> BitmapImage<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				myBI.<span style="color: #006600;">source</span> = <span style="color: #ff0000;">'path/to/image.jpg'</span>;
				myBI.<span style="color: #006600;">smooth</span> = <span style="color: #000000; font-weight: bold;">true</span>;
				myBI.<span style="color: #006600;">smoothingQuality</span> = <span style="color: #ff0000;">'high'</span>;
&nbsp;
				<span style="color: #000000; font-weight: bold;">var</span> myG:Graphic = <span style="color: #000000; font-weight: bold;">new</span> Graphic<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				myG.<span style="color: #006600;">addElement</span><span style="color: #66cc66;">&#40;</span>myBI<span style="color: #66cc66;">&#41;</span>;
				myG.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, graphic1_clickHandler<span style="color: #66cc66;">&#41;</span>;
&nbsp;
				container.<span style="color: #006600;">addElement</span><span style="color: #66cc66;">&#40;</span>myG<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
&nbsp;
			protected <span style="color: #000000; font-weight: bold;">function</span> graphic1_clickHandler<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
			<span style="color: #66cc66;">&#123;</span>
				Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Nope!'</span>, <span style="color: #ff0000;">'Click Event'</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>fx:Script<span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>fx:Declarations<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;!</span>-- Place non-visual elements <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>.<span style="color: #006600;">g</span>., services, value objects<span style="color: #66cc66;">&#41;</span> here --<span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>fx:Declarations<span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>s:HGroup id=<span style="color: #ff0000;">&quot;container&quot;</span><span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>s:HGroup<span style="color: #66cc66;">&gt;</span>
&nbsp;
<span style="color: #66cc66;">&lt;/</span>s:Application<span style="color: #66cc66;">&gt;</span></pre></td></tr></table></div><p><a
href="http://www.dandev.com/samples/BitmapImage%20Click%20Event%20AS.fxp">Flex Builder Project</a></p> ]]></content:encoded> <wfw:commentRss>http://www.dandev.com/software/add-a-click-event-to-a-bitmapimage-in-adobe-flexair/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Flex HDividedBox/VDividedBox divider double-click event oddity</title><link>http://www.dandev.com/software/hdividedbox/</link> <comments>http://www.dandev.com/software/hdividedbox/#comments</comments> <pubDate>Wed, 02 Dec 2009 02:30:05 +0000</pubDate> <dc:creator>Daniel</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[Flex]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Click]]></category> <category><![CDATA[DividedBox]]></category> <category><![CDATA[Divider]]></category> <category><![CDATA[Double-click]]></category> <category><![CDATA[DOUBLE_CLICK]]></category> <category><![CDATA[Event]]></category> <category><![CDATA[HDividedBox]]></category> <category><![CDATA[MouseEvent]]></category> <category><![CDATA[VDividedBox]]></category> <guid
isPermaLink="false">http://www.dandev.com/?p=171</guid> <description><![CDATA[I ran across an interesting case today while looking into an issue for someone else related to capturing the double-click event on the divider for a HDividedBox. It&#8217;s a little tricky to get the event to be captured by Flex. A quick search of the interwebs turned up nothing but people with the same issue. [...]]]></description> <content:encoded><![CDATA[<p>I ran across an interesting case today while looking into an issue for someone else related to capturing the double-click event on the divider for a HDividedBox. It&#8217;s a little tricky to get the event to be captured by Flex. A quick search of the interwebs turned up nothing but people with the same issue. There is even an <a
href="http://bugs.adobe.com/jira/browse/SDK-13">open bug in the Adobe Flex bug tracker</a>(you have to login) that seems to be the exact issue, but there is no resolution named. Through some quick experimentation I figured out you can get it to work like so:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
</pre></td><td
class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>?<span style="color: #0066CC;">xml</span> <span style="color: #0066CC;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;</span>mx:Application xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span>
    layout=<span style="color: #ff0000;">&quot;absolute&quot;</span>
    <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;600&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;588&quot;</span>
    applicationComplete=<span style="color: #ff0000;">&quot;start()&quot;</span><span style="color: #66cc66;">&gt;</span>
    <span style="color: #66cc66;">&lt;</span>mx:HDividedBox id=<span style="color: #ff0000;">&quot;divBox&quot;</span>
    	<span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;99%&quot;</span>
    	liveDragging=<span style="color: #ff0000;">&quot;true&quot;</span>
    	doubleClickEnabled=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">&gt;</span>
          <span style="color: #66cc66;">&lt;</span>mx:Canvas <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;50%&quot;</span><span style="color: #66cc66;">&gt;</span>
          		<span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Text</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Some example text&quot;</span> <span style="color: #66cc66;">/&gt;</span>
          <span style="color: #66cc66;">&lt;/</span>mx:Canvas<span style="color: #66cc66;">&gt;</span>
          <span style="color: #66cc66;">&lt;</span>mx:Canvas <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;50%&quot;</span><span style="color: #66cc66;">&gt;</span>
          		<span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Text</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Some example text&quot;</span> <span style="color: #66cc66;">/&gt;</span>
	      <span style="color: #66cc66;">&lt;/</span>mx:Canvas<span style="color: #66cc66;">&gt;</span>
     <span style="color: #66cc66;">&lt;/</span>mx:HDividedBox<span style="color: #66cc66;">&gt;</span>
     <span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span>
          <span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
               <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
                    divBox.<span style="color: #006600;">getDividerAt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">DOUBLE_CLICK</span>, handleDoubleClick<span style="color: #66cc66;">&#41;</span>;
               <span style="color: #66cc66;">&#125;</span>
&nbsp;
               <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleDoubleClick<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
                    Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Event captured!'</span><span style="color: #66cc66;">&#41;</span>;
               <span style="color: #66cc66;">&#125;</span>
          <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
     <span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;/</span>mx:Application<span style="color: #66cc66;">&gt;</span></pre></td></tr></table></div><p>The specific resolution was to enable liveDragging and add the event to the divider itself(most people try to set it on the doubleClick property of the DividerBox).</p><p>Hopefully this post will be helpful to some people out there with the same issue!</p> ]]></content:encoded> <wfw:commentRss>http://www.dandev.com/software/hdividedbox/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> </channel> </rss>
