<?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>AncaA&#039;s tech journal &#187; ActionScript 3.0</title>
	<atom:link href="http://ancaa.eu/fr/category/actionscript-3-0/feed/" rel="self" type="application/rss+xml" />
	<link>http://ancaa.eu</link>
	<description></description>
	<lastBuildDate>Tue, 13 Jul 2010 10:01:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>fr</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>(English) Flex Charts :Resizing Bar Chart Columns</title>
		<link>http://ancaa.eu/fr/actionscript-3-0/flex-charts-resizing-bar-chart-columns/</link>
		<comments>http://ancaa.eu/fr/actionscript-3-0/flex-charts-resizing-bar-chart-columns/#comments</comments>
		<pubDate>Mon, 24 Sep 2007 20:17:00 +0000</pubDate>
		<dc:creator>Anca Alimanescu</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://aanca.com/?p=9</guid>
		<description><![CDATA[Désolé, cet article est seulement disponible en English.
]]></description>
			<content:encoded><![CDATA[<p>Désolé, cet article est seulement disponible en <a href="http://ancaa.eu/category/actionscript-3-0/feed/">English</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ancaa.eu/fr/actionscript-3-0/flex-charts-resizing-bar-chart-columns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>(English) Drawing a dashed/dotted line</title>
		<link>http://ancaa.eu/fr/actionscript-3-0/drawing-a-dasheddotted-line/</link>
		<comments>http://ancaa.eu/fr/actionscript-3-0/drawing-a-dasheddotted-line/#comments</comments>
		<pubDate>Tue, 28 Aug 2007 16:14:00 +0000</pubDate>
		<dc:creator>Anca Alimanescu</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://aanca.com/?p=4</guid>
		<description><![CDATA[Drawing a dashed/dotted line

These days I needed in one of my applications to draw some dashed and dotted lines. After doing some research, I realized that there is no line style that would enable one to draw lines like this.
So I started implementing an algorithm that would draw a dashed/dotted line given two points. Drawing [...]]]></description>
			<content:encoded><![CDATA[<p>Drawing a dashed/dotted line<br />
<object width="372" height="282"><param value="DashedLine.swf" name="movie"/><embed width="372" src="http://anca.alimanescu.googlepages.com/DashedLine.swf" height="282"></embed></object><br />
These days I needed in one of my applications to draw some dashed and dotted lines. After doing some research, I realized that there is no line style that would enable one to draw lines like this.<br />
So I started implementing an algorithm that would draw a dashed/dotted line given two points. Drawing a dashed line is determined by setting the length of the dash and the length of the gap.</p>
<p>I decided drawing my dashed line by drawing smaller lines and adding gaps after each one of them.</p>
<p><code><br />
private function drawDashedLine (x1:Number, y1:Number, x2:Number,y2:Number,   dashLength:int, gapLength:int, color:uint):void<br />
{<br />
var lineLength:Number=0;<br />
//counts the current length of the dashed line<br />
startLength = 0;<br />
//the container where the dashed line will be added<br />
drawingCanvas = new UIComponent();<br />
//set up the line style of the dashed line<br />
drawingCanvas.graphics.lineStyle(3,color,1);<br />
//move mouse to starting point<br />
drawingCanvas.graphics.moveTo(x1,y1);</p>
<p>//start drawing dash<br />
lineLength = Math.sqrt((Math.pow((x1-x2),2)+Math.pow((y1-y2),2)));<br />
//while have the necessary space dashes and gaps can be drawn<br />
while ((lineLength-startLength)>=(dashLength+gapLength))<br />
{<br />
drawDash(x1,x2,y1,y2,lineLength,dashLength);<br />
drawGap(x1,x2,y1,y2,lineLength,gapLength);<br />
}</p>
<p>//if there is not enough space to draw another dash, just draw part        of the dash<br />
if ((lineLength-startLength)<=dashLength)<br />
{<br />
drawingCanvas.graphics.lineTo(x2,y2)<br />
}<br />
else<br />
{<br />
drawDash(x1,x2,y1,y2,lineLength,dashLength);<br />
}</p>
<p>try<br />
{<br />
cnvContainer.addChild(drawingCanvas);<br />
}<br />
catch (e:Error)<br />
{<br />
trace("child adding failed ")<br />
}</p>
<p>}<br />
</code><br />
The dash is drawn by determining the coordinates of the ending point of the dash.<br />
<code></p>
<p>//calculate the point where the dash ends and draw line<br />
private function drawDash(x1:Number,x2:Number,y1:Number,y2:Number,lineLength:Number, dashLength:Number):void<br />
{</p>
<p>var proportionDash:Number = 0;<br />
startLength = startLength + dashLength;<br />
//the percentage of the line(relative to the starting                 point)<br />
//at wich the end point of the dash will be found<br />
proportionDash = (startLength*100)/lineLength;</p>
<p>var retPoint:Point = getCoordinatesForProportion(x1,x2,y1,y2,proportionDash);<br />
drawingCanvas.graphics.lineTo(retPoint.x,retPoint.y);</p>
<p>}<br />
</code><br />
The gap is also implemented by moving the mouse cursor to the starting point of a new dash.<br />
<code><br />
//calculate the point where the gap ends and move mouse cursor<br />
private function drawGap(x1:Number,x2:Number,y1:Number,y2:Number,lineLength:Number, gapLength:Number):void<br />
{<br />
var proportionGap:Number = 0;<br />
startLength = startLength + gapLength;<br />
//the percentage of the line(relative to the starting point)<br />
//at wich the end point of the gap will be found<br />
proportionGap = (startLength*100)/lineLength;</p>
<p>var retPoint:Point = getCoordinatesForProportion(x1,x2,y1,y2,proportionGap);<br />
drawingCanvas.graphics.moveTo(retPoint.x,retPoint.y);</p>
<p>}<br />
</code></p>
<p>Next I use a function that will determine the coordinates of the point located at a certain distance (in percents) from the starting point of the line. This does mostly what the Point.interpolate method of the framework does.<br />
<code><br />
private function getCoordinatesForProportion(x1:Number,x2:Number,y1:Number,y2:Number,proportion:Number):Point<br />
{<br />
var newX:Number = 0;<br />
var newY:Number = 0;<br />
var retPoint:Point = new Point(0,0);</p>
<p>if (x1>=x2)<br />
newX = x1 - Math.abs(x1-x2)*proportion/100;<br />
else<br />
newX = x1 + Math.abs(x1-x2)*proportion/100;</p>
<p>if (y1>=y2)<br />
newY = y1 - Math.abs(y1-y2)*proportion/100;<br />
else<br />
newY = y1 + Math.abs(y1-y2)*proportion/100;</p>
<p>retPoint.x = newX;<br />
retPoint.y = newY;</p>
<p>return retPoint;<br />
}<br />
</code></p>
<p>You can download the source code <a href="http://anca.alimanescu.googlepages.com/DashedLine.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ancaa.eu/fr/actionscript-3-0/drawing-a-dasheddotted-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>(English) Customize the DataGrid drag proxy AS 3.0</title>
		<link>http://ancaa.eu/fr/actionscript-3-0/customize-the-datagrid-drag-proxy-as-3-0/</link>
		<comments>http://ancaa.eu/fr/actionscript-3-0/customize-the-datagrid-drag-proxy-as-3-0/#comments</comments>
		<pubDate>Mon, 20 Aug 2007 18:58:00 +0000</pubDate>
		<dc:creator>Anca Alimanescu</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://aanca.com/?p=3</guid>
		<description><![CDATA[Désolé, cet article est seulement disponible en English.
]]></description>
			<content:encoded><![CDATA[<p>Désolé, cet article est seulement disponible en <a href="http://ancaa.eu/category/actionscript-3-0/feed/">English</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ancaa.eu/fr/actionscript-3-0/customize-the-datagrid-drag-proxy-as-3-0/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
