<?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>CODIGO.actionscript &#187; Efectos</title>
	<atom:link href="http://www.codigoactionscript.org/category/efectos/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codigoactionscript.org</link>
	<description>Blog de programación en ActionScript. Tips, tutoriales, ejemplos de Adobe Flash, Flex y AIR</description>
	<lastBuildDate>Fri, 30 Sep 2011 11:25:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>FlashLoaded: Componentes para Flash</title>
		<link>http://www.codigoactionscript.org/flashloaded-componentes-para-flash/</link>
		<comments>http://www.codigoactionscript.org/flashloaded-componentes-para-flash/#comments</comments>
		<pubDate>Wed, 21 Nov 2007 20:03:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Efectos]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Noticias]]></category>
		<category><![CDATA[Publicidad]]></category>

		<guid isPermaLink="false">http://www.codigo.as/blog/?p=99</guid>
		<description><![CDATA[<p></p>
<p>En FlashLoaded.com podemos encontrar una serie de buenos componentes para Flash a un precio bastante razonable.</p>
<p>El uso de componentes de este tipo de componentes permite a la gente con poca o ninguna experiencia con programación tener una web con recursos de nivel profesional.</p>
<p>Dándome una vuelta por este site he visto unos cuantos componentes que me parecen de mucha calidad:</p>
<p>FlashGuestbook
Este componente permite añadir un widget de comentarios altamente modificable, con campos personalizables, comentarios moderados y panel de control. Basado en MySQL. Con buscador de comentarios y todo 
</p>
<p>3DEnvironment
Este componente nos permite [...]
Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/flex-component-kit-para-flash-cs3/' rel='bookmark' title='Flex Component Kit para Flash CS3'>Flex Component Kit para Flash CS3</a></li>
<li><a href='http://www.codigoactionscript.org/modificar-datos-en-componentes-flex-con-itemeditors/' rel='bookmark' title='Modificar datos en componentes Flex con ItemEditors'>Modificar datos en componentes Flex con ItemEditors</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flashloaded.com"><img src="http://farm3.static.flickr.com/2183/2052604389_139de55be1.jpg" alt="Logo" /></a></p>
<p>En <a href="http://www.flashloaded.com">FlashLoaded.com</a> podemos encontrar una serie de buenos componentes para Flash a un precio bastante razonable.</p>
<p>El uso de componentes de este tipo de componentes permite a la gente con poca o ninguna experiencia con programación tener una web con recursos de nivel profesional.</p>
<p>Dándome una vuelta por este site he visto unos cuantos componentes que me parecen de mucha calidad:</p>
<p><strong>FlashGuestbook</strong><br />
Este componente permite añadir un widget de comentarios altamente modificable, con campos personalizables, comentarios moderados y panel de control. Basado en MySQL. Con buscador de comentarios y todo <img src='http://www.codigoactionscript.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="500" height="400"><param name="movie" value="http://www.flashloaded.com/flashcomponents/flashguestbook/example4.swf" /><param name="quality" value="high" /><embed src="http://www.flashloaded.com/flashcomponents/flashguestbook/example4.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"  width="500" height="400"></embed></object></p>
<p><strong>3DEnvironment</strong><br />
Este componente nos permite crear espacios de de manera muy fácil. El resultado es realmente muy bueno.<br />
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="500" height="400"><param name="movie" value="http://www.flashloaded.com/flashcomponents/3denvironment/space.swf" /><param name="quality" value="high" /><embed src="http://www.flashloaded.com/flashcomponents/3denvironment/space.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"  width="500" height="400"></embed></object><br />
<em>Mouse wheel: Move forward and backwards<br />
Up/down arrow: Move forward and backwards<br />
Left/right arrow: Move left and right<br />
Shift key: Tilt down<br />
Ctrl key: Tilt up<br />
End key: Rotate</em></p>
<p><strong>HotFlashVideo</strong><br />
Interesante componente que permite añadir zonas seleccionables a un video .FLV, y asi poder poner enlaces externos, textos de rollover o ejecutar cualquie tipo de acción.<br />
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="550" height="400"><param name="movie" value="http://www.flashloaded.com/flashcomponents/hotflashvideo/new_balloons.swf" /><param name="quality" value="high" /><embed src="http://www.flashloaded.com/flashcomponents/hotflashvideo/new_balloons.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"  width="550" height="400"></embed></object></p>
<p>Hay bastantes más componentes, animaciones, templates para ver. Recomiendo al menos <a href="http://www.flashloaded.com">darles un vistazo</a> <img src='http://www.codigoactionscript.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><em><strong>*Sponsored Post</strong></em></p>
<p>Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/flex-component-kit-para-flash-cs3/' rel='bookmark' title='Flex Component Kit para Flash CS3'>Flex Component Kit para Flash CS3</a></li>
<li><a href='http://www.codigoactionscript.org/modificar-datos-en-componentes-flex-con-itemeditors/' rel='bookmark' title='Modificar datos en componentes Flex con ItemEditors'>Modificar datos en componentes Flex con ItemEditors</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codigoactionscript.org/flashloaded-componentes-para-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Panel de zoom de imágenes en ActionScript 3</title>
		<link>http://www.codigoactionscript.org/panel-de-zoom-de-imagenes-en-actionscript-3/</link>
		<comments>http://www.codigoactionscript.org/panel-de-zoom-de-imagenes-en-actionscript-3/#comments</comments>
		<pubDate>Wed, 03 Oct 2007 16:20:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Efectos]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.codigo.as/blog/?p=95</guid>
		<description><![CDATA[<p>Este ejemplo es del estilo de "Zoom con lupa", aunque en esta ocasión es un zoom sobre una imagen con un panel de visualización al estilo de Photoshop.</p>
<p>El ejemplo es el siguiente:

Arrastra la zona roja del panel para desplazar la imagen</p>
<p>Para realizar este ejemplo necesitaremos la imagen a dos tamaños, una grande que colocaremos dentro de una máscara, y otra pequeña que colocaremos dentro de un MovieClip que utilizaremos como visor.</p>
<p></p>
<p>La imagen grande la colocaremos dentro de un clip al que llamaremos "mapaBig", y su mascara será otro clip al [...]
Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/ejemplo-de-zoom-con-lupa-en-flash-cs3/' rel='bookmark' title='Ejemplo de Zoom con lupa en Flash CS3'>Ejemplo de Zoom con lupa en Flash CS3</a></li>
<li><a href='http://www.codigoactionscript.org/panel-de-zoom-de-imagenes-en-flex/' rel='bookmark' title='Panel de zoom de imágenes en Flex'>Panel de zoom de imágenes en Flex</a></li>
<li><a href='http://www.codigoactionscript.org/ejemplo-de-zoom-con-lupa-en-flex/' rel='bookmark' title='Ejemplo de Zoom con lupa en Flex'>Ejemplo de Zoom con lupa en Flex</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Este ejemplo es del estilo de "<a href="http://www.codigo.as/blog/?p=94">Zoom con lupa</a>", aunque en esta ocasión es un zoom sobre una imagen con un panel de visualización al estilo de <a href="http://www.cristalab.com/tips/tags/photoshop">Photoshop</a>.</p>
<p>El ejemplo es el siguiente:<br />
<object width="500" height="400"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.cristalab.com/images/tips/actionscript_3/lupaZoom/lupaZoom.swf" /><embed src="http://www.cristalab.com/images/tips/actionscript_3/lupaZoom/lupaZoom.swf" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="500" height="400"></embed></object><br />
<em>Arrastra la zona roja del panel para desplazar la imagen</em></p>
<p>Para realizar este ejemplo necesitaremos la imagen a dos tamaños, una grande que colocaremos dentro de una máscara, y otra pequeña que colocaremos dentro de un MovieClip que utilizaremos como visor.</p>
<p><img src="http://www.cristalab.zguillez.com/lupa_mapa/cap1.jpg" alt="img" /></p>
<p>La imagen grande la colocaremos dentro de un clip al que llamaremos "<b>mapaBig</b>", y su mascara será otro clip al que llamaremos "<b>mascara</b>".</p>
<p>En cuanto al clip de visor lo llamaremos "<b>visor</b>" y la imagen pequeña "<b>mapaSmall</b>". Este clip contendrá tambien un botón que situaremos en la parte superior del panel que nos servirá para agarrar y mover el panel, este botón se llamará "<b>botDrag</b>". Tambien tendremos otro movieclip llamado "<b>zona</b>" formado por un rectángulo de color rojo y un botón invisible con el nombre "<b>botZona</b>".</p>
<p>Unas vez con la estructura de clips montada iremos a por el código. Todo este irá en el primer fotograma.</p>
<p>Empezaremos creandonos unas funciones para realizar el arrastre de la zona de zoom. Haremos que estas funciones nos sirvan tanto para el drag de la zona como para el drag del panel.</p>
<div id="codigo">
<div class="igBar"><span id="lactionscript-8"><a href="#" onclick="javascript:showPlainTxt('actionscript-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-8">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> visor_fx:<span style="color: #0066CC;">Boolean</span> = <span style="color: #000000; font-weight: bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//-----------------------------------------------</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">visor.<span style="color: #006600;">botDrag</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_DOWN</span>, onStartDrag<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">visor.<span style="color: #006600;">botDrag</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_UP</span>, onStopDrag<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">visor.<span style="color: #006600;">botDrag</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_OUT</span>, onStopDrag<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">visor.<span style="color: #006600;">zona</span>.<span style="color: #006600;">botZona</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_DOWN</span>, onStartDrag<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">visor.<span style="color: #006600;">zona</span>.<span style="color: #006600;">botZona</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_UP</span>, onStopDrag<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">visor.<span style="color: #006600;">zona</span>.<span style="color: #006600;">botZona</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_OUT</span>, onStopDrag<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//-----------------------------------------------</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> onStartDrag<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> clip:<span style="color: #0066CC;">MovieClip</span> = <span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">parent</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; clip.<span style="color: #0066CC;">startDrag</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; visor_fx = <span style="color: #000000; font-weight: bold;">true</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> onStopDrag<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">parent</span>.<span style="color: #0066CC;">stopDrag</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; visor_fx = <span style="color: #000000; font-weight: bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p>
Las funciones recuperan como parametro (target.parent) el clip que han de arrastrar dependiendo del clip que lanzó el evento.</p>
<p>También creamos una variable "<b>visor_fx</b>" que nos indica si estamos arrastrando algo en ese momento. Esto lo hacemos para posteriormente crear una función que se ejecute cada vez que movamos el mouse pero que solo ejecute las funciones internas en el caso de estar arrastrando el clip de "<b>zona</b>".</p>
<div id="codigo">
<div class="igBar"><span id="lactionscript-9"><a href="#" onclick="javascript:showPlainTxt('actionscript-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-9">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_MOVE</span>, MouseMove<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//-----------------------------------------------</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> MouseMove<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>visor_fx == <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; calculaDist<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; mueveVisorZona<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; controlaPosiciones<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></p>
<p>Aparte del arrastre haremos que al clicar sobre la imagen pequeña la zona se sitúe directamente en esa posición.</p>
<div id="codigo">
<div class="igBar"><span id="lactionscript-10"><a href="#" onclick="javascript:showPlainTxt('actionscript-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-10">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">visor.<span style="color: #006600;">mapaSmall</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_DOWN</span>, onPosicionaZona<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//-----------------------------------------------</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> onPosicionaZona<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> clip:<span style="color: #0066CC;">MovieClip</span> = <span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">parent</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; clip.<span style="color: #006600;">zona</span>.<span style="color: #006600;">x</span> = mouseX-clip.<span style="color: #006600;">x</span>- clip.<span style="color: #006600;">zona</span>.<span style="color: #0066CC;">width</span>/<span style="color: #cc66cc;color:#800000;">2</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; clip.<span style="color: #006600;">zona</span>.<span style="color: #006600;">y</span> = mouseY-clip.<span style="color: #006600;">y</span>- clip.<span style="color: #006600;">zona</span>.<span style="color: #0066CC;">height</span>/<span style="color: #cc66cc;color:#800000;">2</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; calculaDist<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; mueveVisorZona<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; controlaPosiciones<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></p>
<p>Ahora vamos con las funciones que realizaran el desplazamiento de la imagen grande en función de la posición del clip "zona" sobre la imagen pequeña. Empezaremos creando unas variables:</p>
<div id="codigo">
<div class="igBar"><span id="lactionscript-11"><a href="#" onclick="javascript:showPlainTxt('actionscript-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-11">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> porcentajeX:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">100</span> / <span style="color: #66cc66;">&#40;</span>mapaBig.<span style="color: #0066CC;">width</span> / visor.<span style="color: #006600;">mapaSmall</span>.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> porcentajeY:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">100</span> / <span style="color: #66cc66;">&#40;</span>mapaBig.<span style="color: #0066CC;">height</span> / visor.<span style="color: #006600;">mapaSmall</span>.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">visor.<span style="color: #006600;">zona</span>.<span style="color: #0066CC;">width</span> = mascara.<span style="color: #0066CC;">width</span> * porcentajeX / <span style="color: #cc66cc;color:#800000;">100</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">visor.<span style="color: #006600;">zona</span>.<span style="color: #0066CC;">height</span> = mascara.<span style="color: #0066CC;">height</span> * porcentajeY / <span style="color: #cc66cc;color:#800000;">100</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> distX:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> distY:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>; </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></p>
<p>La variable <b>porcentajeX/Y</b> calcula el porcentaje de escalado entre las dos imágenes. Una vez sabemos este porcentaje escalamos el clip "zona" a la misma escala en relación a la imagen pequeña.</p>
<p>También creamos dos variables <b>distX/Y</b> que contendrán la distancia de corrección de la imagen grande en relación al visor, las dejaremos a 0 ya que haremos una función para calcular esa distancia.</p>
<div id="codigo">
<div class="igBar"><span id="lactionscript-12"><a href="#" onclick="javascript:showPlainTxt('actionscript-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-12">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> calculaDist<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; distX = <span style="color: #66cc66;">&#40;</span>visor.<span style="color: #006600;">zona</span>.<span style="color: #006600;">x</span> - visor.<span style="color: #006600;">mapaSmall</span>.<span style="color: #006600;">x</span><span style="color: #66cc66;">&#41;</span> / porcentajeX * <span style="color: #cc66cc;color:#800000;">100</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; distY = <span style="color: #66cc66;">&#40;</span>visor.<span style="color: #006600;">zona</span>.<span style="color: #006600;">y</span> - visor.<span style="color: #006600;">mapaSmall</span>.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span> / porcentajeY * <span style="color: #cc66cc;color:#800000;">100</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; distX = <span style="color: #66cc66;">&#40;</span>distX&lt;<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>?<span style="color: #cc66cc;color:#800000;">0</span>:distX;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; distY = <span style="color: #66cc66;">&#40;</span>distY&lt;<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>?<span style="color: #cc66cc;color:#800000;">0</span>:distY;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></p>
<p>En función de estos valores moveremos la imagen grande bajo la máscara.</p>
<div id="codigo">
<div class="igBar"><span id="lactionscript-13"><a href="#" onclick="javascript:showPlainTxt('actionscript-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-13">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> mueveVisorZona<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; mapaBig.<span style="color: #006600;">x</span> = mascara.<span style="color: #006600;">x</span> - distX;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; mapaBig.<span style="color: #006600;">y</span> = mascara.<span style="color: #006600;">y</span> - distY;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></p>
<p>Solo queda crear una función que controle que al arrastrar no desplacemos el clip de zona fuera del visor, o el visor fuera de la película.</p>
<div id="codigo">
<div class="igBar"><span id="lactionscript-14"><a href="#" onclick="javascript:showPlainTxt('actionscript-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-14">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> controlaPosiciones<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//visor</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>visor.<span style="color: #006600;">x</span>&lt;<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; visor.<span style="color: #006600;">x</span>=<span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>visor.<span style="color: #006600;">x</span>&gt;stage.<span style="color: #006600;">stageWidth</span>-visor.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; visor.<span style="color: #006600;">x</span>=<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">stageWidth</span>-visor.<span style="color: #0066CC;">width</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>visor.<span style="color: #006600;">y</span>&lt;<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; visor.<span style="color: #006600;">y</span>=<span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>visor.<span style="color: #006600;">y</span>&gt;stage.<span style="color: #006600;">stageHeight</span>-visor.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; visor.<span style="color: #006600;">y</span>=<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">stageHeight</span>-visor.<span style="color: #0066CC;">height</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//zona</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>visor.<span style="color: #006600;">zona</span>.<span style="color: #006600;">x</span>&lt;visor.<span style="color: #006600;">mapaSmall</span>.<span style="color: #006600;">x</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; visor.<span style="color: #006600;">zona</span>.<span style="color: #006600;">x</span>=visor.<span style="color: #006600;">mapaSmall</span>.<span style="color: #006600;">x</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>visor.<span style="color: #006600;">zona</span>.<span style="color: #006600;">x</span>&gt;visor.<span style="color: #006600;">mapaSmall</span>.<span style="color: #006600;">x</span>+visor.<span style="color: #006600;">mapaSmall</span>.<span style="color: #006600;">width</span>-visor.<span style="color: #006600;">zona</span>.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; visor.<span style="color: #006600;">zona</span>.<span style="color: #006600;">x</span>=visor.<span style="color: #006600;">mapaSmall</span>.<span style="color: #006600;">x</span>+visor.<span style="color: #006600;">mapaSmall</span>.<span style="color: #006600;">width</span>-visor.<span style="color: #006600;">zona</span>.<span style="color: #0066CC;">width</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>visor.<span style="color: #006600;">zona</span>.<span style="color: #006600;">y</span>&lt;visor.<span style="color: #006600;">mapaSmall</span>.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; visor.<span style="color: #006600;">zona</span>.<span style="color: #006600;">y</span>=visor.<span style="color: #006600;">mapaSmall</span>.<span style="color: #006600;">y</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>visor.<span style="color: #006600;">zona</span>.<span style="color: #006600;">y</span>&gt;visor.<span style="color: #006600;">mapaSmall</span>.<span style="color: #006600;">y</span>+visor.<span style="color: #006600;">mapaSmall</span>.<span style="color: #006600;">height</span>-visor.<span style="color: #006600;">zona</span>.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; visor.<span style="color: #006600;">zona</span>.<span style="color: #006600;">y</span>=visor.<span style="color: #006600;">mapaSmall</span>.<span style="color: #006600;">y</span>+visor.<span style="color: #006600;">mapaSmall</span>.<span style="color: #006600;">height</span>-visor.<span style="color: #006600;">zona</span>.<span style="color: #0066CC;">height</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//mapaBig</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>mapaBig.<span style="color: #006600;">x</span>&gt;<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; mapaBig.<span style="color: #006600;">x</span>=<span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>mapaBig.<span style="color: #006600;">x</span>&lt;mascara.<span style="color: #006600;">width</span>-mapaBig.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; mapaBig.<span style="color: #006600;">x</span>=mascara.<span style="color: #006600;">width</span>-mapaBig.<span style="color: #0066CC;">width</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>mapaBig.<span style="color: #006600;">y</span>&gt;<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; mapaBig.<span style="color: #006600;">y</span>=<span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>mapaBig.<span style="color: #006600;">y</span>&lt;mascara.<span style="color: #006600;">height</span>-mapaBig.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; mapaBig.<span style="color: #006600;">y</span>=mascara.<span style="color: #006600;">height</span>-mapaBig.<span style="color: #0066CC;">height</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></p>
<p>Y listo, ejemplo acabado ^^</p>
<p>Aqui el <a href="http://www.cristalab.zguillez.com/lupaZoom/lupaZoom.fla">archivo .fla</a></p>
<p>Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/ejemplo-de-zoom-con-lupa-en-flash-cs3/' rel='bookmark' title='Ejemplo de Zoom con lupa en Flash CS3'>Ejemplo de Zoom con lupa en Flash CS3</a></li>
<li><a href='http://www.codigoactionscript.org/panel-de-zoom-de-imagenes-en-flex/' rel='bookmark' title='Panel de zoom de imágenes en Flex'>Panel de zoom de imágenes en Flex</a></li>
<li><a href='http://www.codigoactionscript.org/ejemplo-de-zoom-con-lupa-en-flex/' rel='bookmark' title='Ejemplo de Zoom con lupa en Flex'>Ejemplo de Zoom con lupa en Flex</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codigoactionscript.org/panel-de-zoom-de-imagenes-en-actionscript-3/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Ejemplo de Zoom con lupa en Flash CS3</title>
		<link>http://www.codigoactionscript.org/ejemplo-de-zoom-con-lupa-en-flash-cs3/</link>
		<comments>http://www.codigoactionscript.org/ejemplo-de-zoom-con-lupa-en-flash-cs3/#comments</comments>
		<pubDate>Tue, 25 Sep 2007 01:18:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Efectos]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.codigo.as/blog/?p=94</guid>
		<description><![CDATA[<p>Este es un ejemplo de lupa sobre un mapa realizado en Flash CS3 y actionscript 3. Hacer este efecto es muy sencillo, únicamente hemos de tener dos imágenes, una pequeña y otra más grande que ocultaremos dentro de una máscara. Esta máscara la moveremos para crear el efecto de lupa.</p>

Desplaza el mouse sobre la imagen para mover la lupa
<p>Colocaremos la imagen pequeña dentro de un MovieClip que se llame "mapaSmall" y la imagen grande dentro de otro que se llame "mapaBig".</p>
<p>La máscara que ocultará el mapa grande será otro MovieClip [...]
Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/panel-de-zoom-de-imagenes-en-actionscript-3/' rel='bookmark' title='Panel de zoom de imágenes en ActionScript 3'>Panel de zoom de imágenes en ActionScript 3</a></li>
<li><a href='http://www.codigoactionscript.org/ejemplo-de-zoom-con-lupa-en-flex/' rel='bookmark' title='Ejemplo de Zoom con lupa en Flex'>Ejemplo de Zoom con lupa en Flex</a></li>
<li><a href='http://www.codigoactionscript.org/panel-de-zoom-de-imagenes-en-flex/' rel='bookmark' title='Panel de zoom de imágenes en Flex'>Panel de zoom de imágenes en Flex</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Este es un ejemplo de lupa sobre un mapa realizado en Flash CS3 y actionscript 3. Hacer este efecto es muy sencillo, únicamente hemos de tener dos imágenes, una pequeña y otra más grande que ocultaremos dentro de una máscara. Esta máscara la moveremos para crear el efecto de lupa.</p>
<div align="center"><object width="512" height="484"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.cristalab.com/zguillez/flash/as3/lupa_mapa/lupaAS3.swf" /><embed src="http://www.cristalab.com/zguillez/flash/as3/lupa_mapa/lupaAS3.swf" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="512" height="484"></embed></object><br />
<em>Desplaza el mouse sobre la imagen para mover la lupa</em></div>
<p>Colocaremos la imagen pequeña dentro de un MovieClip que se llame "mapaSmall" y la imagen grande dentro de otro que se llame "mapaBig".</p>
<p>La máscara que ocultará el mapa grande será otro MovieClip con el nombre "mascara", y la lupa la llamaremos "lupa" y será un clip de igual tamaño que el contorno de la máscara.</p>
<p><img src="http://www.cristalab.zguillez.com/lupa_mapa/cap1.jpg" alt="img" /></p>
<p>Una vez montados los clips empecemos con el código:</p>
<div id="codigo">
<div class="igBar"><span id="lactionscript-18"><a href="#" onclick="javascript:showPlainTxt('actionscript-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-18">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> porcentajeX:uint = <span style="color: #cc66cc;color:#800000;">100</span> / <span style="color: #66cc66;">&#40;</span>mapaBig.<span style="color: #0066CC;">width</span> / <span style="color: #66cc66;">&#40;</span>mapaSmall.<span style="color: #0066CC;">width</span> - lupa.<span style="color: #0066CC;">width</span> / <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> porcentajeY:uint = <span style="color: #cc66cc;color:#800000;">100</span> / <span style="color: #66cc66;">&#40;</span>mapaBig.<span style="color: #0066CC;">height</span> / <span style="color: #66cc66;">&#40;</span>mapaSmall.<span style="color: #0066CC;">height</span> - lupa.<span style="color: #0066CC;">height</span> / <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> distX:uint = <span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> distY:uint = <span style="color: #cc66cc;color:#800000;">0</span>; </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></p>
<p>Primero de todo crearemos una serie de variables. Las variables porcentajeX/Y definen que tanto por ciento está ampliada la imagen grande en relación a la pequeña.</p>
<p>Las variables distX/Y nos indican la distancia de corrección para que la zona de la imagen grande situada bajo el mouse coincida con la zona de la imagen pequeña. Por defecto colocaremos estos valores a 0.</p>
<p>Ahora crearemos una función que se ejecute cada vez que movamos el mouse.</p>
<div id="codigo">
<div class="igBar"><span id="lactionscript-19"><a href="#" onclick="javascript:showPlainTxt('actionscript-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-19">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_MOVE</span>, lupaMouseMove<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//-----------------------------------------------</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> lupaMouseMove<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; calculaDist<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; mueveLupa<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; lupa.<span style="color: #006600;">x</span> = mouseX - lupa.<span style="color: #0066CC;">width</span> / <span style="color: #cc66cc;color:#800000;">2</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; lupa.<span style="color: #006600;">y</span> = mouseY - lupa.<span style="color: #0066CC;">height</span> / <span style="color: #cc66cc;color:#800000;">2</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>lupa.<span style="color: #006600;">x</span> &lt;mapaSmall.<span style="color: #006600;">x</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lupa.<span style="color: #006600;">x</span> = mapaSmall.<span style="color: #006600;">x</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>lupa.<span style="color: #006600;">x</span>&gt; mapaSmall.<span style="color: #006600;">x</span> + mapaSmall.<span style="color: #0066CC;">width</span> - lupa.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lupa.<span style="color: #006600;">x</span> = mapaSmall.<span style="color: #006600;">x</span> + mapaSmall.<span style="color: #0066CC;">width</span> - lupa.<span style="color: #0066CC;">width</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>lupa.<span style="color: #006600;">y</span> &lt;mapaSmall.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lupa.<span style="color: #006600;">y</span> = mapaSmall.<span style="color: #006600;">y</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>lupa.<span style="color: #006600;">y</span>&gt; mapaSmall.<span style="color: #006600;">y</span> + mapaSmall.<span style="color: #0066CC;">height</span> - lupa.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lupa.<span style="color: #006600;">y</span> = mapaSmall.<span style="color: #006600;">y</span> + mapaSmall.<span style="color: #0066CC;">height</span> - lupa.<span style="color: #0066CC;">height</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; mascara.<span style="color: #006600;">x</span> = lupa.<span style="color: #006600;">x</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; mascara.<span style="color: #006600;">y</span> = lupa.<span style="color: #006600;">y</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></p>
<p>En esta función moveremos el MovieClip "lupa" en relación a la posición del mouse, controlaremos que el clip no salga de la pantalla, y haremos que la posición de la máscara sea la misma que la lupa.</p>
<p>En esta función también haremos una llamada a dos funciones. Una que actualizaran las variables distX/Y que variaran según la posición de la lupa y del porcentaje de ampliación de las imágenes, y otra que hará que la imagen grande se mueva según estas variables.</p>
<div id="codigo">
<div class="igBar"><span id="lactionscript-20"><a href="#" onclick="javascript:showPlainTxt('actionscript-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-20">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> calculaDist<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;distX = <span style="color: #66cc66;">&#40;</span>lupa.<span style="color: #006600;">x</span> - mapaSmall.<span style="color: #006600;">x</span><span style="color: #66cc66;">&#41;</span> / porcentajeX * <span style="color: #cc66cc;color:#800000;">100</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;distY = <span style="color: #66cc66;">&#40;</span>lupa.<span style="color: #006600;">y</span> - mapaSmall.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span> / porcentajeY * <span style="color: #cc66cc;color:#800000;">100</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> mueveLupa<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;mapaBig.<span style="color: #006600;">x</span> = mascara.<span style="color: #006600;">x</span> - distX;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;mapaBig.<span style="color: #006600;">y</span> = mascara.<span style="color: #006600;">y</span> - distY;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></p>
<p>Y liso! ^^</p>
<p>Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/panel-de-zoom-de-imagenes-en-actionscript-3/' rel='bookmark' title='Panel de zoom de imágenes en ActionScript 3'>Panel de zoom de imágenes en ActionScript 3</a></li>
<li><a href='http://www.codigoactionscript.org/ejemplo-de-zoom-con-lupa-en-flex/' rel='bookmark' title='Ejemplo de Zoom con lupa en Flex'>Ejemplo de Zoom con lupa en Flex</a></li>
<li><a href='http://www.codigoactionscript.org/panel-de-zoom-de-imagenes-en-flex/' rel='bookmark' title='Panel de zoom de imágenes en Flex'>Panel de zoom de imágenes en Flex</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codigoactionscript.org/ejemplo-de-zoom-con-lupa-en-flash-cs3/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Foto Panoramica 360Âº usando bitmapData</title>
		<link>http://www.codigoactionscript.org/foto-panoramica-360%c2%ba-usando-bitmapdata/</link>
		<comments>http://www.codigoactionscript.org/foto-panoramica-360%c2%ba-usando-bitmapdata/#comments</comments>
		<pubDate>Sun, 18 Feb 2007 18:48:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS2]]></category>
		<category><![CDATA[Avanzado]]></category>
		<category><![CDATA[Class]]></category>
		<category><![CDATA[Efectos]]></category>

		<guid isPermaLink="false">http://www.codigo.as/blog/?p=56</guid>
		<description><![CDATA[<p>A partir de un código posteado por Teseo en Cristalab, en la que generaba una imagen panorámica utilizando BitmapData escribí esta clase:</p>


PLAIN TEXT
Actionscript:




import flash.display.*;


import flash.geom.*;


import mx.utils.Delegate;


//--------------------------------


class pan360


&#123;


&#160; &#160; private var ruta:MovieClip;


&#160; &#160; private var clip:MovieClip;


&#160; &#160; private var imagen:String;


&#160; &#160; private var ancho:Number;


&#160; &#160; private var v:Number;


&#160; &#160; private var wa:Number;


&#160; &#160; //--------------------------------


&#160; &#160; public function pan360&#40;qRuta:MovieClip, qClip:String, qImagen:String, qAncho:Number&#41;


&#160; &#160; &#123;


&#160; &#160; &#160; &#160; ruta = qRuta;


&#160; &#160; &#160; &#160; imagen = qImagen;


&#160; &#160; &#160; &#160; ancho = qAncho;


&#160; &#160; &#160; &#160; clip = ruta.createEmptyMovieClip&#40;qClip, ruta.getNextHighestDepth&#40;&#41;&#41;;


&#160; &#160; &#160; &#160; [...]
Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/34/' rel='bookmark' title='Foto panorámica 360º en flash'>Foto panorámica 360º en flash</a></li>
<li><a href='http://www.codigoactionscript.org/redibujar-una-linea-con-actionscript/' rel='bookmark' title='Redibujar una línea con ActionScript'>Redibujar una línea con ActionScript</a></li>
<li><a href='http://www.codigoactionscript.org/clase-contenedor/' rel='bookmark' title='Clase Contenedor'>Clase Contenedor</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>A partir de un <a href="http://www.cristalab.com/tips/35079/foto-panoramica-360-usando-bitmapdata-en-flash-8">código posteado</a> por <strong><a href="http://www.cristalab.com/foros/profile.php?mode=viewprofile&#038;u=8913">Teseo</a></strong> en <a href="http://www.cristalab.com">Cristalab</a>, en la que generaba una imagen panorámica utilizando <strong>BitmapData</strong> escribí esta clase:</p>
<div id=codigo>
<div id="codigo">
<div class="igBar"><span id="lactionscript-23"><a href="#" onclick="javascript:showPlainTxt('actionscript-23'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-23">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.*;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">geom</span>.*;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">utils</span>.<span style="color: #006600;">Delegate</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//--------------------------------</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> pan360</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> ruta:<span style="color: #0066CC;">MovieClip</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> clip:<span style="color: #0066CC;">MovieClip</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> imagen:<span style="color: #0066CC;">String</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> ancho:<span style="color: #0066CC;">Number</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> v:<span style="color: #0066CC;">Number</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> wa:<span style="color: #0066CC;">Number</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//--------------------------------</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> pan360<span style="color: #66cc66;">&#40;</span>qRuta:<span style="color: #0066CC;">MovieClip</span>, qClip:<span style="color: #0066CC;">String</span>, qImagen:<span style="color: #0066CC;">String</span>, qAncho:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; ruta = qRuta;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; imagen = qImagen;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; ancho = qAncho;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; clip = ruta.<span style="color: #0066CC;">createEmptyMovieClip</span><span style="color: #66cc66;">&#40;</span>qClip, ruta.<span style="color: #0066CC;">getNextHighestDepth</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; clip.<span style="color: #006600;">img</span> = BitmapData.<span style="color: #006600;">loadBitmap</span><span style="color: #66cc66;">&#40;</span>imagen<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; clip.<span style="color: #006600;">tmp</span> = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span>ancho, clip.<span style="color: #006600;">img</span>.<span style="color: #0066CC;">height</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; clip.<span style="color: #006600;">attachBitmap</span><span style="color: #66cc66;">&#40;</span>clip.<span style="color: #006600;">tmp</span>, <span style="color: #cc66cc;color:#800000;">1</span>, <span style="color: #ff0000;">"auto"</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; clip.<span style="color: #006600;">tmp</span>.<span style="color: #006600;">copyPixels</span><span style="color: #66cc66;">&#40;</span>clip.<span style="color: #006600;">img</span>, clip.<span style="color: #006600;">tmp</span>.<span style="color: #006600;">rectangle</span>, <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; clip.<span style="color: #0066CC;">onRollOver</span> = Delegate.<span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #0066CC;">onRollOver</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; clip.<span style="color: #0066CC;">onRollOut</span> = Delegate.<span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #0066CC;">onRollOut</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//--------------------------------</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">onRollOver</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; clip.<span style="color: #0066CC;">onEnterFrame</span> = Delegate.<span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #0066CC;">onEnterFrame</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">onRollOut</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">delete</span> clip.<span style="color: #0066CC;">onEnterFrame</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">onEnterFrame</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; wa = clip.<span style="color: #006600;">img</span>.<span style="color: #0066CC;">width</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; v = <span style="color: #66cc66;">&#40;</span>v == <span style="color: #0066CC;">undefined</span><span style="color: #66cc66;">&#41;</span> ? <span style="color: #cc66cc;color:#800000;">0</span> : <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>v + <span style="color: #66cc66;">&#40;</span>ruta.<span style="color: #0066CC;">_xmouse</span> - clip.<span style="color: #006600;">tmp</span>.<span style="color: #0066CC;">width</span> / <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span> / <span style="color: #cc66cc;color:#800000;">15</span><span style="color: #66cc66;">&#41;</span> % wa<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; clip.<span style="color: #006600;">tmp</span>.<span style="color: #006600;">copyPixels</span><span style="color: #66cc66;">&#40;</span>clip.<span style="color: #006600;">img</span>, <span style="color: #000000; font-weight: bold;">new</span> Rectangle<span style="color: #66cc66;">&#40;</span>v, <span style="color: #cc66cc;color:#800000;">0</span>, wa, clip.<span style="color: #006600;">img</span>.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; clip.<span style="color: #006600;">tmp</span>.<span style="color: #006600;">copyPixels</span><span style="color: #66cc66;">&#40;</span>clip.<span style="color: #006600;">img</span>, <span style="color: #000000; font-weight: bold;">new</span> Rectangle<span style="color: #66cc66;">&#40;</span>v + wa - <span style="color: #cc66cc;color:#800000;">2</span> * wa * <span style="color: #66cc66;">&#40;</span>v&gt; <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;color:#800000;">0</span>, wa, clip.<span style="color: #006600;">img</span>.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//--------------------------------</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> pos<span style="color: #66cc66;">&#40;</span>qX:<span style="color: #0066CC;">Number</span>, qY:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; clip.<span style="color: #0066CC;">_x</span> = qX;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; clip.<span style="color: #0066CC;">_y</span> = qY;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></div>
<p>Su uso:</p>
<div id=codigo>
<div id="codigo">
<div class="igBar"><span id="lactionscript-24"><a href="#" onclick="javascript:showPlainTxt('actionscript-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-24">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> pan360;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> pano:pan360 = <span style="color: #000000; font-weight: bold;">new</span> pan360<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #ff0000;">"pano1"</span>, <span style="color: #ff0000;">"pano"</span>, <span style="color: #cc66cc;color:#800000;">300</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">pano.<span style="color: #006600;">pos</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">100</span>, <span style="color: #cc66cc;color:#800000;">50</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></div>
<p><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="300" height="144"><param name="movie" value="http://www.cristalab.zguillez.com/pan360/pan360.swf" /><param name="quality" value="high" /><embed src="http://www.cristalab.zguillez.com/pan360/pan360.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"  width="300" height="144"></embed></object></p>
<p>Pueden ver el post original <a href="http://www.cristalab.com/tips/35079/foto-panoramica-360-usando-bitmapdata-en-flash-8">AQUI</a>.<br />
Pueden ver tambien este <a href="http://www.codigo.as/blog/?p=34">otro ejemplo de movimiento panorámico</a>. En este caso utilizando MovieClips y máscaras.</p>
<p>Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/34/' rel='bookmark' title='Foto panorámica 360º en flash'>Foto panorámica 360º en flash</a></li>
<li><a href='http://www.codigoactionscript.org/redibujar-una-linea-con-actionscript/' rel='bookmark' title='Redibujar una línea con ActionScript'>Redibujar una línea con ActionScript</a></li>
<li><a href='http://www.codigoactionscript.org/clase-contenedor/' rel='bookmark' title='Clase Contenedor'>Clase Contenedor</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codigoactionscript.org/foto-panoramica-360%c2%ba-usando-bitmapdata/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Fondo bitmap que se ajusta al tamaño del navegador en Flash</title>
		<link>http://www.codigoactionscript.org/fondo-bitmap-que-se-ajusta-al-tamano-del-navegador-en-flash/</link>
		<comments>http://www.codigoactionscript.org/fondo-bitmap-que-se-ajusta-al-tamano-del-navegador-en-flash/#comments</comments>
		<pubDate>Wed, 13 Dec 2006 21:24:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Avanzado]]></category>
		<category><![CDATA[Efectos]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.codigo.as/blog/?p=50</guid>
		<description><![CDATA[<p>Cómo colocar una imagen de fondo de nuestra película que se adapte al tamaño de la ventana del navegador, escalandose pero sin distorsionarse.</p>
<p>El sistema es sencillo:</p>
<p>    * Tenemos una película flash al 100% dentro del html
    * La película tendrá la opción de "noscale" para que no se redimensione el contenido (sólo queremos que se redimensione el fondo)
    * Tenemos un bitmap dentro de un clip al que escalamos según el tamaño de la ventana
    * Cada vez [...]
Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/panel-de-zoom-de-imagenes-en-actionscript-3/' rel='bookmark' title='Panel de zoom de imágenes en ActionScript 3'>Panel de zoom de imágenes en ActionScript 3</a></li>
<li><a href='http://www.codigoactionscript.org/34/' rel='bookmark' title='Foto panorámica 360º en flash'>Foto panorámica 360º en flash</a></li>
<li><a href='http://www.codigoactionscript.org/ejemplo-de-zoom-con-lupa-en-flash-cs3/' rel='bookmark' title='Ejemplo de Zoom con lupa en Flash CS3'>Ejemplo de Zoom con lupa en Flash CS3</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Cómo colocar una imagen de fondo de nuestra película que se adapte al tamaño de la ventana del navegador, escalandose pero sin distorsionarse.</p>
<p>El sistema es sencillo:</p>
<p>    * Tenemos una película flash al 100% dentro del html<br />
    * La película tendrá la opción de "noscale" para que no se redimensione el contenido (sólo queremos que se redimensione el fondo)<br />
    * Tenemos un bitmap dentro de un clip al que escalamos según el tamaño de la ventana<br />
    * Cada vez que redimensionamos la ventana del navegador redimensionaremos también el clip de fondo</p>
<div id=codigo>
<div id="codigo">
<div class="igBar"><span id="lactionscript-26"><a href="#" onclick="javascript:showPlainTxt('actionscript-26'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-26">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">Stage</span>.<span style="color: #0066CC;">scaleMode</span> = <span style="color: #ff0000;">"noscale"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//-----------------------</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> StageWidth:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">550</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> StageHeight:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">400</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> escalaFondo<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Stage</span>.<span style="color: #006600;">width</span>&gt; <span style="color: #0066CC;">Stage</span>.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; fondo.<span style="color: #0066CC;">_width</span> = <span style="color: #0066CC;">Stage</span>.<span style="color: #0066CC;">width</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; fondo.<span style="color: #0066CC;">_yscale</span> = fondo.<span style="color: #0066CC;">_xscale</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; fondo.<span style="color: #0066CC;">_height</span> = <span style="color: #0066CC;">Stage</span>.<span style="color: #0066CC;">height</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; fondo.<span style="color: #0066CC;">_xscale</span> = fondo.<span style="color: #0066CC;">_yscale</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;fondo.<span style="color: #0066CC;">_x</span> = <span style="color: #66cc66;">&#40;</span>StageWidth - fondo.<span style="color: #0066CC;">_width</span><span style="color: #66cc66;">&#41;</span> / <span style="color: #cc66cc;color:#800000;">2</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;fondo.<span style="color: #0066CC;">_y</span> = <span style="color: #66cc66;">&#40;</span>StageHeight - fondo.<span style="color: #0066CC;">_height</span><span style="color: #66cc66;">&#41;</span> / <span style="color: #cc66cc;color:#800000;">2</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//-----------------------</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">Stage</span>.<span style="color: #0066CC;">addListener</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">onResize</span> = escalaFondo;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">escalaFondo<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//-----------------------</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">stop</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p>
</div>
<p>Pueden ver el <a href="http://www.cristalab.com/files/ejemplos/fondobitmap/fondofull.html">ejemplo</a> y una <a href="http://www.cristalab.com/foros/viewtopic.php?t=32220">breve explicación</a> en el post que hize en <a href="http://www.cristalab.com/">cristalab</a>.</p>
<p>Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/panel-de-zoom-de-imagenes-en-actionscript-3/' rel='bookmark' title='Panel de zoom de imágenes en ActionScript 3'>Panel de zoom de imágenes en ActionScript 3</a></li>
<li><a href='http://www.codigoactionscript.org/34/' rel='bookmark' title='Foto panorámica 360º en flash'>Foto panorámica 360º en flash</a></li>
<li><a href='http://www.codigoactionscript.org/ejemplo-de-zoom-con-lupa-en-flash-cs3/' rel='bookmark' title='Ejemplo de Zoom con lupa en Flash CS3'>Ejemplo de Zoom con lupa en Flash CS3</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codigoactionscript.org/fondo-bitmap-que-se-ajusta-al-tamano-del-navegador-en-flash/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Drag and Drop en AS3</title>
		<link>http://www.codigoactionscript.org/drag-and-drop-en-as3/</link>
		<comments>http://www.codigoactionscript.org/drag-and-drop-en-as3/#comments</comments>
		<pubDate>Thu, 09 Nov 2006 18:44:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Efectos]]></category>
		<category><![CDATA[Trucos]]></category>

		<guid isPermaLink="false">http://www.codigo.as/blog/?p=45</guid>
		<description><![CDATA[<p>Este es un pequeño ejemplo de como hacer un drag &#038; drop de un Movieclip en actionscript 3.</p>
<p>Crearemos en flash9 un Movieclip al que llamaremos "clip".</p>
<p>En el fotograma añadiremos el siguiente código:</p>


PLAIN TEXT
Actionscript:




clip.addEventListener&#40;MouseEvent.MOUSE_DOWN, onMouse_Down&#41;;


clip.addEventListener&#40;MouseEvent.MOUSE_UP, onMouse_Up&#41;; 






<p>
<p>Con esto asignaremoslos eventos de pulsar y soltar el mouse sobre el clip a las funciones "onMouse_Down" y "onMouse_Up".</p>
<p>Ahora definiremos estas funciones:</p>


PLAIN TEXT
Actionscript:




function onMouse_Down&#40;e:Event&#41;:void&#123;


clip.startDrag&#40;&#41;


&#125;


function onMouse_Up&#40;e:Event&#41;:void&#123;


clip.stopDrag&#40;&#41;;


&#125; 






<p>
<p>Con esto ya tendríamos el MovieClip "clip" arrastrable.</p>
<p>Este mismo código lo podríamos haber puesto dentro de una clase AS3:</p>


PLAIN TEXT
Actionscript:




package&#123;


import flash.display.*


import flash.events.*;


//------------------------------------


public class Drag extends MovieClip&#123;


public var clip:MovieClip = new [...]
Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/panel-de-zoom-de-imagenes-en-flex/' rel='bookmark' title='Panel de zoom de imágenes en Flex'>Panel de zoom de imágenes en Flex</a></li>
<li><a href='http://www.codigoactionscript.org/panel-de-zoom-de-imagenes-en-actionscript-3/' rel='bookmark' title='Panel de zoom de imágenes en ActionScript 3'>Panel de zoom de imágenes en ActionScript 3</a></li>
<li><a href='http://www.codigoactionscript.org/onreleaseoutside-ondragout-ondragover-en-actionscript-3/' rel='bookmark' title='onReleaseOutside, onDragOut, onDragOver en ActionScript 3'>onReleaseOutside, onDragOut, onDragOver en ActionScript 3</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Este es un pequeño ejemplo de como hacer un <strong>drag &#038; drop</strong> de un Movieclip en <strong>actionscript 3</strong>.</p>
<p>Crearemos en flash9 un Movieclip al que llamaremos "clip".</p>
<p>En el fotograma añadiremos el siguiente código:</p>
<div id=codigo>
<div id="codigo">
<div class="igBar"><span id="lactionscript-31"><a href="#" onclick="javascript:showPlainTxt('actionscript-31'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-31">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">clip.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_DOWN</span>, onMouse_Down<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">clip.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_UP</span>, onMouse_Up<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></div>
<p>Con esto asignaremoslos eventos de pulsar y soltar el mouse sobre el clip a las funciones "<strong>onMouse_Down</strong>" y "<strong>onMouse_Up</strong>".</p>
<p>Ahora definiremos estas funciones:</p>
<div id=codigo>
<div id="codigo">
<div class="igBar"><span id="lactionscript-32"><a href="#" onclick="javascript:showPlainTxt('actionscript-32'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-32">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> onMouse_Down<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">clip.<span style="color: #0066CC;">startDrag</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> onMouse_Up<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">clip.<span style="color: #0066CC;">stopDrag</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></div>
<p>Con esto ya tendríamos el MovieClip "clip" arrastrable.</p>
<p>Este mismo código lo podríamos haber puesto dentro de una clase AS3:</p>
<div id=codigo>
<div id="codigo">
<div class="igBar"><span id="lactionscript-33"><a href="#" onclick="javascript:showPlainTxt('actionscript-33'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-33">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.*</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.*;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//------------------------------------</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Drag <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> clip:<span style="color: #0066CC;">MovieClip</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">MovieClip</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//------------------------------------</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Drag<span style="color: #66cc66;">&#40;</span>queClip<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">clip = queClip</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">clip.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_DOWN</span>, <span style="color: #0066CC;">onMouseDown</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">clip.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_UP</span>, <span style="color: #0066CC;">onMouseUp</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//------------------------------------</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">onMouseDown</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">clip.<span style="color: #0066CC;">startDrag</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//------------------------------------</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">onMouseUp</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">clip.<span style="color: #0066CC;">stopDrag</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></div>
<p>Al crear el constructor de la clase deberemos pasarle el MovieClip a arrastrar como parámetro:</p>
<div id=codigo>
<div id="codigo">
<div class="igBar"><span id="lactionscript-34"><a href="#" onclick="javascript:showPlainTxt('actionscript-34'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-34">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> Drag</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> drag:Drag = <span style="color: #000000; font-weight: bold;">new</span> Drag<span style="color: #66cc66;">&#40;</span>clip<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></div>
<p>Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/panel-de-zoom-de-imagenes-en-flex/' rel='bookmark' title='Panel de zoom de imágenes en Flex'>Panel de zoom de imágenes en Flex</a></li>
<li><a href='http://www.codigoactionscript.org/panel-de-zoom-de-imagenes-en-actionscript-3/' rel='bookmark' title='Panel de zoom de imágenes en ActionScript 3'>Panel de zoom de imágenes en ActionScript 3</a></li>
<li><a href='http://www.codigoactionscript.org/onreleaseoutside-ondragout-ondragover-en-actionscript-3/' rel='bookmark' title='onReleaseOutside, onDragOut, onDragOver en ActionScript 3'>onReleaseOutside, onDragOut, onDragOver en ActionScript 3</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codigoactionscript.org/drag-and-drop-en-as3/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Clip que se dirija al click del mouse</title>
		<link>http://www.codigoactionscript.org/clip-que-se-dirija-al-click-del-mouse/</link>
		<comments>http://www.codigoactionscript.org/clip-que-se-dirija-al-click-del-mouse/#comments</comments>
		<pubDate>Fri, 03 Nov 2006 19:33:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Básico]]></category>
		<category><![CDATA[Efectos]]></category>

		<guid isPermaLink="false">http://www.codigo.as/blog/?p=42</guid>
		<description><![CDATA[<p>Este es un sencillo ejemplo de movimiento de clips. Consiste en mover un MovieClip hacia el punto donde hemos clicado con el mouse.</p>
<p>Para realizar este efecto utilizaremos la clase Tween, que nos permite mover un MovieClip de un punto a otro (como si de una interpolación de movimiento se tratara). Indicaremos como punto inicial la posición actualdel clip, y como posición final la posición del mouse una vez realizado el click.</p>
<p>Primero de todo crearemos el objeto detector (listener) que nos detectará los click realizados y calculará la posición actual del [...]
Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/37/' rel='bookmark' title='Movimiento de MovieClips con el teclado'>Movimiento de MovieClips con el teclado</a></li>
<li><a href='http://www.codigoactionscript.org/eventos-click-y-doble-click-en-un-boton-con-actionscript-3/' rel='bookmark' title='Eventos click y doble click en un botón con Actionscript 3'>Eventos click y doble click en un botón con Actionscript 3</a></li>
<li><a href='http://www.codigoactionscript.org/controlar-inactividad-en-una-pelicula/' rel='bookmark' title='Controlar inactividad en una pelicula'>Controlar inactividad en una pelicula</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Este es un sencillo ejemplo de movimiento de clips. Consiste en mover un MovieClip hacia el punto donde hemos clicado con el mouse.</p>
<p>Para realizar este efecto utilizaremos la clase Tween, que nos permite mover un MovieClip de un punto a otro (como si de una interpolación de movimiento se tratara). Indicaremos como punto inicial la posición actualdel clip, y como posición final la posición del mouse una vez realizado el click.</p>
<p>Primero de todo crearemos el objeto detector (listener) que nos detectará los click realizados y calculará la posición actual del clip y la posición del mouse en el momento del click. Este es el código:</p>
<div id=codigo>
<div id="codigo">
<div class="igBar"><span id="lactionscript-37"><a href="#" onclick="javascript:showPlainTxt('actionscript-37'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-37">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> raton:<span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">raton.<span style="color: #0066CC;">onMouseDown</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: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> x1:<span style="color: #0066CC;">Number</span> = bola.<span style="color: #0066CC;">_x</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> y1:<span style="color: #0066CC;">Number</span> = bola.<span style="color: #0066CC;">_y</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> x2:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">_xmouse</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> y2:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">_ymouse</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">Mouse</span>.<span style="color: #0066CC;">addListener</span><span style="color: #66cc66;">&#40;</span>raton<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></div>
<p>Ahora añadiremos dos instancias de la clase Tween para mover el clip "bola" del punto (x1,y1) al punto (x2,y2)</p>
<div id=codigo>
<div id="codigo">
<div class="igBar"><span id="lactionscript-38"><a href="#" onclick="javascript:showPlainTxt('actionscript-38'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-38">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">transitions</span>.<span style="color: #006600;">Tween</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">transitions</span>.<span style="color: #006600;">easing</span>.*;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> raton:<span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">raton.<span style="color: #0066CC;">onMouseDown</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: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> x1:<span style="color: #0066CC;">Number</span> = bola.<span style="color: #0066CC;">_x</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> y1:<span style="color: #0066CC;">Number</span> = bola.<span style="color: #0066CC;">_y</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> x2:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">_xmouse</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> y2:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">_ymouse</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> Tween<span style="color: #66cc66;">&#40;</span>bola, <span style="color: #ff0000;">"_x"</span>, Strong.<span style="color: #006600;">easeInOut</span>, x1, x2, <span style="color: #cc66cc;color:#800000;">1</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> Tween<span style="color: #66cc66;">&#40;</span>bola, <span style="color: #ff0000;">"_y"</span>, Strong.<span style="color: #006600;">easeInOut</span>, y1, y2, <span style="color: #cc66cc;color:#800000;">1</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">Mouse</span>.<span style="color: #0066CC;">addListener</span><span style="color: #66cc66;">&#40;</span>raton<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></div>
<p>Los parametros que hemos utilizado para el movimiento son "Strong.easeInOut" con lo que añadimos aceleración al principio y al final del movimiento. Y un tiempo de 1 segundo de duración.</p>
<p>Este sería el efecto:</p>
<p><embed width="400" height="200" src="http://www.cristalab.zguillez.com/Tween/01/01.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed></p>
<p>Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/37/' rel='bookmark' title='Movimiento de MovieClips con el teclado'>Movimiento de MovieClips con el teclado</a></li>
<li><a href='http://www.codigoactionscript.org/eventos-click-y-doble-click-en-un-boton-con-actionscript-3/' rel='bookmark' title='Eventos click y doble click en un botón con Actionscript 3'>Eventos click y doble click en un botón con Actionscript 3</a></li>
<li><a href='http://www.codigoactionscript.org/controlar-inactividad-en-una-pelicula/' rel='bookmark' title='Controlar inactividad en una pelicula'>Controlar inactividad en una pelicula</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codigoactionscript.org/clip-que-se-dirija-al-click-del-mouse/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Orbitar un MovieClip</title>
		<link>http://www.codigoactionscript.org/orbitar-un-movieclip/</link>
		<comments>http://www.codigoactionscript.org/orbitar-un-movieclip/#comments</comments>
		<pubDate>Fri, 20 Oct 2006 23:29:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Avanzado]]></category>
		<category><![CDATA[Efectos]]></category>

		<guid isPermaLink="false">http://www.codigo.as/blog/?p=39</guid>
		<description><![CDATA[<p>Con unas nociones básicas de trigonometría podemos conseguir este vistoso efecto:Un MovieCLip que gira alrededor de otro MovieCLip siguiendo una orbita.</p>
</p>
<p>&#160;</p>
<p></p>
<p>&#160;</p>
</p>



             function orbitar(clip1, clip2, distancia, velocidad) {   angulo = (angulo == undefined) ? 0 : angulo += velocidad;   angulo = (angulo&#62;=360) ? 0 : angulo;   anguloradianes = angulo*Math.PI/180;   clip1._x = clip2._x+Math.round(distancia*Math.cos(anguloradianes));   clip1._y = clip2._y+Math.round(distancia*Math.sin(anguloradianes));}this.onEnterFrame = function() {   orbitar(bola1, bola2, 50, 5);};      [...]
Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/como-duplicar-un-movieclip-en-actionscript-3/' rel='bookmark' title='Cómo duplicar un MovieClip en ActionScript 3'>Cómo duplicar un MovieClip en ActionScript 3</a></li>
<li><a href='http://www.codigoactionscript.org/34/' rel='bookmark' title='Foto panorámica 360º en flash'>Foto panorámica 360º en flash</a></li>
<li><a href='http://www.codigoactionscript.org/acceder-a-funciones-en-movieclips-de-peliculas-swf-externas/' rel='bookmark' title='Acceder a funciones en MovieClips de películas .swf externas'>Acceder a funciones en MovieClips de películas .swf externas</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Con unas nociones básicas de <a href="http://es.wikipedia.org/wiki/Trigonometr%C3%ADa">trigonometría </a>podemos conseguir este vistoso efecto:<br />Un <strong>MovieCLip</strong> que gira alrededor de otro <strong>MovieCLip </strong>siguiendo una orbita.</p>
</p>
<p>&nbsp;</p>
<p><embed width="150" height="150" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="http://www.cristalab.zguillez.com/Orbitar/orbitar.swf"></embed></p>
<p>&nbsp;</p>
</p>
<table class="codigo">
<tbody>
<tr>
<td>             function orbitar(clip1, clip2, distancia, velocidad) {<br />   angulo = (angulo == undefined) ? 0 : angulo += velocidad;<br />   angulo = (angulo&gt;=360) ? 0 : angulo;<br />   anguloradianes = angulo*Math.PI/180;<br />   clip1._x = clip2._x+Math.round(distancia*Math.cos(anguloradianes));<br />   clip1._y = clip2._y+Math.round(distancia*Math.sin(anguloradianes));<br />}<br />this.onEnterFrame = function() {<br />   orbitar(bola1, bola2, 50, 5);<br />};             </td>
</tr>
</tbody>
</table>
<p>La única dificultad es calcular la <strong>posición X</strong> y <strong>Y</strong> del MovieClip que orbita siguiendo el perimetro de un circulo en el que el MovieClip 2 es el centro:</p>
<p><img vspace="10" hspace="0" border="0" alt="" src="http://upload.wikimedia.org/wikipedia/es/thumb/f/fa/Triangulo.PNG/250px-Triangulo.PNG" /><br /> Para ello utilizaremos las formulas trigonométricas <strong>seno </strong>y <strong>coseno</strong>.</p>
<p>&nbsp;</p>
</p>
<p><strong>b = c * cos(&alpha;)<br />a = c * sen(&alpha;)</strong></p>
<p><strong>&nbsp;  <br /></strong></p>
<p>Las funciones trigonométricas en flash funcionan con <strong>grados radianes</strong> con lo que tendremos que transformar los <strong>grados sexagesimales</strong> (360&ordm;)</p>
<p>&nbsp;</p>
</p>
<p><strong> anguloradianes = angulo*Math.PI/180</strong>  </p>
<p>Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/como-duplicar-un-movieclip-en-actionscript-3/' rel='bookmark' title='Cómo duplicar un MovieClip en ActionScript 3'>Cómo duplicar un MovieClip en ActionScript 3</a></li>
<li><a href='http://www.codigoactionscript.org/34/' rel='bookmark' title='Foto panorámica 360º en flash'>Foto panorámica 360º en flash</a></li>
<li><a href='http://www.codigoactionscript.org/acceder-a-funciones-en-movieclips-de-peliculas-swf-externas/' rel='bookmark' title='Acceder a funciones en MovieClips de películas .swf externas'>Acceder a funciones en MovieClips de películas .swf externas</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codigoactionscript.org/orbitar-un-movieclip/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Efecto de cursor atado a un hilo (2)</title>
		<link>http://www.codigoactionscript.org/efecto-de-cursor-atado-a-un-hilo-2/</link>
		<comments>http://www.codigoactionscript.org/efecto-de-cursor-atado-a-un-hilo-2/#comments</comments>
		<pubDate>Sat, 04 Mar 2006 20:18:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Básico]]></category>
		<category><![CDATA[Efectos]]></category>
		<category><![CDATA[Tutoriales]]></category>

		<guid isPermaLink="false">http://www.codigoactionscript.org/?p=16</guid>
		<description><![CDATA[<p>Siguiendo con este efecto, ahora hay que hacer que la linea se enganche al cursor.Para eso hay que hacer que el clip que dibuja el final de la linea se coloque en la posición del mouse, para eso crearemos una funcion:</p>



function sigueMouse() {    marcaFin._x = _xmouse+10;    marcaFin._y = _ymouse+20;}



<p>Los 10 y 20 pixeles de margen son para que el clip se coloque en el final de la flecha del cursor y no en la punta.</p>
<p>El codigo que creamos para dibujar la linea tambien lo [...]
Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/efecto-de-cursor-atado-a-un-hilo-1/' rel='bookmark' title='Efecto de cursor atado a un hilo (1)'>Efecto de cursor atado a un hilo (1)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Siguiendo con <a href="http://www.codigoactionscript.org/?p=11">este efecto</a>, ahora hay que hacer que la linea se enganche al cursor.<br />Para eso hay que hacer que el clip que dibuja el final de la linea se coloque en la posición del mouse, para eso crearemos una funcion:</p>
<table class="codigo">
<tbody>
<tr>
<td>function sigueMouse() {<br />    marcaFin._x = _xmouse+10;<br />    marcaFin._y = _ymouse+20;<br />}</td>
</tr>
</tbody>
</table>
<p>Los 10 y 20 pixeles de margen son para que el clip se coloque en el final de la flecha del cursor y no en la punta.</p>
<p>El codigo que creamos para dibujar la linea tambien lo colocaremos dentro de  una funcion:</p>
<table class="codigo">
<tbody>
<tr>
<td>function dibujaLinea() {<br />    this.createEmptyMovieClip(&quot;linea&quot;, 1);<br />    linea.lineStyle(2, 0x000000, 100);<br />    linea.moveTo(marcaIni._x, marcaIni._y);<br />    linea.curveTo(marcaControl._x, marcaControl._y, marcaFin._x, marcaFin._y);<br />}</td>
</tr>
</tbody>
</table>
<p>Y ahora crearemos un onEnterFrame para que la posicion del clip y la linea se actualice constantemente:</p>
</p>
<table class="codigo">
<tbody>
<tr>
<td>onEnterFrame = function () {<br />    sigueMouse();<br />    dibujaLinea();<br />};</td>
</tr>
</tbody>
</table>
<p>El resultado es este:</p>
<p>&nbsp;</p>
</p>
<p>&nbsp;</p>
</p>
<p>&nbsp;</p>
<p><embed width="400" height="300" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="/blog/images/tutos/0001/linea002.swf"></embed></p>
<p>&nbsp;</p>
</p>
<p>&nbsp;</p>
</p>
<p>&nbsp;</p>
</p>
<p>&nbsp;</p>
<p>Ahora quedará actualizar la posición del clip que marca la curva para el efecto más real y dearle un poco de elasticidad a la linea. Eso será en otro post....</p>
<p>&nbsp;</p>
<p>Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/efecto-de-cursor-atado-a-un-hilo-1/' rel='bookmark' title='Efecto de cursor atado a un hilo (1)'>Efecto de cursor atado a un hilo (1)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codigoactionscript.org/efecto-de-cursor-atado-a-un-hilo-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Efecto de cursor atado a un hilo (1)</title>
		<link>http://www.codigoactionscript.org/efecto-de-cursor-atado-a-un-hilo-1/</link>
		<comments>http://www.codigoactionscript.org/efecto-de-cursor-atado-a-un-hilo-1/#comments</comments>
		<pubDate>Fri, 03 Mar 2006 11:44:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Básico]]></category>
		<category><![CDATA[Efectos]]></category>
		<category><![CDATA[Tutoriales]]></category>

		<guid isPermaLink="false">http://www.codigoactionscript.org/?p=11</guid>
		<description><![CDATA[<p>Voy a estrenar este blog mostrando un efecto que estoy trabajando para un proyecto.Se trata de simular que el cursor esta atado a un hilo.Lo primero es generaremos un clip falso que utilizaremos como guía para dibujar la linea. Para hacer las pruebas con un punto negro ya nos sirve</p>
<p>&#160;</p>
</p>
<p></p>
</p>
<p>&#160;</p>
<p>Crearemos tres instancias de este clip en el escenario y los les pondremos los nombres de instancia: marcaInicio, marcaFin y marcaControl</p>
<p></p>
</p>
<p></p>
</p>
<p>&#160;</p>
<p>Ahora viene el codigo que generará dinámicamente la línea.</p>
<p>Creamos un clip vacio al que llamamos linea</p>



this.createEmptyMovieClip(&#34;linea&#34;, 1);



<p>Le aplicamos un estilo</p>



linea.lineStyle(3, 0x000000, [...]
Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/efecto-de-cursor-atado-a-un-hilo-2/' rel='bookmark' title='Efecto de cursor atado a un hilo (2)'>Efecto de cursor atado a un hilo (2)</a></li>
<li><a href='http://www.codigoactionscript.org/clip-que-se-dirija-al-click-del-mouse/' rel='bookmark' title='Clip que se dirija al click del mouse'>Clip que se dirija al click del mouse</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Voy a estrenar este blog mostrando un efecto que estoy trabajando para un proyecto.<br />Se trata de simular que el cursor esta atado a un hilo.<br />Lo primero es generaremos un clip falso que utilizaremos como guía para dibujar la linea. Para hacer las pruebas con un punto negro ya nos sirve</p>
<p>&nbsp;</p>
</p>
<p><img src="/blog/images/tutos/0001/01.png" alt="" /></p>
</p>
<p>&nbsp;</p>
<p>Crearemos <strong>tres instancias</strong> de este clip en el escenario y los les pondremos los nombres de instancia: <strong>marcaInicio</strong>, <strong>marcaFin </strong>y <strong>marcaControl</strong></p>
<p><strong><br /></strong></p>
</p>
<p><img src="/blog/images/tutos/0001/02.png" alt="" /></p>
</p>
<p>&nbsp;</p>
<p>Ahora viene el codigo que generará dinámicamente la línea.</p>
<p>Creamos un clip vacio al que llamamos <strong>linea</strong></p>
<table class="codigo">
<tbody>
<tr>
<td>this.createEmptyMovieClip(&quot;linea&quot;, 1);</td>
</tr>
</tbody>
</table>
<p>Le aplicamos un estilo</p>
<table class="codigo">
<tbody>
<tr>
<td>linea.lineStyle(3, 0x000000, 100);</td>
</tr>
</tbody>
</table>
<p>Le indicamos el punto inicial de la linea, en este caso sería la posición del clip <strong>marcaInicio</strong></p>
</p>
<table class="codigo">
<tbody>
<tr>
<td>linea.moveTo(marcaInicio._x, marcaInicio._y);</td>
</tr>
</tbody>
</table>
<p>Dibujamos una linea curva de este punto al punto <strong>marcaFin</strong> utilizando como punto de curva el clip <strong>marcaControl</strong></p>
<table class="codigo">
<tbody>
<tr>
<td>linea.curveTo(marcaControl._x, marcaControl._y, marcaFin._x, marcaFin._y);</td>
</tr>
</tbody>
</table>
<p>Si reproducimos ahora la pelicula es resultado es este:</p>
</p>
<p>&nbsp;</p>
<p><img src="/blog/images/tutos/0001/03.png" alt="" /></p>
</p>
<p>&nbsp;</p>
<p>Sencillísimo, no? Bueno... mañana <a href="http://www.codigoactionscript.org/?p=16">más</a>. </p>
<p>Related posts:<ol>
<li><a href='http://www.codigoactionscript.org/efecto-de-cursor-atado-a-un-hilo-2/' rel='bookmark' title='Efecto de cursor atado a un hilo (2)'>Efecto de cursor atado a un hilo (2)</a></li>
<li><a href='http://www.codigoactionscript.org/clip-que-se-dirija-al-click-del-mouse/' rel='bookmark' title='Clip que se dirija al click del mouse'>Clip que se dirija al click del mouse</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codigoactionscript.org/efecto-de-cursor-atado-a-un-hilo-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

