<?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>Benoit Freslon&#039;s blog &#187; ActionScript</title>
	<atom:link href="http://www.benoitfreslon.com/tag/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.benoitfreslon.com</link>
	<description>Benoit Freslon&#039;s blog - Game Design, Flash games, ActionScript tutorials ...</description>
	<lastBuildDate>Wed, 01 Sep 2010 15:14:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>ActionScript: test collision between a circle and a line</title>
		<link>http://www.benoitfreslon.com/actionscript-test-collision-between-a-circle-and-a-line</link>
		<comments>http://www.benoitfreslon.com/actionscript-test-collision-between-a-circle-and-a-line#comments</comments>
		<pubDate>Thu, 19 Aug 2010 18:27:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Tip]]></category>
		<category><![CDATA[circle]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[collision]]></category>
		<category><![CDATA[line]]></category>
		<category><![CDATA[source]]></category>

		<guid isPermaLink="false">http://www.benoitfreslon.com/?p=1067</guid>
		<description><![CDATA[Preview:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_circle_line_collision_1723344456"
			class="flashmovie"
			width="500"
			height="400">
	<param name="movie" value="http://www.benoitfreslon.com/wp-content/uploads/2010/08/circle_line_collision.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.benoitfreslon.com/wp-content/uploads/2010/08/circle_line_collision.swf"
			name="fm_circle_line_collision_1723344456"
			width="500"
			height="400">
	<!--<![endif]-->
		   
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>


Download source code: circle_line_collision
Code:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172// Test collision between a circle and a line
// coded by Benoit Freslon
//
// www.benoitfreslon.com

// Copy and paste this function into your code and don't forget to import the Point class.

import flash.geom.Point;

// pP1: (Point) the first point of the line
// pP2: (Point) the second [...]]]></description>
			<content:encoded><![CDATA[<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.benoitfreslon.com%2Factionscript-test-collision-between-a-circle-and-a-line&amp;layout=button_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:80px;height:30px;margin-top:5px;text-align:right;"></iframe><p><strong>Preview:</strong><br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_circle_line_collision_971727383"
			class="flashmovie"
			width="500"
			height="400">
	<param name="movie" value="http://www.benoitfreslon.com/wp-content/uploads/2010/08/circle_line_collision.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.benoitfreslon.com/wp-content/uploads/2010/08/circle_line_collision.swf"
			name="fm_circle_line_collision_971727383"
			width="500"
			height="400">
	<!--<![endif]-->
		  <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> 
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
<strong><br />
</strong></p>
<p><strong>Download source code: </strong><strong><a href="http://www.benoitfreslon.com/wp-content/uploads/2010/08/circle_line_collision.zip">circle_line_collision</a></strong></p>
<p><strong>Code:</strong></p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:300px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900; font-style: italic;">// Test collision between a circle and a line</span><br />
<span style="color: #009900; font-style: italic;">// coded by Benoit Freslon</span><br />
<span style="color: #009900; font-style: italic;">//</span><br />
<span style="color: #009900; font-style: italic;">// www.benoitfreslon.com</span><br />
<br />
<span style="color: #009900; font-style: italic;">// Copy and paste this function into your code and don't forget to import the Point class.</span><br />
<br />
<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Point</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">// pP1: (Point) the first point of the line</span><br />
<span style="color: #009900; font-style: italic;">// pP2: (Point) the second point of the line</span><br />
<span style="color: #009900; font-style: italic;">// pC: (Point) the point of the circle</span><br />
<span style="color: #009900; font-style: italic;">// pRay: (Number) the ray of the circle</span><br />
<span style="color: #339966; font-weight: bold;">function</span> lineCircleCollision<span style="color: #000000;">&#40;</span>pP1<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Point</span><span style="color: #000066; font-weight: bold;">,</span>pP2<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Point</span><span style="color: #000066; font-weight: bold;">,</span>pC<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Point</span><span style="color: #000066; font-weight: bold;">,</span> pRay<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> x0<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = pC<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> y0<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = pC<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> x1<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = pP1<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> y1<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = pP1<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> x2<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = pP2<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> y2<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = pP2<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> n<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">abs</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>x2<span style="color: #000066; font-weight: bold;">-</span>x1<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000;">&#40;</span>y1<span style="color: #000066; font-weight: bold;">-</span>y0<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000;">&#40;</span>x1<span style="color: #000066; font-weight: bold;">-</span>x0<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000;">&#40;</span>y2<span style="color: #000066; font-weight: bold;">-</span>y1<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">d</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">sqrt</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>x2<span style="color: #000066; font-weight: bold;">-</span>x1<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000;">&#40;</span>x2<span style="color: #000066; font-weight: bold;">-</span>x1<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">+</span><span style="color: #000000;">&#40;</span>y2<span style="color: #000066; font-weight: bold;">-</span>y1<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000;">&#40;</span>y2<span style="color: #000066; font-weight: bold;">-</span>y1<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> dist<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = n<span style="color: #000066; font-weight: bold;">/</span><span style="color: #004993;">d</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>dist <span style="color: #000066; font-weight: bold;">&gt;</span> pRay<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span><span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> d1<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">sqrt</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>x0<span style="color: #000066; font-weight: bold;">-</span>x1<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000;">&#40;</span>x0<span style="color: #000066; font-weight: bold;">-</span>x1<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">+</span><span style="color: #000000;">&#40;</span>y0<span style="color: #000066; font-weight: bold;">-</span>y1<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000;">&#40;</span>y0<span style="color: #000066; font-weight: bold;">-</span>y1<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>d1<span style="color: #000066; font-weight: bold;">-</span>pRay<span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #004993;">d</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span><span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> d2<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">sqrt</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>x0<span style="color: #000066; font-weight: bold;">-</span>x2<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000;">&#40;</span>x0<span style="color: #000066; font-weight: bold;">-</span>x2<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">+</span><span style="color: #000000;">&#40;</span>y0<span style="color: #000066; font-weight: bold;">-</span>y2<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000;">&#40;</span>y0<span style="color: #000066; font-weight: bold;">-</span>y2<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>d2<span style="color: #000066; font-weight: bold;">-</span>pRay<span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #004993;">d</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span><span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span><br />
<br />
<span style="color: #009900; font-style: italic;">// Now test this function</span><br />
<br />
<span style="color: #009900; font-style: italic;">// 2 points for the line</span><br />
<span style="color: #6699cc; font-weight: bold;">var</span> pt1<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Point</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Point</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #000000; font-weight:bold;">50</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #6699cc; font-weight: bold;">var</span> pt2<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Point</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Point</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">300</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #000000; font-weight:bold;">400</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">// The ray of the circle 30px</span><br />
<span style="color: #6699cc; font-weight: bold;">var</span> ray<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">30</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">// Draw the line</span><br />
<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">lineStyle</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">moveTo</span><span style="color: #000000;">&#40;</span>pt1<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">,</span>pt1<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000000;">&#41;</span><br />
<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span>pt2<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">,</span>pt2<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">// Drag the circle</span><br />
circle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">startDrag</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">// And test the collision</span><br />
<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ENTER_FRAME</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">enterFrame</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #6699cc; font-weight: bold;">var</span> ptC<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Point</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Point</span><span style="color: #000000;">&#40;</span>circle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">,</span>circle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">enterFrame</span> <span style="color: #000000;">&#40;</span>pEvt<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Update circle coordinates</span><br />
&nbsp; &nbsp; ptC<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = circle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; ptC<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = circle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>lineCircleCollision<span style="color: #000000;">&#40;</span>pt1<span style="color: #000066; font-weight: bold;">,</span>pt2<span style="color: #000066; font-weight: bold;">,</span> ptC<span style="color: #000066; font-weight: bold;">,</span> ray<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Collision ok</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; circle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">alpha</span> = <span style="color: #000000; font-weight:bold;">0.5</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// No collision</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; circle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">alpha</span> = <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://www.benoitfreslon.com/actionscript-test-collision-between-a-circle-and-a-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash CS5 builds Iphone applications</title>
		<link>http://www.benoitfreslon.com/flash-cs5-builds-iphone-applications</link>
		<comments>http://www.benoitfreslon.com/flash-cs5-builds-iphone-applications#comments</comments>
		<pubDate>Tue, 06 Oct 2009 09:58:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://www.thisisgameplay.com/?p=523</guid>
		<description><![CDATA[Flash Professional CS5 will enable you to build applications for iPhone and iPod touch using ActionScript 3. These applications can be delivered to iPhone and iPod touch users through the Apple App Store.*
A public beta of Flash Professional CS5 with prerelease support for building applications for iPhone is planned for later this year. Sign up [...]]]></description>
			<content:encoded><![CDATA[<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.benoitfreslon.com%2Fflash-cs5-builds-iphone-applications&amp;layout=button_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:80px;height:30px;margin-top:5px;text-align:right;"></iframe><p>Flash Professional CS5 will enable you to build applications for iPhone and iPod touch using ActionScript 3. These applications can be delivered to iPhone and iPod touch users through the Apple App Store.*</p>
<p>A public beta of Flash Professional CS5 with prerelease support for building applications for iPhone is planned for later this year. <a href="http://www.adobe.com/go/flashprobetanotify">Sign up to be notified when the beta starts</a>.</p>
<p>At MAX 2009, Adobe showed a number of applications and games for iPhone that have been built using a prerelease version of Flash Professional CS5. These applications are available now for you to download from the Apple App Store.</p>
<p>Go to the official article on labs.adobe.com: <a href="http://labs.adobe.com/technologies/flashcs5/appsfor_iphone/#divider" target="_blank">http://labs.adobe.com/technologies/flashcs5/appsfor_iphone/#divider</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.benoitfreslon.com/flash-cs5-builds-iphone-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New game, new gameplay, Roll and Jump</title>
		<link>http://www.benoitfreslon.com/new-game-new-gameplay-roll-and-jump</link>
		<comments>http://www.benoitfreslon.com/new-game-new-gameplay-roll-and-jump#comments</comments>
		<pubDate>Thu, 03 Sep 2009 16:47:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Game Design]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[skill game]]></category>

		<guid isPermaLink="false">http://www.thisisgameplay.com/?p=450</guid>
		<description><![CDATA[My new game, Roll and Jump, was designed for iphone and touch phone. The game is easy to learn but hard to master.]]></description>
			<content:encoded><![CDATA[<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.benoitfreslon.com%2Fnew-game-new-gameplay-roll-and-jump&amp;layout=button_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:80px;height:30px;margin-top:5px;text-align:right;"></iframe><p><a href="./wp-content/uploads/2009/09/screenshot_02.jpg"><img class="size-full wp-image-455 alignright" title="roll_and_jump_screenshot" src="http://www.thisisgameplay.com/wp-content/uploads/2009/09/screenshot_02.jpg" alt="roll_and_jump_screenshot" width="116" height="174" /></a></p>
<p><img class="alignleft size-full wp-image-454" title="roll_n_jump_logo_mini_120_120" src="http://www.thisisgameplay.com/wp-content/uploads/2009/09/roll_n_jump_logo_mini_120_120.jpg" alt="roll_n_jump_logo_mini_120_120" width="94" height="94" />Roll and Jump is a skill game where the goal is to climb as high as possible by jumping from a rolling circle to another.</p>
<p>Clim and do the highest score as possible.<br />
You can do a wall jump, a double jump or activate slow motion!</p>
<p>The game will be released in few days on the web i hope to bring it on iphone as soon as possible.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.benoitfreslon.com/new-game-new-gameplay-roll-and-jump/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Win 80% performance on Flash ActionScript 2 project</title>
		<link>http://www.benoitfreslon.com/win-80-performance-on-flash-actionscript-2-project</link>
		<comments>http://www.benoitfreslon.com/win-80-performance-on-flash-actionscript-2-project#comments</comments>
		<pubDate>Wed, 18 Mar 2009 12:17:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[optimisation]]></category>

		<guid isPermaLink="false">http://www.thisisgameplay.com/?p=90</guid>
		<description><![CDATA[If you have lot of AS 2.0 projets like me you should be happy to know that you could win 80% performance on your projets with 4 lines of ActionScript. But this tip works only on web based projets.]]></description>
			<content:encoded><![CDATA[<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.benoitfreslon.com%2Fwin-80-performance-on-flash-actionscript-2-project&amp;layout=button_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:80px;height:30px;margin-top:5px;text-align:right;"></iframe><p>If you have lot of AS 2.0 projets like me you should be happy to know that you could win 80% performance on your projets with 4 lines of ActionScript<strong>.<br />
</strong></p>
<h3>First compile your AS 2.0 project with Flash.</h3>
<p>Export your swf file in AS 2.0. (eg: your_as2_project.swf)</p>
<h3>Then create <strong>an AS 3.0 loader</strong> with Flash CS3 or better.</h3>
<p>Keep the <strong>same framerate </strong>on your loader. The <strong>same dimentions</strong> and the <strong>same background color</strong>. Put those lines into your AS 3.0 loader and replace the swf file with your file name.</p>
<pre lang="ACTIONSCRIPT3">var request:URLRequest = new URLRequest("your_as2_project.swf");
var loader:Loader = new Loader();
loader.load(request);
addChild(loader);</pre>
<h3>Finnaly compile your AS 3 loader.</h3>
<p>It&#8217;s magic it works perfectly. It&#8217;s more smoothly and more faster. Thanks AVM2 ;).</p>
<h3>Very important notes :</h3>
<ul>
<li><strong>Delete all your TextField variables on you AS 2.0 file</strong> and use instance name. In AS 3.0 AVM2 doesn&#8217;t support TextField variables.</li>
<li><strong>You couldn&#8217;t send HTML parameters to swf</strong> direclty to your AS 2.0 swf. You have to use a LocalConnection in order to send and receive informations between your 2 swf.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.benoitfreslon.com/win-80-performance-on-flash-actionscript-2-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
