<?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>FLEX{er} &#187; CSS</title>
	<atom:link href="http://www.flexer.info/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.flexer.info</link>
	<description>flex developers web corner</description>
	<lastBuildDate>Mon, 26 Jul 2010 17:54:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<image>
  <link>http://www.flexer.info</link>
  <url>http://www.flexer.info/favicon.ico</url>
  <title>FLEX{er}</title>
</image>
		<item>
		<title>ImageRail &#8211; Adding Click Event, Styles And HandCursor</title>
		<link>http://www.flexer.info/2008/06/05/imagerail-adding-click-event-styles-and-handcursor/</link>
		<comments>http://www.flexer.info/2008/06/05/imagerail-adding-click-event-styles-and-handcursor/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 13:57:31 +0000</pubDate>
		<dc:creator>Andrei Ionescu</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Components]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[MXML]]></category>
		<category><![CDATA[component]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[imagerail]]></category>
		<category><![CDATA[styles]]></category>

		<guid isPermaLink="false">http://www.flexer.info/?p=197</guid>
		<description><![CDATA[Some time ago, in a previous article I presented you ImageRail component that displays some thumbnails with possibility to scroll to left or right. Now we will add some new features that were missing.

Click Event &#8211; imageClick
Styles &#8211; imageBackgroundAlpha
HandCursor

Click event will be triggered when there is a click on an image, more precisely, on the [...]]]></description>
			<content:encoded><![CDATA[<div class='series_toc'><h3>Table of contents<!-- for ImageRail --></h3><ol><li><a href='http://www.flexer.info/2008/05/29/image-gallery-component-imagerail/' title='Image Gallery Component &#8211; ImageRail'>Image Gallery Component &#8211; ImageRail</a></li><li>ImageRail &#8211; Adding Click Event, Styles And HandCursor</li></ol></div> <div class="tweetmeme_button" style="float: right; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.flexer.info%2F2008%2F06%2F05%2Fimagerail-adding-click-event-styles-and-handcursor%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.flexer.info%2F2008%2F06%2F05%2Fimagerail-adding-click-event-styles-and-handcursor%2F" height="61" width="51" /></a></div><div style="float: right; margin-right: 10px"><a class="google_buzz"  
href="http://www.google.com/reader/link?url=http://www.flexer.info/2008/06/05/imagerail-adding-click-event-styles-and-handcursor/&title=ImageRail+&#8211;+Adding+Click+Event,+Styles+And+HandCursor&srcURL=http://www.flexer.info" target="_blank" rel="nofollow"><img
src="http://www.flexer.info/wp-content/plugins/google-buzz-button-for-wordpress/images/google-buzz.png" alt="Google Buzz" /></a></div><p>Some time ago, in a <a href="http://www.flexer.info/2008/05/29/image-gallery-component-imagerail/">previous article</a> I presented you <a href="http://www.flexer.info/2008/05/29/image-gallery-component-imagerail/">ImageRail</a> component that displays some thumbnails with possibility to scroll to left or right. Now we will add some new features that were missing.</p>
<ol>
<li>Click Event &#8211; <strong>imageClick</strong></li>
<li>Styles &#8211; <strong>imageBackgroundAlpha</strong></li>
<li>HandCursor</li>
</ol>
<p>Click event will be triggered when there is a click on an image, more precisely, on the canvas that holds an image, and will be used by an MXML attribute called <strong>imageClick</strong>.</p>
<p>Same with styles: we want to be able to set the background alpha of the each canvas that hold images by setting an MXML attribute named <strong>imageBackgroundAlpha</strong>.</p>
<p>To accomplish both we will use metadata tags like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>51
52
53
54
55
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>mx:Metadata<span style="color: #66cc66;">&gt;</span>
    <span style="color: #66cc66;">&#91;</span>Style<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;imageBackgroundAlpha&quot;</span>,<span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;Number&quot;</span>,format=<span style="color: #ff0000;">&quot;Number&quot;</span>,inherit=<span style="color: #ff0000;">&quot;no&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
&nbsp;
    <span style="color: #66cc66;">&#91;</span>Event<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;imageClick&quot;</span>, <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;com.flexer.ImageRailEvent&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
<span style="color: #66cc66;">&lt;/</span>mx:Metadata<span style="color: #66cc66;">&gt;</span></pre></td></tr></table></div>

<h3>1. Click Event &#8211; imageClick</h3>
<p>For Style metadata tag see <a href="http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&#038;file=metadata_141_14.html" target="_blank">Style metadata Adobe&#8217;s documentation</a> and for Event metadata tag see <a href="http://www.flexer.info/2008/05/30/how-to-add-an-event-to-a-custom-mxml-component-using-event-meta-tag/">How To Add an Event To a Custom MXML Component using Event Meta Tag</a> article I wrote before.</p>
<p>The whole source of the ImageRail component won&#8217;t fit in this article and because of that I&#8217;ll put only new and important lines in the text &#8211; all source code will be available for download at the end.</p>
<p>First we added metadata tags like above. Now methods&#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>570
571
572
573
574
575
576
577
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// handle one image click</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleImageClick<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>
    <span style="color: #808080; font-style: italic;">// dispatch image shelf custom event</span>
    dispatchEvent<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ImageRailEvent<span style="color: #66cc66;">&#40;</span>
        ImageRailEvent.<span style="color: #006600;">CLICK</span>, 
        _images<span style="color: #66cc66;">&#91;</span>uint<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>.<span style="color: #006600;">currentTarget</span>.<span style="color: #006600;">id</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>For this method to dispatch the event as we want we need the <strong>ImageRailEvent</strong> class and some minor modifications in <strong>ImageRail</strong> component.</p>
<p><strong>Minor modifications</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>326
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">cnv.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, handleImageClick<span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>315
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">cnv.<span style="color: #006600;">id</span> = i.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>This is important to be able to send further the occurred click event with the image object on which it was clicked. We get it with: <strong>_images[uint(e.currentTarget.id)]</strong></p>
<p><strong>ImageRailEvent</strong></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
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">package com.<span style="color: #006600;">flexer</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;
    <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">Image</span>;
&nbsp;
    <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ImageRailEvent <span style="color: #0066CC;">extends</span> Event
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #808080; font-style: italic;">// constant</span>
        <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const CLICK:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;imageClick&quot;</span>;
        <span style="color: #808080; font-style: italic;">// params</span>
        <span style="color: #808080; font-style: italic;">// we will save the image it was clicked on</span>
        <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _image:Image;
&nbsp;
        <span style="color: #808080; font-style: italic;">// constructor</span>
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> ImageRailEvent<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">type</span>:<span style="color: #0066CC;">String</span>, image:Image = <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#123;</span>
            <span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">type</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #808080; font-style: italic;">// Store Image params</span>
            _image = image;
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">// clone</span>
        override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> clone<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:Event
        <span style="color: #66cc66;">&#123;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> ImageRailEvent<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">type</span>, _image<span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">// image getter</span>
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> image<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:Image
        <span style="color: #66cc66;">&#123;</span>
            <span style="color: #b1b100;">return</span> _image;
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>This event class contains also the image which was clicked on.</p>
<h3>2. Styles &#8211; imageBackgroundAlpha</h3>
<p>For styles we need more methods to be implemented:</p>
<ul class="ul">
<li><strong>constructStyle</strong> &#8211; used to check for any previous defined style and if not we set the default values for some properties</li>
<li><strong>styleChanged</strong> &#8211; triggered when style is changed</li>
<li><strong>updateDisplayList</strong> &#8211; updating all canvases</li>
</ul>
<p>and some variables are needed:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>107
108
109
110
111
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// static variable for styling</span>
<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> _classConstructed:<span style="color: #0066CC;">Boolean</span> = constructStyle<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _imageBackgroundChanged:<span style="color: #0066CC;">Boolean</span> = <span style="color: #000000; font-weight: bold;">true</span>;
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _imageBackgroundAlpha:<span style="color: #0066CC;">Number</span>;</pre></td></tr></table></div>

<p>The process is like this:</p>
<ol>
<li><strong>constructStyle</strong> if a previous style is defined</li>
<li><strong>styleChanged</strong> is triggered because of <strong>StyleManager.setStyleDeclaration(&#8220;ImageRail&#8221;,style,true)</strong></li>
<li><strong>invalidateDisplayList()</strong> is called in styleChanges</li>
<li><strong>updateDisplayList</strong> is triggered because of <strong>invalidateDisplayList()</strong> and will set alpha to all canvases</li>
</ol>
<p>The code for these three methods&#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// styling</span>
<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> constructStyle<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Boolean</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #808080; font-style: italic;">// get style defined for ImageRail</span>
    <span style="color: #000000; font-weight: bold;">var</span> style:CSSStyleDeclaration = 
        StyleManager.<span style="color: #006600;">getStyleDeclaration</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;ImageRail&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// check to see if there's already an existing </span>
    <span style="color: #808080; font-style: italic;">// style declaration for this class</span>
    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>style<span style="color: #66cc66;">&#41;</span> 
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #808080; font-style: italic;">// its possible for a style to exist without </span>
        <span style="color: #808080; font-style: italic;">// defining all of the possible styles </span>
        <span style="color: #808080; font-style: italic;">// in which case we need to check each style</span>
        <span style="color: #808080; font-style: italic;">// explicitly and set a default if needed</span>
        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>style.<span style="color: #0066CC;">getStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;imageBackgroundAlpha&quot;</span><span style="color: #66cc66;">&#41;</span> == 
            <span style="color: #0066CC;">undefined</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#123;</span>
            style.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;imageBackgroundAlpha&quot;</span>,<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #808080; font-style: italic;">// create a default style declaration</span>
    <span style="color: #66cc66;">&#123;</span>
        style = <span style="color: #000000; font-weight: bold;">new</span> CSSStyleDeclaration<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
        style.<span style="color: #006600;">defaultFactory</span> = <span style="color: #000000; font-weight: bold;">function</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>
            <span style="color: #0066CC;">this</span>.<span style="color: #006600;">imageBackgroundAlpha</span> = <span style="color: #cc66cc;">0</span>;
        <span style="color: #66cc66;">&#125;</span>
        <span style="color: #808080; font-style: italic;">// set default style</span>
        <span style="color: #808080; font-style: italic;">// this will trigger styleChanged</span>
        StyleManager.<span style="color: #006600;">setStyleDeclaration</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;ImageRail&quot;</span>,style,<span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">true</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// override for styling</span>
<span style="color: #808080; font-style: italic;">// triggered when style is changed</span>
override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> styleChanged<span style="color: #66cc66;">&#40;</span>styleProp:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
<span style="color: #66cc66;">&#123;</span>
&nbsp;
    <span style="color: #0066CC;">super</span>.<span style="color: #006600;">styleChanged</span><span style="color: #66cc66;">&#40;</span>styleProp<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #808080; font-style: italic;">// Check to see if style changed. </span>
    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>styleProp == <span style="color: #ff0000;">&quot;imageBackgroundAlpha&quot;</span><span style="color: #66cc66;">&#41;</span> 
    <span style="color: #66cc66;">&#123;</span>
        _imageBackgroundChanged = <span style="color: #000000; font-weight: bold;">true</span>; 
        <span style="color: #808080; font-style: italic;">// invalidating to trigger updateDisplayList</span>
        invalidateDisplayList<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #b1b100;">return</span>;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// updating canvases with the new style</span>
override protected <span style="color: #000000; font-weight: bold;">function</span> updateDisplayList<span style="color: #66cc66;">&#40;</span>
    unscaledWidth:<span style="color: #0066CC;">Number</span>,unscaledHeight:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
<span style="color: #66cc66;">&#123;</span>
&nbsp;
    <span style="color: #0066CC;">super</span>.<span style="color: #006600;">updateDisplayList</span><span style="color: #66cc66;">&#40;</span>unscaledWidth,unscaledHeight<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #808080; font-style: italic;">// Check to see if style changed. </span>
    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>_imageBackgroundChanged == <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span> 
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #808080; font-style: italic;">// get image background alpha</span>
        _imageBackgroundAlpha = <span style="color: #0066CC;">getStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;imageBackgroundAlpha&quot;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #808080; font-style: italic;">// set the alpha to all canvases</span>
        <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:uint = <span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> _canvases.<span style="color: #0066CC;">length</span>; i++<span style="color: #66cc66;">&#41;</span> 
        <span style="color: #66cc66;">&#123;</span>
            <span style="color: #66cc66;">&#40;</span>_canvases<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> as Canvas<span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span>
                <span style="color: #ff0000;">&quot;backgroundAlpha&quot;</span>,_imageBackgroundAlpha<span style="color: #66cc66;">&#41;</span>;
&nbsp;
        <span style="color: #66cc66;">&#125;</span>
        _imageBackgroundChanged = <span style="color: #000000; font-weight: bold;">false</span>;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<h3>3. HandCursor</h3>
<p>Just three lines for this, placed in <strong>updateCanvases</strong>, and you can also check this <a href="http://www.flexer.info/2008/02/15/hand-cursor-on-a-label/">article about hand cursor on a label</a>.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>323
324
325
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">cnv.<span style="color: #0066CC;">useHandCursor</span> = <span style="color: #000000; font-weight: bold;">true</span>;
cnv.<span style="color: #006600;">mouseChildren</span> = <span style="color: #000000; font-weight: bold;">false</span>;
cnv.<span style="color: #006600;">buttonMode</span> = <span style="color: #000000; font-weight: bold;">true</span>;</pre></td></tr></table></div>

<p>Now an improved example bellow &#8211; and now you can dynamically change the background alpha and can click on an image which will display an alert with image&#8217;s path.<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_imagerailapp_eventstylehandcursor_1724018583"
			class="flashmovie"
			width="600"
			height="300">
	<param name="movie" value="/wp-content/uploads/2008/06/imagerailapp_eventstylehandcursor.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/wp-content/uploads/2008/06/imagerailapp_eventstylehandcursor.swf"
			name="fm_imagerailapp_eventstylehandcursor_1724018583"
			width="600"
			height="300">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
In the same way we can add other event (mouseover, mouseout, etc) and style properties (roundCorner, backgroundColor, etc) but for now this is it&#8230;.</p>
 <div class='series_links'><a href='http://www.flexer.info/2008/05/29/image-gallery-component-imagerail/' title='Image Gallery Component &#8211; ImageRail'>Previous in series</a> </div>]]></content:encoded>
			<wfw:commentRss>http://www.flexer.info/2008/06/05/imagerail-adding-click-event-styles-and-handcursor/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>HTML Tags And Attributes Supported by Flash Player</title>
		<link>http://www.flexer.info/2008/05/08/html-tags-and-attributes-supported-by-flash-player/</link>
		<comments>http://www.flexer.info/2008/05/08/html-tags-and-attributes-supported-by-flash-player/#comments</comments>
		<pubDate>Thu, 08 May 2008 14:23:21 +0000</pubDate>
		<dc:creator>Andrei Ionescu</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[Flex 2]]></category>
		<category><![CDATA[Flex Builder 3]]></category>
		<category><![CDATA[Flex resources]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[html enabled]]></category>
		<category><![CDATA[htmltext]]></category>
		<category><![CDATA[Rich Text Editor]]></category>
		<category><![CDATA[RichTextEditor]]></category>
		<category><![CDATA[tags]]></category>

		<guid isPermaLink="false">http://www.flexer.info/?p=167</guid>
		<description><![CDATA[Bellow you can find a list tags and their attributes that are supported by flash player (and also by flex framework). This list applies to TextArea, TextFields and other controls that are html enabled.
Anchor tag (&#60;a&#62;)
Creates a hypertext link.

href
target

Bold tag (&#60;b&#62;)
Renders text as bold.
Break tag (&#60;br&#62;)
Creates a line break in the text field.
Font tag (&#60;font&#62;)
Specifies [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.flexer.info%2F2008%2F05%2F08%2Fhtml-tags-and-attributes-supported-by-flash-player%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.flexer.info%2F2008%2F05%2F08%2Fhtml-tags-and-attributes-supported-by-flash-player%2F" height="61" width="51" /></a></div><div style="float: right; margin-right: 10px"><a class="google_buzz"  
href="http://www.google.com/reader/link?url=http://www.flexer.info/2008/05/08/html-tags-and-attributes-supported-by-flash-player/&title=HTML+Tags+And+Attributes+Supported+by+Flash+Player&srcURL=http://www.flexer.info" target="_blank" rel="nofollow"><img
src="http://www.flexer.info/wp-content/plugins/google-buzz-button-for-wordpress/images/google-buzz.png" alt="Google Buzz" /></a></div><p>Bellow you can find a list tags and their attributes that are supported by flash player (and also by flex framework). This list applies to <strong>TextArea</strong>, <strong>TextFields</strong> and other controls that are html enabled.</p>
<h4>Anchor tag (<span style="font-family:monospace">&lt;a&gt;</span>)</h4>
<p>Creates a hypertext link.</p>
<ul class="ul">
<li>href</li>
<li>target</li>
</ul>
<h4>Bold tag (<span style="font-family:monospace">&lt;b&gt;</span>)</h4>
<p>Renders text as bold.</p>
<h4>Break tag (<span style="font-family:monospace">&lt;br&gt;</span>)</h4>
<p>Creates a line break in the text field.</p>
<h4>Font tag (<span style="font-family:monospace">&lt;font&gt;</span>)</h4>
<p>Specifies a font or list of fonts to display the text.</p>
<ul class="ul">
<li>color</li>
<li>face</li>
<li>size</li>
</ul>
<h4>Image tag (<span style="font-family:monospace">&lt;img&gt;</span>)</h4>
<p>Lets you embed external JPEG files, SWF files, and movie clips.</p>
<ul class="ul">
<li>src</li>
<li>id</li>
<li>width</li>
<li>height</li>
<li>align</li>
<li>hspace</li>
<li>vspace</li>
<li>alt</li>
</ul>
<h4>Italic tag (<span style="font-family:monospace">&lt;i&gt;</span>)</h4>
<p>Displays the tagged text in italics.</p>
<h4>List item tag (<span style="font-family:monospace">&lt;li&gt;</span>)</h4>
<p>Places a bullet in front of the text that it encloses.</p>
<h4>Paragraph tag (<span style="font-family:monospace">&lt;p&gt;</span>)</h4>
<p>Creates a new paragraph.</p>
<ul class="ul">
<li>align</li>
<li>class</li>
</ul>
<h4>Span tag (<span style="font-family:monospace">&lt;span&gt;</span>)</h4>
<p>Available only for use with CSS text styles.</p>
<ul class="ul">
<li>class</li>
</ul>
<h4>Text format tag (<span style="font-family:monospace">&lt;textformat&gt;</span>)</h4>
<p>Lets you use a subset of paragraph formatting properties of the TextFormat class within HTML text fields.</p>
<ul class="ul">
<li>blockindent </li>
<li>indent</li>
<li>leading </li>
<li>leftmargin </li>
<li>rightmargin</li>
<li>tabstops </li>
</ul>
<h4>Underline tag (<span style="font-family:monospace">&lt;u&gt;</span>)</h4>
<p>Underlines the tagged text.</p>
<p>Some aspects need to be known&#8230; <strong>&lt;ol&gt;</strong> and <strong>&lt;ul&gt;</strong> are not supported by flash player and any of the two tags are rendered as bullets. As you already noticed the tags do no comply with new standards, they do not necessarily close as is should and tags without closing do not have <strong>/&gt;</strong> at the end.</p>
<p>More info about this is on Adobe Livedocs following this <a href="http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&#038;file=00001040.html" target="_blank">link</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexer.info/2008/05/08/html-tags-and-attributes-supported-by-flash-player/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>How To Remove the &#8220;Black Line&#8221; from a Tree Control (Drag and Drop Enabled)</title>
		<link>http://www.flexer.info/2008/02/08/how-to-remove-the-black-line-from-a-tree-control-drag-and-drop-enabled/</link>
		<comments>http://www.flexer.info/2008/02/08/how-to-remove-the-black-line-from-a-tree-control-drag-and-drop-enabled/#comments</comments>
		<pubDate>Fri, 08 Feb 2008 15:51:02 +0000</pubDate>
		<dc:creator>Andrei Ionescu</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Flex 2]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[Skin]]></category>
		<category><![CDATA[re-skin]]></category>
		<category><![CDATA[styles]]></category>

		<guid isPermaLink="false">http://www.flexer.info/2008/02/08/how-to-remove-the-black-line-from-a-tree-control-drag-and-drop-enabled/</guid>
		<description><![CDATA[Today I found a way to remove the &#8220;black line&#8221; of a tree which has drag and drop functionality enabled. I did that by skinning. Searching through the help I&#8217;ve been crossing over a property named &#8220;dropIndicatorSkin&#8221; where (as its name is suggesting) the drop line is drawn. So I just re-skinned it.
Here is the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.flexer.info%2F2008%2F02%2F08%2Fhow-to-remove-the-black-line-from-a-tree-control-drag-and-drop-enabled%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.flexer.info%2F2008%2F02%2F08%2Fhow-to-remove-the-black-line-from-a-tree-control-drag-and-drop-enabled%2F" height="61" width="51" /></a></div><div style="float: right; margin-right: 10px"><a class="google_buzz"  
href="http://www.google.com/reader/link?url=http://www.flexer.info/2008/02/08/how-to-remove-the-black-line-from-a-tree-control-drag-and-drop-enabled/&title=How+To+Remove+the+&#8220;Black+Line&#8221;+from+a+Tree+Control+(Drag+and+Drop+Enabled)&srcURL=http://www.flexer.info" target="_blank" rel="nofollow"><img
src="http://www.flexer.info/wp-content/plugins/google-buzz-button-for-wordpress/images/google-buzz.png" alt="Google Buzz" /></a></div><p>Today I found a way to remove the &#8220;<em>black line</em>&#8221; of a tree which has drag and drop functionality enabled. I did that by skinning. Searching through the help I&#8217;ve been crossing over a property named &#8220;<strong>dropIndicatorSkin</strong>&#8221; where (as its name is suggesting) the drop line is drawn. So I just re-skinned it.</p>
<p>Here is the Tree class (from the application&#8217;s style sheet):</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">Tree <span style="color: #66cc66;">&#123;</span>
    fontWeight: normal;
    fontSize: 11pt;
    border-style: solid;
    <span style="color: #0066CC;">color</span>: <span style="color: #808080; font-style: italic;">#555555;</span>
&nbsp;
    <span style="color: #0066CC;">backgroundColor</span>: <span style="color: #808080; font-style: italic;">#fcfcfc;</span>
&nbsp;
    dropIndicatorSkin: ClassReference<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;path.to.your.custom.skin.ListDropIndicator&quot;</span><span style="color: #66cc66;">&#41;</span>;	
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Please notice the</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">dropIndicatorSkin: ClassReference<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;path.to.your.custom.skin.ListDropIndicator&quot;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p> property and how a custom skin is set. </p>
<p>Bellow is our new skin class:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package path.<span style="color: #006600;">to</span>.<span style="color: #006600;">your</span>.<span style="color: #006600;">custom</span>.<span style="color: #006600;">skin</span>
<span style="color: #66cc66;">&#123;</span>
&nbsp;
    <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Graphics</span>;
    <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">skins</span>.<span style="color: #006600;">ProgrammaticSkin</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">/**
     *  The skin for the drop indicator of a list-based control.
     */</span>
    <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ListDropIndicator <span style="color: #0066CC;">extends</span> ProgrammaticSkin
    <span style="color: #66cc66;">&#123;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">//--------------------------------------------------------------------------</span>
        <span style="color: #808080; font-style: italic;">//</span>
        <span style="color: #808080; font-style: italic;">//  Constructor</span>
        <span style="color: #808080; font-style: italic;">//</span>
        <span style="color: #808080; font-style: italic;">//--------------------------------------------------------------------------</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">/**
	 *  Constructor.
	 */</span>
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> ListDropIndicator<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#123;</span>
            <span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">//--------------------------------------------------------------------------</span>
        <span style="color: #808080; font-style: italic;">//</span>
        <span style="color: #808080; font-style: italic;">//  Overridden methods</span>
        <span style="color: #808080; font-style: italic;">//</span>
        <span style="color: #808080; font-style: italic;">//--------------------------------------------------------------------------</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">/**
         *  @private
         */</span>
        override protected <span style="color: #000000; font-weight: bold;">function</span> updateDisplayList<span style="color: #66cc66;">&#40;</span>w:<span style="color: #0066CC;">Number</span>, h:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
        <span style="color: #66cc66;">&#123;</span>	
            <span style="color: #0066CC;">super</span>.<span style="color: #006600;">updateDisplayList</span><span style="color: #66cc66;">&#40;</span>w, h<span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #000000; font-weight: bold;">var</span> g:Graphics = graphics;
&nbsp;
            g.<span style="color: #0066CC;">clear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            g.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0xa1bde2, <span style="color: #cc66cc;">0.5</span><span style="color: #66cc66;">&#41;</span>;
            g.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span>-<span style="color: #cc66cc;">5</span>, -<span style="color: #cc66cc;">1</span>, w, <span style="color: #cc66cc;">23</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>I just copied the skin found at <strong>C:\Program Files\Adobe\Flex Builder 2\Flex SDK 2\frameworks\source\mx\skins\halo\ListDropIndicator.as</strong> to the above path specified at the package path, removed the &#8220;<em>black line</em>&#8221; and did draw a rectangle instead of that line.</p>
<p>This is it. Although at first sight it seems a difficult task it is not.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexer.info/2008/02/08/how-to-remove-the-black-line-from-a-tree-control-drag-and-drop-enabled/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Custom skin for tab bar navigator</title>
		<link>http://www.flexer.info/2008/02/08/custom-skin-for-tab-bar-navigator/</link>
		<comments>http://www.flexer.info/2008/02/08/custom-skin-for-tab-bar-navigator/#comments</comments>
		<pubDate>Fri, 08 Feb 2008 13:06:59 +0000</pubDate>
		<dc:creator>Stelian Crisan</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Flex 2]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[MXML]]></category>
		<category><![CDATA[Skin]]></category>
		<category><![CDATA[actions script]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[style]]></category>
		<category><![CDATA[tab bar navigation]]></category>

		<guid isPermaLink="false">http://www.flexer.info/2008/02/08/custom-skin-for-tab-bar-navigator/</guid>
		<description><![CDATA[This it&#8217;s an working example of how you can customize your tab bar navigation.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_customskinfortabbar_1748632697"
			class="flashmovie"
			width="270"
			height="180">
	<param name="movie" value="/wp-content/uploads/2008/02/customskinfortabbar.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/wp-content/uploads/2008/02/customskinfortabbar.swf"
			name="fm_customskinfortabbar_1748632697"
			width="270"
			height="180">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
So, we have a MXML file, style file and a skin script. Let&#8217;s see them all.In MXML file we just link style.css file and I have used a TabNavigator component with 3 tabs. Style.css files contains to css [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.flexer.info%2F2008%2F02%2F08%2Fcustom-skin-for-tab-bar-navigator%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.flexer.info%2F2008%2F02%2F08%2Fcustom-skin-for-tab-bar-navigator%2F" height="61" width="51" /></a></div><div style="float: right; margin-right: 10px"><a class="google_buzz"  
href="http://www.google.com/reader/link?url=http://www.flexer.info/2008/02/08/custom-skin-for-tab-bar-navigator/&title=Custom+skin+for+tab+bar+navigator&srcURL=http://www.flexer.info" target="_blank" rel="nofollow"><img
src="http://www.flexer.info/wp-content/plugins/google-buzz-button-for-wordpress/images/google-buzz.png" alt="Google Buzz" /></a></div><p>This it&#8217;s an working example of how you can customize your tab bar navigation.<br />
<center>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_customskinfortabbar_1047979087"
			class="flashmovie"
			width="270"
			height="180">
	<param name="movie" value="/wp-content/uploads/2008/02/customskinfortabbar.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/wp-content/uploads/2008/02/customskinfortabbar.swf"
			name="fm_customskinfortabbar_1047979087"
			width="270"
			height="180">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object></center><br />
So, we have a MXML file, style file and a skin script. Let&#8217;s see them all.In MXML file we just link style.css file and I have used a TabNavigator component with 3 tabs. Style.css files contains to css classes one for TabNavigator as a component and for a single tab.To change the skin of a flex component you have to take the actionscript file from Flex SDK folder, move it to your application and customize it. Don&#8217;t forget to link this file to you new css class.For example I create a new folder in my aplication assets/skin and I put there TabSkin.as file; in css class I refer to this file for al available states lik ethis:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">disabledSkin: ClassReference<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;assets.skins.TabSkin&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
downSkin: ClassReference<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;assets.skins.TabSkin&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
overSkin: ClassReference<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;assets.skins.TabSkin&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
selectedDisabledSkin: ClassReference<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;assets.skins.TabSkin&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
selectedDownSkin: ClassReference<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;assets.skins.TabSkin&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
selectedOverSkin: ClassReference<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;assets.skins.TabSkin&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
selectedUpSkin: ClassReference<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;assets.skins.TabSkin&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
upSkin: ClassReference<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;assets.skins.TabSkin&quot;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>I hope it&#8217;s a clear exemple, for more details, please, leave us a comment.</p>
<p>You can also download the source of this example from here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexer.info/2008/02/08/custom-skin-for-tab-bar-navigator/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
