<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Código Metrópoli</title>
	
	<link>http://www.codigometropoli.com</link>
	<description>Programación para Super Héroes</description>
	<pubDate>Sat, 05 Dec 2009 17:46:56 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/feedburner/ERTc" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>Componente ColorPicker</title>
		<link>http://feedproxy.google.com/~r/feedburner/ERTc/~3/RnoiCQUhyhc/</link>
		<comments>http://www.codigometropoli.com/componente-colorpicker/#comments</comments>
		<pubDate>Sun, 28 Dec 2008 22:08:17 +0000</pubDate>
		<dc:creator>Carla Macías</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<category><![CDATA[AS3]]></category>

		<category><![CDATA[ColorPicker]]></category>

		<category><![CDATA[Componentes]]></category>

		<category><![CDATA[Flash CS4]]></category>

		<guid isPermaLink="false">http://www.codigometropoli.com/?p=523</guid>
		<description><![CDATA[El componente ColorPicker (disponible a partir del Flash CS3, versión 3.0 de ActionScript), al hacer click sobre él, nos muestra un conjunto de colores de los cuales el usuario puede seleccionar uno de ellos. Con este componente podremos hacer que el usuario cambie de color un MovieClip, un texto, etc. Además, nos permite indicarle qué [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="float: right;" src="http://codigometropoli.com/images/flash_sticker.jpg" alt="Flash" width="93" height="93" />El componente <strong>ColorPicker</strong> (disponible a partir del Flash CS3, versión 3.0 de ActionScript), al hacer click sobre él, nos muestra un conjunto de colores de los cuales el usuario puede seleccionar uno de ellos. Con este componente podremos hacer que el usuario cambie de color un MovieClip, un texto, etc. Además, nos permite indicarle qué colores el usuario podrá seleccionar, ideal para cuando queremos que el objeto a cambiar de color vaya acorde a un estilo definido o a una gama de colores.<span id="more-523"></span></p>
<p>Este componente tiene las siguientes propiedades:</p>
<ul>
<li> <strong>enabled</strong>:  Valor booleano para establecer si el componente está habilitado o no.</li>
<li><strong>selectedColor</strong>: Con esta propiedad podemos establecer el color que estará seleccionado al inicio. También podemos, por medio de ActionScript, determinar el color que está seleccionad actualmente.</li>
<li><strong>showTextField</strong>: Este componente tiene por default un campo de texto donde se muestra el valor hexadecimal del color seleccionado y donde el usuario puede escribir el valor hexadecimal del color que quiere seleccionar.</li>
<li><strong>visible</strong>: Valor booleano. Si es true el componente ColorPicker se mostrará, si es false el ColorPicker no se verá.</li>
</ul>
<p>Para conocer todos los métodos, propiedades y eventos que conforman la clase <strong>ColorPicker</strong>, ingresa a la siguiente <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl/controls/ColorPicker.html" target="_blank">página</a>.</p>
<h4><span style="color: #ff0000;"><strong>Tutorial</strong></span></h4>
<p>En este tutorial mostraremos tres ejemplos prácticos del uso del <strong>ColorPicker</strong>. En el primero cambiaremos el color de un rectángulo usando el <strong>ColorPicker</strong>. En el segundo, rellenaremos un rectángulo con degradado (dos colores) utilizando la función <em>beginGradientFill</em>; los colores pasados como parámetros a esta función serán obtenidos de dos componentes <strong>ColorPicker</strong>. Además, por medio de un <strong>Slider</strong>, el usuario podrá cambiar la rotación del degradado. En el último, cambiaremos el color de un texto dinámico.</p>
<p>Para este tutorial usaremos el Flash CS4. Abre el programa y crea un nuevo documento de Flash.<br />
En el panel <strong>Components</strong> (Ctrl + F7), dentro de la sección <strong>User Interface</strong>, busca el componente <strong>ColorPicker</strong> y arrastra tres de ellos al área de trabajo. Selecciona el primer <strong>ColorPicker</strong> que tienes en el área de trabajo y dentro del panel <strong>Properties</strong> asígnale el nombre de instancia de <em>picker1</em>. A los otros componentes asígnales como nombre de instancia <em>picker2</em> y <em>picker3</em>, respectivamente. Dentro del mismo panel de <strong>Components</strong> -&gt; <strong>User Interface</strong> selecciona un componente <strong>Slider</strong> y arrástralo al área de trabajo. Ponle como nombre de instancia <em>slider</em>. Además, crea dos textos dinámicos con nombres de instancia <em>color_txt</em> y <em>texto_txt</em>.</p>
<p>Ordena los componentes de tu área de trabajo, de tal forma que te quede como en la siguiente imagen:</p>
<div align="center"><div class="wp-caption aligncenter" style="width: 344px"><a href="http://codigometropoli.com/images/screens/colorpicker_1.jpg" target="_blank"><img title="Componente ColorPicker" src="http://codigometropoli.com/images/previews/colorpicker_1.jpg" alt="Nota: El orden de los ColorPicker(s) va de arriba hacia abajo y de izquierda a derecha,  de tal forma que el ColorPicker de hasta arriba es picker1.  El texto dinámico que está más arriba es color_txt y el texto dinámico de abajo es texto_txt. " width="334" height="243" /></a><p class="wp-caption-text">Nota: El orden de los ColorPicker(s) va de arriba hacia abajo y de izquierda a derecha,  de tal forma que el ColorPicker de hasta arriba es picker1.  El texto dinámico que está más arriba es color_txt y el texto dinámico de abajo es texto_txt. </p></div></div>
<p>Es momento de pasar al código de nuestra aplicación. Renombra la capa donde se encuentran nuestros componentes (generalmente <em>Layer 1</em>) y ponle de nombre <em>Componentes</em>. Agrega una capa con el nombre de <em>Acciones</em>, dentro de esta capa estará todo nuestro código. A continuación explicaré parte por parte el código; recuerda bajar el archivo del tutorial, el cual se encuentra al final de este post.</p>
<p>En nuestra aplicación necesitaremos detectar cuando el usuario seleccionó otro color en alguno de los <strong>ColorPicker</strong>, o bien cuando desplazó la barra del <strong>Slider</strong>. Para lo anterior es necesario importar las librerías <em>ColorPickerEvent</em> y <em>SliderEvent</em>.</p>
<div class="igBar"><span id="lactionscript-21"><a href="#" onclick="javascript:showPlainTxt('actionscript-21'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-21">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> fl.<span style="color: #006600;">events</span>.<span style="color: #006600;">ColorPickerEvent</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> fl.<span style="color: #006600;">events</span>.<span style="color: #006600;">SliderEvent</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Para que podamos pintar con degradado el segundo rectángulo de nuestro ejercicio, haremos uso de las librerías <em>geom</em> y <em>display</em>. Del primero usaremos la clase <strong>Matrix</strong>; para el segundo usaremos la clase <strong>Graphics</strong>.</p>
<div class="igBar"><span id="lactionscript-22"><a href="#" onclick="javascript:showPlainTxt('actionscript-22'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-22">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">geom</span>.<span style="color: #006600;">Matrix</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Graphics</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Además, declararemos una variable llamada <em>radianes</em>, en la cual guardaremos el valor de la rotación del degradado. Para este valor debemos usar radianes y no grados, por lo que ten en cuenta que 1° = PI radianes / 180 (profundizaremos sobre este tema más adelante). Por default, el valor de esta variable será cero.</p>
<div class="igBar"><span id="lactionscript-23"><a href="#" onclick="javascript:showPlainTxt('actionscript-23'); return false;">Texto Plano</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> radianes:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><span style="color: #c00000;"><strong>Primer ejercicio</strong></span></p>
<p>Ahora veremos el código de nuestro primer ejercicio. Primero crearemos un MovieClip llamado cuadrado; el color de inicio de este cuadrado será el negro (0x000000), el cual lo pasaremos como parámetro a nuestra función <em>dibujaCuadrado</em> (del cual mostraré su código más adelante). Además, le asignamos el texto “0x000000” a nuestro campo dinámico <em>color_txt</em> y llamamos la función <em>addChild</em> para agregar el MovieClip al contenedor y visualizarlo.</p>
<div class="igBar"><span id="lactionscript-24"><a href="#" onclick="javascript:showPlainTxt('actionscript-24'); return false;">Texto Plano</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> cuadrado:<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-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">dibujaCuadrado<span style="color: #66cc66;">&#40;</span>cuadrado, 0x000000<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">color_txt.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">"#000000"</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">addChild<span style="color: #66cc66;">&#40;</span>cuadrado<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>A continuación veremos el código de la función <em>dibujaCuadrado</em>:</p>
<div class="igBar"><span id="lactionscript-25"><a href="#" onclick="javascript:showPlainTxt('actionscript-25'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-25">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> dibujaCuadrado<span style="color: #66cc66;">&#40;</span>clipo:<span style="color: #0066CC;">MovieClip</span>, <span style="color: #0066CC;">color</span>:uint<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; clipo.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">color</span>, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; clipo.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">150</span>, <span style="color: #cc66cc;color:#800000;">59</span>, <span style="color: #cc66cc;color:#800000;">75</span>, <span style="color: #cc66cc;color:#800000;">75</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; clipo.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>En el código anterior, la función <em>dibujaCuadrado</em> recibe como parámetro el MovieClip donde queremos dibujar el cuadrado y color de relleno de éste. El tipo de dato del color es <em>uint</em> (unsigned integer – entero sin signo), este tipo de dato es utilizado en gran medida para el valor de los colores, ya que su máximo valor es el doble que el del tipo de dato <em>int</em>. Para conocer más sobre uint visita esta <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/uint.html" target="_blank">página</a>.</p>
<p>La primera línea de código de la función <em>dibujaCuadrado</em> establece el color de llenado del cuadrado por medio de la función <em>beginFill</em>. Esta función recibe como primer parámetro el color de relleno y como segundo parámetro el valor del alfa (transparencia). Recuerda que desde el AS3, los valores de alfa van de 0 a 1 y no de 0 a 100.<br />
La segunda línea dibuja el cuadrado en la coordenada x = 100 y y = 150, y con un ancho (width) y alto (height) de 75 pixeles, usando la función <em>drawRect</em>.<br />
La última línea se encarga de aplicar el relleno al MovieClip.</p>
<p>Si corres la aplicación con lo que llevamos ahorita, verás que aparece un cuadrado de color negro del lado izquierdo del primer <strong>ColorPicker</strong>. Sin embargo, si haces click en picker1 y seleccionas un color verás que no cambia el color del cuadrado. Esto es porque no hemos ligado los eventos del <strong>ColorPicker</strong> al color del cuadrado, para lograrlo estableceremos dos listeners, uno sobre el evento <strong>ITEM_ROLL_OVER</strong> y otro sobre el evento <strong>CHANGE</strong>. El evento ITEM_ROLL_OVER es accionado cuando el usuario se posiciona sobre cualquier color de la paleta de color (valga la redundancia) del ColorPicker. Este evento lo usaremos debido a que en nuestra aplicación queremos mostrar el cambio de color sobre el MovieClip en el momento de posicionarnos en algún color y no al tener que hacerle click. El evento CHANGE es accionado cuando el usuario hace click sobre un color; utilizaremos este evento para mostrar el valor del color seleccionado en el texto dinámico <em>color_txt</em>.</p>
<div class="igBar"><span id="lactionscript-26"><a href="#" onclick="javascript:showPlainTxt('actionscript-26'); return false;">Texto Plano</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">picker1.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ColorPickerEvent.<span style="color: #006600;">ITEM_ROLL_OVER</span>, overHandler<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">picker1.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ColorPickerEvent.<span style="color: #006600;">CHANGE</span>, changeHandler<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p> </p>
<p>Al producirse el evento ITEM_ROLL_OVER, se llamará a la función <em>overHandler</em>.<br />
Al producirse el evento CHANGE, se llamára a la función <em>changeHandler</em>.<br />
A continuación, veremos el código de estas dos funciones:</p>
<div class="igBar"><span id="lactionscript-27"><a href="#" onclick="javascript:showPlainTxt('actionscript-27'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-27">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> overHandler<span style="color: #66cc66;">&#40;</span>event:ColorPickerEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> numero:uint = event.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">selectedColor</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;dibujaCuadrado<span style="color: #66cc66;">&#40;</span>cuadrado, numero<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:#2C442A;">
<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> changeHandler<span style="color: #66cc66;">&#40;</span>event:ColorPickerEvent<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:#2C442A;">
<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> numero:uint = event.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">selectedColor</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">color</span>:<span style="color: #0066CC;">String</span> = event.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">hexValue</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; color_txt.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">"#"</span> + <span style="color: #0066CC;">color</span>.<span style="color: #0066CC;">toUpperCase</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dibujaCuadrado<span style="color: #66cc66;">&#40;</span>cuadrado, numero<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>No olvides que, por tratarse de eventos, estas dos funciones reciben como parámetro el evento generado.<br />
En la función <em>overHandler</em>, obtenemos el color seleccionado del componente que generó el evento (en este caso, picker1). Ese color lo almacenamos en una variable local llamada <em>numero</em> la cual es de tipo <em>uint</em>. Después, llamamos a la función <em>dibujaCuadrado</em> (cuyo código lo vimos más arriba) pasándole como parámetro el MovieClip del cuadrado y el color seleccionado.<br />
En la función <em>changeHandler</em>, al igual que en la función anterior, obtenemos el color seleccionado del componente que generó el evento (picker1). En esta función, además de guardar el valor del color seleccionado en formato <em>uint</em>, obtenemos el valor hexadecimal del color seleccionado para mostrarlo en nuestro campo dinámico <em>color_txt</em> (para el usuario es más fácil hacer uso del valor hexadecimal de un color que su valor <em>uint</em>). Posteriormente hacemos la llamada a la función <em>dibujaCuadrado</em>.</p>
<p>Si corres la aplicación verás que al posicionarte encima de un color de la gama de picker1, el MovieClip del cuadrado cambia de color. Además, si seleccionas alguno de los colores, el texto dinámico <em>color_txt</em> muestra el valor del color seleccionado.</p>
<p><span style="color: #c00000;"><strong>Segundo ejercicio</strong></span></p>
<p>Como lo comenté más arriba, en este segundo ejercicio veremos cómo aplicar un degradado a otro MovieClip cuadrado. Este degradado estará formado por dos colores, los cuales serán obtenidos de los ColorPicker <em>picker2</em> y <em>picker3</em>. Primero estableceremos el color por default (el cual estará seleccionado desde un inicio) del <em>picker2</em> y <em>picker3</em>.</p>
<div class="igBar"><span id="lactionscript-28"><a href="#" onclick="javascript:showPlainTxt('actionscript-28'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-28">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">picker2.<span style="color: #006600;">selectedColor</span> = 0x0000CC;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">picker3.<span style="color: #006600;">selectedColor</span> = 0x66FF00; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Para este ejercicio vamos a crear otro MovieClip en el cual dibujaremos un cuadrado. El MovieClip se llamará <em>cuadraodDeg</em>:</p>
<div class="igBar"><span id="lactionscript-29"><a href="#" onclick="javascript:showPlainTxt('actionscript-29'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-29">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> cuadradoDeg:<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-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">dibujaCuadradoDegradado<span style="color: #66cc66;">&#40;</span>cuadradoDeg, 0x0000CC, 0x66FF00<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">addChild<span style="color: #66cc66;">&#40;</span>cuadradoDeg<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Hasta ahora, el único cambio es que mandamos a llamar la función <em>dibujaCuadradoDegradado</em>, la cual recibirá la referencia del MovieClip y los dos colores que formarán el degradado.</p>
<p>El código de la función <em>dibujaCuadradroDegradado</em> es el siguiente:</p>
<div class="igBar"><span id="lactionscript-30"><a href="#" onclick="javascript:showPlainTxt('actionscript-30'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-30">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> dibujaCuadradoDegradado<span style="color: #66cc66;">&#40;</span>clipo:<span style="color: #0066CC;">MovieClip</span>, color1:uint, color2:uint<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> matriz:Matrix = <span style="color: #000000; font-weight: bold;">new</span> Matrix<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; matriz.<span style="color: #006600;">createGradientBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">80</span>, <span style="color: #cc66cc;color:#800000;">80</span>, radianes, <span style="color: #cc66cc;color:#800000;">150</span>, <span style="color: #cc66cc;color:#800000;">165</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; clipo.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginGradientFill</span><span style="color: #66cc66;">&#40;</span>GradientType.<span style="color: #006600;">LINEAR</span>, <span style="color: #66cc66;">&#91;</span>color1, color2<span style="color: #66cc66;">&#93;</span>, <span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span>, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span>, <span style="color: #cc66cc;color:#800000;">255</span><span style="color: #66cc66;">&#93;</span>, matriz, SpreadMethod.<span style="color: #006600;">PAD</span>, InterpolationMethod.<span style="color: #006600;">LINEAR_RGB</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; clipo.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">150</span>, <span style="color: #cc66cc;color:#800000;">165</span>, <span style="color: #cc66cc;color:#800000;">80</span>, <span style="color: #cc66cc;color:#800000;">80</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; clipo.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Para crear el degradado necesitamos la función <em>createGradientBox</em>, la cual recibe cómo parámetros el ancho y alto del degradado, el valor de rotación del degradado (en radianes) y la distancia en pixeles para trasladar el degradado hacia la izquierda (tx) y hacia abajo (ty). Esta función pertenece a la clase <strong>Matrix</strong>,  por lo tanto declaramos la variable <em>matriz</em> para usar la función.</p>
<p>Posteriormente hacemos uso de la función <em>beginGradientFill</em>. Esta función recibe los siguientes parámetros:</p>
<ul>
<li><strong>type</strong>: Especifica el tipo de degradado que se va a utilizar (lineal o radial). GradientType.LINEAR, GradientType.RADIAL.</li>
<li><strong>colors</strong>: Arreglo con el valor de los colores que formarán parte del degradado.</li>
<li><strong>alphas</strong>: Arreglo con los valores del alfa (transparencia) de cada uno de los colores del parámetro anterior. El valor del alfa va de 0 a 1.</li>
<li><strong>ratios</strong>: Arreglo con los valores de la proporción de distribución. Este valor define el porcentaje del ancho (width) donde el color se muestra al 100%. El valor puede ir de 0 a 255, donde el 0 representa la posición de hasta la izquierda y 255 representa la posición de hasta la derecha de la caja del degradado.</li>
<li><strong>matrix</strong>: La variable de la clase Matrix que definimos con anterioridad y con la cual utilizamos el método <em>createGradientBox</em>.</li>
<li><strong>spreadMethod</strong>: Especifica el método de propagación (spread) a utilizar. Este valor puede ser PAD (rellenar), REFLECT (reflejo) y REPEAT (repite el degradado a lo ancho de la caja).</li>
<li><strong>interpolationMethod</strong>: Método de interpolación. Su valor puede ser linearRGB y RGB.</li>
</ul>
<p>Por último dibujamos nuestro cuadrado y usamos el método <em>endFill</em> para aplicar el relleno.<br />
Al igual que en el ejercicio anterior, debemos establecer listeners para el <em>picker2</em> y <em>picker3</em>. Estos listeners se ejecutarán cuando se presente el evento CHANGE en los ColorPicker y llamarán a la función <em>cambiaDegradado</em>.</p>
<div class="igBar"><span id="lactionscript-31"><a href="#" onclick="javascript:showPlainTxt('actionscript-31'); return false;">Texto Plano</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">picker2.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ColorPickerEvent.<span style="color: #006600;">CHANGE</span>, cambiaDegradado<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">picker3.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ColorPickerEvent.<span style="color: #006600;">CHANGE</span>, cambiaDegradado<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>La función <em>cambiaDegradado</em> llamará a su vez a la función <em>dibujaCuadradoDegradado</em>, cuyos parámetros son el MovieClip al cual se le aplicará el degradado y los colores seleccionados del <em>picker1</em> y <em>picker2</em>.</p>
<div class="igBar"><span id="lactionscript-32"><a href="#" onclick="javascript:showPlainTxt('actionscript-32'); return false;">Texto Plano</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> cambiaDegradado<span style="color: #66cc66;">&#40;</span>event:ColorPickerEvent<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dibujaCuadradoDegradado<span style="color: #66cc66;">&#40;</span>cuadradoDeg, picker2.<span style="color: #006600;">selectedColor</span>, picker3.<span style="color: #006600;">selectedColor</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Si corres la aplicación verás que aparece un cuadrado con degradado azul y verde. Si seleccionas otro color de cualquiera de los <strong>ColorPicker</strong> <em>picker2</em> y <em>picker3</em>, el degradado cambiará. Ahora solo nos falta programar la función del <strong>Slider</strong> <em>slider</em> para cambiar la rotación del degradado. A este slider le agregaremos un listener cuando se ejecute el evento THUMB_DRAG, es decir, cuando el slider es presionado y movido por el mouse.</p>
<div class="igBar"><span id="lactionscript-33"><a href="#" onclick="javascript:showPlainTxt('actionscript-33'); return false;">Texto Plano</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">slider.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>SliderEvent.<span style="color: #006600;">THUMB_DRAG</span>, cambiarRotacion<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Selecciona el componente <strong>Slider</strong> que está en tu área de trabajo y en el Inspector de Componentes (Shift + F7) ponle las siguientes propiedades:</p>
<div align="center"><div class="wp-caption aligncenter" style="width: 294px"><img title="Componente ColorPicker" src="http://codigometropoli.com/images/screens/inspector_de_componentes.jpg" alt="Inspector de Componentes del Slider" width="284" height="325" /></a><p class="wp-caption-text">Inspector de Componentes del Slider </p></div></div>
<p>De la imagen anterior se observa que el valor mínimo del Slider será 0 mientras que el máximo es de 180. Esto es porque queremos que el rango del valor de rotación sea de 0° a 180°. En el momento en que nosotros obtenemos el valor del Slider (cuando se ejecuta el listener) debemos cambiar el valor de grados a radianes, por medio de la fórmula (Math.PI / 180) * grados.</p>
<div class="igBar"><span id="lactionscript-34"><a href="#" onclick="javascript:showPlainTxt('actionscript-34'); return false;">Texto Plano</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> cambiarRotacion<span style="color: #66cc66;">&#40;</span>event:SliderEvent<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> grados:<span style="color: #0066CC;">Number</span> = event.<span style="color: #006600;">value</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> rads:<span style="color: #0066CC;">Number</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> / <span style="color: #cc66cc;color:#800000;">180</span><span style="color: #66cc66;">&#41;</span> * grados;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; radianes = rads;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dibujaCuadradoDegradado<span style="color: #66cc66;">&#40;</span>cuadradoDeg, picker2.<span style="color: #006600;">selectedColor</span>, picker3.<span style="color: #006600;">selectedColor</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>La última línea de la función <em>cambiarRotacion</em> llama a la función <em>dibujaCuadradoDegradado</em>, la cual al ser llamada utilizará el nuevo valor de la variable radianes.</p>
<p><span style="color: #c00000;"><strong>Tercer ejercicio</strong></span></p>
<p>En este tercer ejercicio cambiaremos el color de un texto dinámico de acuerdo al color seleccionado del ColorPicker <em>picker4</em>. Además, estableceremos el arreglo de colores que queremos mostrar en el <em>picker4</em>.<br />
Primero vamos a ocultar el campo de texto del <em>picker4</em> para evitar que el usuario introduzca el valor de un color distinto a los mostrados en el arreglo:</p>
<div class="igBar"><span id="lactionscript-35"><a href="#" onclick="javascript:showPlainTxt('actionscript-35'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-35">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">picker4.<span style="color: #006600;">showTextField</span> = <span style="color: #000000; font-weight: bold;">false</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Para establecer los colores a mostrar dentro de este componente utilizamos la propiedad <em>colors</em>, la cual recibe un arreglo de colores:</p>
<div class="igBar"><span id="lactionscript-36"><a href="#" onclick="javascript:showPlainTxt('actionscript-36'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-36">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">picker4.<span style="color: #006600;">colors</span> = <span style="color: #66cc66;">&#91;</span>0xFFFFFF, 0x004070, 0x4b8cdb, 0xa1c8f7, 0x6fb543,</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;0xddb0cf, 0xf8ccd5, 0xffe8a1, 0xfdd382, 0xf2ec87,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;0x307ec7, 0x57a3de, 0xcbe8f5, 0x4781b3, 0x1c5485<span style="color: #66cc66;">&#93;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ahora establecemos el número de colores que queremos mostrar por fila, es decir, la cantidad de columnas de colores a mostrar dentro del ColorPicker. En nuestro caso queremos que sea de 5 en 5.</p>
<div class="igBar"><span id="lactionscript-37"><a href="#" onclick="javascript:showPlainTxt('actionscript-37'); return false;">Texto Plano</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">picker4.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"columnCount"</span>, <span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>El color por default de nuestro texto dinámico será negro, por lo tanto seleccionamos el color negro en el <strong>picker4</strong>.</p>
<div class="igBar"><span id="lactionscript-38"><a href="#" onclick="javascript:showPlainTxt('actionscript-38'); return false;">Texto Plano</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">picker4.<span style="color: #006600;">selectedColor</span> = 0x000000; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Para poderle cambiar el color a un texto dinámico, debemos crear una variable de tipo <strong>TextFormat</strong>. Recuerda que el nombre de instancia de nuestro texto dinámico es <em>texto_txt</em>, y para aplicarle el formato debemos utilizar el método <em>setTextFormat</em>.</p>
<div class="igBar"><span id="lactionscript-39"><a href="#" onclick="javascript:showPlainTxt('actionscript-39'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-39">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> formato:<span style="color: #0066CC;">TextFormat</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextFormat</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">formato.<span style="color: #0066CC;">bold</span> = <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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">formato.<span style="color: #0066CC;">color</span> = 0x000000;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">formato.<span style="color: #0066CC;">size</span> = <span style="color: #cc66cc;color:#800000;">16</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">formato.<span style="color: #0066CC;">font</span> = <span style="color: #ff0000;">"Arial"</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">texto_txt.<span style="color: #0066CC;">setTextFormat</span><span style="color: #66cc66;">&#40;</span>formato<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Por último solo nos queda añadirle un listener al <em>picker4</em> y establecer la función que cambiará el color:</p>
<div class="igBar"><span id="lactionscript-40"><a href="#" onclick="javascript:showPlainTxt('actionscript-40'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-40">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">picker4.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ColorPickerEvent.<span style="color: #006600;">CHANGE</span>, cambiaTexto<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> cambiaTexto<span style="color: #66cc66;">&#40;</span>event:ColorPickerEvent<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; formato.<span style="color: #0066CC;">color</span> = picker4.<span style="color: #006600;">selectedColor</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; texto_txt.<span style="color: #0066CC;">setTextFormat</span><span style="color: #66cc66;">&#40;</span>formato<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div align="center" style="margin-top:0px"><script type="text/javascript"><!--
      google_ad_client = "pub-5808310808246221";
      /* 250x250, Posts */
      google_ad_slot = "8254875600";
      google_ad_width = 250;
      google_ad_height = 250;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></div>
<div align="center" style="margin-top:30px; margin-bottom:10px;">
<object type="application/x-shockwave-flash" width="550" height="400">
<param name="movie" value=" http://codigometropoli.com/wp-content/uploads/2008/12/componente_colorpicker.swf" />
<embed src=" http://codigometropoli.com/wp-content/uploads/2008/12/componente_colorpicker.swf" type="application/x-shockwave-flash" width="550" height="400" >
</object>
</div>
<div align="center" style="margin-top:10px; margin-bottom:20px;">
<table border="0" cellspacing="0" cellpadding="0" width="180">
<tbody>
<tr>
<td valign="top"><a href="http://codigometropoli.com/wp-content/uploads/descarga.php?file=2008/12/componente_colorpicker.fla"><img src="../images/descargar_archivo.jpg" alt="Descargar Archivo" /></a></td>
</tr>
</tbody>
</table>
</div>
<div style="margin-top:40px; margin-bottom:30px;">
<strong>Enlaces recomendados:</strong><br />
» <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/geom/Matrix.html" target="_blank">Clase Matrix</a><br />
» <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/geom/Matrix.html#createGradientBox()" target="_blank">Función createGradientBox</a><br />
» <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Graphics.html#beginGradientFill()" target="_blank">Función beginGradientFill</a><br />
» <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl/controls/Slider.html" target="_blank">Clase Slider</a></div>

<p><a href="http://feedads.g.doubleclick.net/~a/09wI5_xJSfIkbuneo85fX_Cptys/0/da"><img src="http://feedads.g.doubleclick.net/~a/09wI5_xJSfIkbuneo85fX_Cptys/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/09wI5_xJSfIkbuneo85fX_Cptys/1/da"><img src="http://feedads.g.doubleclick.net/~a/09wI5_xJSfIkbuneo85fX_Cptys/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/feedburner/ERTc/~4/RnoiCQUhyhc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codigometropoli.com/componente-colorpicker/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.codigometropoli.com/componente-colorpicker/</feedburner:origLink></item>
		<item>
		<title>Componente DateField</title>
		<link>http://feedproxy.google.com/~r/feedburner/ERTc/~3/FIxuf5IqdKo/</link>
		<comments>http://www.codigometropoli.com/componente-datefield/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 04:31:55 +0000</pubDate>
		<dc:creator>Carla Macías</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Componentes]]></category>

		<category><![CDATA[DateField]]></category>

		<guid isPermaLink="false">http://www.codigometropoli.com/?p=507</guid>
		<description><![CDATA[El componente DateField permite que el usuario de nuestra aplicación seleccione una fecha dentro de un calendario que es mostrado cuando se hace click en este componente. La ventaja principal del DateField es que el usuario nunca ingresará una fecha incorrecta (por ejemplo 21 de marzo); además de que podemos establecer un rango de fechas [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="float: right;" src="http://codigometropoli.com/images/flash_sticker.jpg" alt="Flash" width="93" height="93" />El componente DateField permite que el usuario de nuestra aplicación seleccione una fecha dentro de un calendario que es mostrado cuando se hace click en este componente. La ventaja principal del DateField es que el usuario nunca ingresará una fecha incorrecta (por ejemplo 21 de marzo); además de que podemos establecer un rango de fechas dentro de las cuales el usuario puede hacer su elección, o bien deshabilitar fechas.<span id="more-507"></span></p>
<p>Este componente tiene los siguientes parámetros:</p>
<ul>
<li><strong>dayNames</strong>:  Arreglo con los nombres de los días de la semana. Por default y por los nombres en ingles, el valor es [S, M, T, W, T, F, S]</li>
<li><strong>disableDays</strong>: Arreglo con los días de la semana que queremos que aparezcan deshabilitados. Ej. Sábados y Domingos ([0,6])</li>
<li><strong>firstDayOfWeek</strong>: Día de comienzo de la semana. El valor por default es cero y eso significa que el primer día de la semana será el domingo. En caso de querer establecer el lunes como el primer día de la semana, cambia el valor por 1.</li>
<li><strong>monthNames</strong>: Nombre de los meses. Por default los nombres de los meses están en inglés, sin embargo en esta parte los podemos poner en español.</li>
<li><strong>showToday</strong>: Variable booleana para establecer si deseamos señalar el día de hoy en el calendario. Por default el valor es <em>true</em>.</li>
</ul>
<p>Para conocer todos los métodos, propiedades y eventos que conforman la clase DateField, ingresa a la siguiente <a href="http://livedocs.adobe.com/flash/8/main/00003411.html" target="_blank">página</a>.</p>
<p><span style="color: #560e00; text-decoration: underline;"><strong>Tutorial</strong></span></p>
<p>Para este tutorial usaremos el Flash 8. Abre el programa y crea un nuevo documento de Flash.<br />
En el panel <strong>Components </strong>(Ctrl + F7), dentro de la sección <strong>User Interface</strong>, busca el componente <strong>DateField</strong> y arrástralo al área de trabajo. Selecciona el <strong>DateField</strong> que tienes en el área de trabajo y dentro del panel <strong>Properties</strong> asígnale el nombre de instancia de <em>fecha</em>. Dentro del mismo panel de <strong>Components </strong>-&gt; <strong>User Interface</strong> selecciona un componente <strong>Button</strong> y arrástralo al área de trabajo. Ponle como nombre de instancia <em>mostrar_btn</em> y como <em>label</em> “Mostrar fecha”.</p>
<p>Renombra la capa donde se encuentran estos componentes (generalmente Layer 1) y ponle de nombre <em>Componentes</em>. Agrega una capa con el nombre de Acciones y dentro de esta capa pega  el siguiente código:</p>
<div class="igBar"><span id="lactionscript-47"><a href="#" onclick="javascript:showPlainTxt('actionscript-47'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-47">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mostrar_btn.<span style="color: #0066CC;">onRelease</span> = <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Fecha Seleccionada: "</span> + fecha.<span style="color: #006600;">selectedDate</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Lo que hace el código anterior es mostrar en el panel <strong>Output</strong> el valor de la fecha seleccionada. Si el usuario no seleccionó alguna fecha, el mensaje mostrará el valor de <strong>undefined</strong>. Observa que de esta forma es fácil validar si el usuario seleccionó una fecha, de la siguiente forma:</p>
<div class="igBar"><span id="lactionscript-48"><a href="#" onclick="javascript:showPlainTxt('actionscript-48'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-48">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>fecha.<span style="color: #006600;">selectedDate</span> == <span style="color: #0066CC;">undefined</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"El usuario no seleccionó fecha"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p> </p>
<p>Cuando el usuario selecciona una fecha, el valor de esa fecha seleccionada es mostrado dentro del rectángulo del <strong>DateField</strong>. Haz la prueba y verás que el campo de la fecha te despliega un valor similar al mostrado en la siguiente imagen:</p>
<div align="center" style="margin-bottom:10px;"><img title="Imagen 1: DateField - Fecha seleccionada" src="http://www.codigometropoli.com/images/screens/datefield_flash.jpg" alt="Imagen 1: DateField - Fecha seleccionada" width="174" height="36" /></div>
<p>Si haces click en el botón de <em>Mostrar fecha</em>, el valor obtenido por la propiedad <strong>selectedDate</strong> será: Wed Dec 3 00:00:00 GMT-0600 2008. Es posible que en estos momentos te preguntes de qué le sirve al usuario mostrarle la fecha en ese formato si lo más seguro es que tu usuario final hable español; o peor aún ¿de qué te sirve el formato regresado por la propiedad <strong>selectedDate</strong> si lo que quieres es guardar el valor en una columna de tipo Date de una base de datos?</p>
<p><span style="color: #c00000;"><strong>Cambiar el formato de la fecha mostrada en el DateField</strong></span></p>
<p>Para cambiar el formato de la fecha bastará con hacer uso de la propiedad <strong>dateFormatter</strong>. A esta propiedad hay que establecerle la función o método que se encargará de regresar la fecha en el formato especificado. Supongamos que queremos que la fecha se muestre como 03/12/2008, para eso tendríamos que añadir el siguiente código:</p>
<div class="igBar"><span id="lactionscript-49"><a href="#" onclick="javascript:showPlainTxt('actionscript-49'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-49">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fecha.<span style="color: #006600;">dateFormatter</span> = <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>fecha_sel:<span style="color: #0066CC;">Date</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> dia:<span style="color: #0066CC;">String</span> = fecha_sel.<span style="color: #0066CC;">getDate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> &lt;<span style="color: #cc66cc;color:#800000;">10</span> ? <span style="color: #ff0000;">"0"</span> +&nbsp; fecha_sel.<span style="color: #0066CC;">getDate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> :&nbsp; fecha_sel.<span style="color: #0066CC;">getDate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> mes:<span style="color: #0066CC;">String</span> = <span style="color: #66cc66;">&#40;</span>fecha_sel.<span style="color: #0066CC;">getMonth</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span> &lt;<span style="color: #cc66cc;color:#800000;">10</span> ? <span style="color: #ff0000;">"0"</span> +&nbsp; <span style="color: #66cc66;">&#40;</span>fecha_sel.<span style="color: #0066CC;">getMonth</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span> :&nbsp; <span style="color: #66cc66;">&#40;</span>fecha_sel.<span style="color: #0066CC;">getMonth</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #cc66cc;color:#800000;">1</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> dia + <span style="color: #ff0000;">"/"</span> + mes + <span style="color: #ff0000;">"/"</span> + fecha_sel.<span style="color: #0066CC;">getFullYear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Esta función recibe cómo parámetro la fecha seleccionada por el usuario. De esa fecha podemos obtener el día usando la función <strong>getDate()</strong>; esta función nos regresa un valor de 1 a 31. Para obtener el número de mes de la fecha seleccionada usamos la función <strong>getMonth()</strong>; esta función nos regresa un valor de 0 a 11 donde el 0 equivale al mes de Enero y 11 al mes de Diciembre. La función <strong>getFullYear()</strong> nos regresará el valor del año seleccionado con el formato completo (es decir, de cuatro dígitos. Ej. 2005).<br />
En nuestro ejemplo queremos que el mes y el día tengan dos dígitos, es por eso que en nuestro código verificamos si el número de día o mes es menor que 10, si es así le agregamos un cero al inicio.<br />
Dentro de la función anterior podemos actualizar el valor de una variable global para guardar la fecha en el formato que deseemos de acuerdo a la base de datos que utilicemos o a nuestras necesidades. Por ejemplo, suponiendo que la fecha la tenemos que almacenar de la forma 2008-12-03, podremos considerar el siguiente código:</p>
<div class="igBar"><span id="lactionscript-50"><a href="#" onclick="javascript:showPlainTxt('actionscript-50'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-50">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> fecha_seleccionada:<span style="color: #0066CC;">String</span> = “”;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fecha.<span style="color: #006600;">dateFormatter</span> = <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>fecha_sel:<span style="color: #0066CC;">Date</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:#2C442A;">
<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> dia:<span style="color: #0066CC;">String</span> = fecha_sel.<span style="color: #0066CC;">getDate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> &lt;<span style="color: #cc66cc;color:#800000;">10</span> ? <span style="color: #ff0000;">"0"</span> +&nbsp; fecha_sel.<span style="color: #0066CC;">getDate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> :&nbsp; fecha_sel.<span style="color: #0066CC;">getDate</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> mes:<span style="color: #0066CC;">String</span> = <span style="color: #66cc66;">&#40;</span>fecha_sel.<span style="color: #0066CC;">getMonth</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span> &lt;<span style="color: #cc66cc;color:#800000;">10</span> ? <span style="color: #ff0000;">"0"</span> +&nbsp; <span style="color: #66cc66;">&#40;</span>fecha_sel.<span style="color: #0066CC;">getMonth</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span> :&nbsp; <span style="color: #66cc66;">&#40;</span>fecha_sel.<span style="color: #0066CC;">getMonth</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; fecha_seleccionada = fecha_sel.<span style="color: #0066CC;">getFullYear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> + “-“ + mes + “-“ + dia;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> dia + <span style="color: #ff0000;">"/"</span> + mes + <span style="color: #ff0000;">"/"</span> + fecha_sel.<span style="color: #0066CC;">getFullYear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><span style="color: #c00000;"><strong>Deshabilitar días de la semana en el componente DateField</strong></span></p>
<p>Como lo dije al inicio del tutorial, la propiedad <em>disabledDays</em> nos permite especificar por medio de un arreglo qué días de la semana queremos que aparezcan deshabilitados. Supongamos que queremos realizar una aplicación estilo agenda para anotar nuestras juntas de trabajo. Para evitar equivocarnos, al momento de realizar la selección de fecha, y establecer una junta de trabajo un sábado o domingo, podemos deshabilitar estos días de la siguiente manera:</p>
<div class="igBar"><span id="lactionscript-51"><a href="#" onclick="javascript:showPlainTxt('actionscript-51'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-51">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fecha.<span style="color: #006600;">disabledDays</span> = <span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">6</span><span style="color: #66cc66;">&#93;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Del código anterior, el número cero hace referencia al día domingo, mientras que el día seis hace referencia al día sábado.</p>
<p><span style="color: #c00000;"><strong>Deshabilitar fechas o rango de fechas en el componente DateField</strong></span></p>
<p>Para deshabilitar una fecha o bien un rango de fechas debemos usar la propiedad <em>disabledRanges</em>. Esta propiedad puede ser un arreglo de objetos cuyo tipo de dato es <em>Date</em>, o bien un objeto que contiene las propiedades <em>rangeStart</em> y <em>rangeEnd</em> y cuyos valores deben ser un objeto Date.</p>
<p>Continuando con el ejemplo anterior (el de la aplicación estilo agenda), imaginemos que vamos a salir de vacaciones del 20 al 28 de diciembre, y por lo tanto queremos deshabilitar esos días. El siguiente código nos permitirá hacerlo:</p>
<div class="igBar"><span id="lactionscript-52"><a href="#" onclick="javascript:showPlainTxt('actionscript-52'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-52">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fecha.<span style="color: #006600;">disabledRanges</span> = <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#123;</span>rangeStart: <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Date</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2008</span>, <span style="color: #cc66cc;color:#800000;">11</span>, <span style="color: #cc66cc;color:#800000;">20</span><span style="color: #66cc66;">&#41;</span>, rangeEnd: <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Date</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2008</span>, <span style="color: #cc66cc;color:#800000;">11</span>, <span style="color: #cc66cc;color:#800000;">28</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#93;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Recuerda que el número de meses comienzan en 0, por lo tanto para el mes de diciembre el número es el 11.</p>
<div align="center" style="margin-top:0px"><script type="text/javascript"><!--
      google_ad_client = "pub-5808310808246221";
      /* 250x250, Posts */
      google_ad_slot = "8254875600";
      google_ad_width = 250;
      google_ad_height = 250;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></div>
<div align="center" style="margin-top:30px; margin-bottom:20px;">
<object type="application/x-shockwave-flash" width="400" height="280">
<param name="movie" value=" http://codigometropoli.com/wp-content/uploads/2008/12/componente_datefield.swf" />
<embed src=" http://codigometropoli.com/wp-content/uploads/2008/12/componente_datefield.swf" type="application/x-shockwave-flash" width="400" height="280" >
</object>
</div>
<div align="center" style="margin-top:30px; margin-bottom:20px;">
<table border="0" cellspacing="0" cellpadding="0" width="180">
<tbody>
<tr>
<td valign="top"><a href="http://codigometropoli.com/wp-content/uploads/descarga.php?file=2008/12/componente_datefield.fla"><img src="../images/descargar_archivo.jpg" alt="Descargar Archivo" /></a></td>
</tr>
</tbody>
</table>
</div>
<div style="margin-top:40px; margin-bottom:30px;">
<strong>Enlaces recomendados:</strong><br />
» <a href="http://livedocs.adobe.com/flash/8/main/00003411.html" target="_blank">DateField Class</a></div>

<p><a href="http://feedads.g.doubleclick.net/~a/CcD-PVzg5A0PQEoXlfUkRQLybBM/0/da"><img src="http://feedads.g.doubleclick.net/~a/CcD-PVzg5A0PQEoXlfUkRQLybBM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/CcD-PVzg5A0PQEoXlfUkRQLybBM/1/da"><img src="http://feedads.g.doubleclick.net/~a/CcD-PVzg5A0PQEoXlfUkRQLybBM/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/feedburner/ERTc/~4/FIxuf5IqdKo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codigometropoli.com/componente-datefield/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.codigometropoli.com/componente-datefield/</feedburner:origLink></item>
		<item>
		<title>Sistema de Gastos en Flex con AMFPHP y MySQL</title>
		<link>http://feedproxy.google.com/~r/feedburner/ERTc/~3/PwjkNAQD-Bg/</link>
		<comments>http://www.codigometropoli.com/sistema-de-gastos-en-flex-con-amfphp-y-mysql/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 16:30:48 +0000</pubDate>
		<dc:creator>Carla Macías</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Proyectos]]></category>

		<category><![CDATA[AMFPHP]]></category>

		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.codigometropoli.com/?p=472</guid>
		<description><![CDATA[En este tutorial veremos cómo acceder a los registros de una base de datos MySQL desde Flex utilizando AMFPHP. Realizaremos un pequeño Sistema de Gastos en el cual haremos inserciones a la base de datos, consultas, modificaciones y eliminación de registros. Si no sabes qué es y para qué sirve el AMFPHP, visita nuestro tutorial [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="float: right;" src="http://codigometropoli.com/images/flex_sticker.jpg" alt="Flex" width="93" height="93" />En este tutorial veremos cómo acceder a los registros de una base de datos MySQL desde Flex utilizando <a href="http://www.amfphp.org/" target="_blank">AMFPHP</a>. Realizaremos un pequeño Sistema de Gastos en el cual haremos inserciones a la base de datos, consultas, modificaciones y eliminación de registros. Si no sabes qué es y para qué sirve el AMFPHP, visita nuestro tutorial de <a href="http://www.codigometropoli.com/introduccion-a-amfphp/" target="_self">Introducción a AMFPHP</a>.</p>
<p><span id="more-472"></span></p>
<p>En esta ocasión no veremos a detalle todo el código que involucra el sistema; sin embargo, puedes encontrar al final de esta entrada los archivos fuentes.<br />
El sistema funciona de la siguiente manera:<br />
- El usuario primero da de alta tipo de monedas en la Sección de Divisas (Su nombre y símbolo).<br />
- Posteriormente el usuario puede dar de alta servicios en la Sección de Servicios (valga la redundancia). Estos servicios son opcionales y pueden seleccionarse cuando un usuario introduce un gasto en el sistema. Ejemplo de servicios: teléfono, gas, luz, educación, restaurantes, entretenimiento, etc.<br />
- Dentro del sistema, el usuario puede dar de alta gastos e ingresos. Estos gastos o ingresos requieren de la fecha, cantidad y divisa con la cual se realizó la operación. De manera opcional se puede introducir un concepto (descripción) y se puede seleccionar un servicio (si se trata de un gasto).</p>
<p>Comenzaremos con el script de nuestra base de datos:</p>
<div class="igBar"><span id="lsql-63"><a href="#" onclick="javascript:showPlainTxt('sql-63'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-63">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># Host: localhost&nbsp; &nbsp; Database: codmetr_gastos</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># Server version 4.1.22-community-nt</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># Table structure for table tbldivisa</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`tbldivisa`</span> <span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`INTNUMDIVISA`</span> int<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">11</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span>,</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`STRNOMBRE`</span> varchar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">30</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">''</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`STRSIMBOLO`</span> varchar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">5</span><span style="color:#006600; font-weight:bold;">&#41;</span> character <span style="color: #993333; font-weight: bold;">SET</span> utf8 <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #993333; font-weight: bold;">NULL</span>,</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>&nbsp; <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">`INTNUMDIVISA`</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span> ENGINE=MyISAM <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span>=<span style="color: #cc66cc;color:#800000;">3</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET=latin1;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># Table structure for table tbloperacion</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`tbloperacion`</span> <span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`INTNUMOPERACION`</span> int<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">11</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span>,</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`DTMFECHA`</span> date <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'0000-00-00'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`STRCONCEPTO`</span> varchar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">100</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #993333; font-weight: bold;">NULL</span>,</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`NUMCANTIDAD`</span> decimal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">10</span>,<span style="color: #cc66cc;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #993333; font-weight: bold;">NULL</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`INTNUMDIVISA`</span> int<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">11</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'0'</span>,</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`INTNUMSERVICIO`</span> int<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">11</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #993333; font-weight: bold;">NULL</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`INTOPERACION`</span> int<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">11</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'0'</span>,</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>&nbsp; <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">`INTNUMOPERACION`</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span> ENGINE=MyISAM <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span>=<span style="color: #cc66cc;color:#800000;">4</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET=latin1;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># Table structure for table tblservicio</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`tblservicio`</span> <span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`INTNUMSERVICIO`</span> int<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">11</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span>,</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`STRNOMBRE`</span> varchar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">50</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #993333; font-weight: bold;">NULL</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>&nbsp; <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">`INTNUMSERVICIO`</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span> ENGINE=MyISAM <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span>=<span style="color: #cc66cc;color:#800000;">3</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET=latin1; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Del código anterior podemos observar que tenemos una tabla <strong>tbldivisa</strong>, en la cual almacenamos los tipos de moneda que utilizamos. Una tabla <strong>tblservicio</strong> donde guardamos los servicios ingresados; y una tabla <strong>tbloperacion</strong> en donde almacenamos las operaciones (gastos e ingresos). Las relaciones entre divisas y servicios con respecto a las operaciones están dadas por el ID de estas tablas (INTNUMDIVISA e INTNUMSERVICIO).</p>
<p>Ahora veremos el código PHP de nuestra que funcionará como servicio:</p>
<div class="igBar"><span id="lphp-64"><a href="#" onclick="javascript:showPlainTxt('php-64'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-64">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> SistemaGastos</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">var</span> <span style="color:#0000FF;">$sqlstring</span> = <span style="color:#FF0000;">""</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">var</span> <span style="color:#0000FF;">$server</span> = <span style="color:#FF0000;">"localhost"</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">var</span> <span style="color:#0000FF;">$user</span> =&nbsp; <span style="color:#FF0000;">"usuario_database"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">var</span> <span style="color:#0000FF;">$pass</span> = <span style="color:#FF0000;">"contrasena_database"</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">var</span> <span style="color:#0000FF;">$database</span> = <span style="color:#FF0000;">"codigometr_gastos"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">var</span> <span style="color:#0000FF;">$db</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">var</span> <span style="color:#0000FF;">$rs</span> = <span style="color:#CC66CC;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">var</span> <span style="color:#0000FF;">$row</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">var</span> <span style="color:#0000FF;">$recordcount</span> = <span style="color:#CC66CC;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">var</span> <span style="color:#0000FF;">$EOF</span> = <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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> _conectarBaseDatos<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">db</span> = <a href="http://www.php.net/mysql_connect"><span style="color:#000066;">mysql_connect</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">server</span>,<span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">user</span>,<span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">pass</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp;&nbsp; <a href="http://www.php.net/mysql_select_db"><span style="color:#000066;">mysql_select_db</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">database</span>,<span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">db</span><span style="color:#006600; font-weight:bold;">&#41;</span> or <a href="http://www.php.net/die"><span style="color:#000066;">die</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/mysql_error"><span style="color:#000066;">mysql_error</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> _ejecutarQuery<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$strSql</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">sqlstring</span> = <span style="color:#0000FF;">$strSql</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_exec_command<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">lastid</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> _exec_command<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">db</span> &amp;&amp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">sqlstring</span>!=<span style="color:#FF0000;">""</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">rs</span> = <a href="http://www.php.net/mysql_query"><span style="color:#000066;">mysql_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">sqlstring</span>,<span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">db</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">rs</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">EOF</span> = <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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">recordcount</span> = <a href="http://www.php.net/mysql_affected_rows"><span style="color:#000066;">mysql_affected_rows</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">lastid</span> = <a href="http://www.php.net/mysql_insert_id"><span style="color:#000066;">mysql_insert_id</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">recordcount</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">EOF</span> = <span style="color:#000000; font-weight:bold;">true</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">recordcount</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">EOF</span> = <span style="color:#000000; font-weight:bold;">true</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span>&nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span>&nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> _destruir<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">db</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/mysql_close"><span style="color:#000066;">mysql_close</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">db</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#008000;">/* Métodos para la tabla tbldivisa */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> insertarDivisa<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$nombre</span>, <span style="color:#0000FF;">$simbolo</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_conectarBaseDatos<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> = <span style="color:#FF0000;">"Insert into `tbldivisa` (`STRNOMBRE`, `STRSIMBOLO`) VALUES ('"</span> . <span style="color:#0000FF;">$nombre</span> . <span style="color:#FF0000;">"', '"</span> . <span style="color:#0000FF;">$simbolo</span> . <span style="color:#FF0000;">"')"</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_ejecutarQuery<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$sql</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_destruir<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> modificarDivisa<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$idDivisa</span>, <span style="color:#0000FF;">$nombre</span>, <span style="color:#0000FF;">$simbolo</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_conectarBaseDatos<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> = <span style="color:#FF0000;">"Update `tbldivisa` set `STRNOMBRE` = '"</span> . <span style="color:#0000FF;">$nombre</span> . <span style="color:#FF0000;">"', `STRSIMBOLO` = '"</span> . <span style="color:#0000FF;">$simbolo</span> . <span style="color:#FF0000;">"' where `INTNUMDIVISA` = "</span> . <span style="color:#0000FF;">$idDivisa</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_ejecutarQuery<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$sql</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_destruir<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> eliminarDivisa<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$idDivisa</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_conectarBaseDatos<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> = <span style="color:#FF0000;">"Delete from `tbldivisa` where `INTNUMDIVISA`= "</span> . <span style="color:#0000FF;">$idDivisa</span>;&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$result</span> = <a href="http://www.php.net/mysql_query"><span style="color:#000066;">mysql_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$sql</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> = <span style="color:#FF0000;">"Delete from `tbloperacion` where `INTNUMDIVISA`= "</span> . <span style="color:#0000FF;">$idDivisa</span>;&nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/mysql_query"><span style="color:#000066;">mysql_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$sql</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_destruir<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$result</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> obtenerDivisas<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_conectarBaseDatos<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> = <span style="color:#FF0000;">"Select INTNUMDIVISA, STRNOMBRE, STRSIMBOLO from tbldivisa ORDER BY STRNOMBRE asc"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$result</span> = <a href="http://www.php.net/mysql_query"><span style="color:#000066;">mysql_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$sql</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">while</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$row</span> = <a href="http://www.php.net/mysql_fetch_object"><span style="color:#000066;">mysql_fetch_object</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$result</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$divisas</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0000FF;">$row</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span>&nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_destruir<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$divisas</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#008000;">/* Métodos para la tabla tblservicio */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> insertarServicio<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$nombre</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_conectarBaseDatos<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> = <span style="color:#FF0000;">"Insert into `tblservicio` (`STRNOMBRE`) VALUES ('"</span> . <span style="color:#0000FF;">$nombre</span> . <span style="color:#FF0000;">"')"</span>;&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_ejecutarQuery<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$sql</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_destruir<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> modificarServicio<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$idServicio</span>, <span style="color:#0000FF;">$nombre</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_conectarBaseDatos<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> = <span style="color:#FF0000;">"Update `tblservicio` set `STRNOMBRE` = '"</span> . <span style="color:#0000FF;">$nombre</span> . <span style="color:#FF0000;">"' where `INTNUMSERVICIO` = "</span> . <span style="color:#0000FF;">$idServicio</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_ejecutarQuery<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$sql</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_destruir<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> eliminarServicio<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$idServicio</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_conectarBaseDatos<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> = <span style="color:#FF0000;">"Delete from `tblservicio` where `INTNUMSERVICIO`= "</span> . <span style="color:#0000FF;">$idServicio</span>;&nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$result</span> = <a href="http://www.php.net/mysql_query"><span style="color:#000066;">mysql_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$sql</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> = <span style="color:#FF0000;">"Delete from `tbloperacion` where `INTNUMSERVICIO`= "</span> . <span style="color:#0000FF;">$idServicio</span>;&nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/mysql_query"><span style="color:#000066;">mysql_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$sql</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_destruir<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$result</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> obtenerServicios<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_conectarBaseDatos<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> = <span style="color:#FF0000;">"Select INTNUMSERVICIO, STRNOMBRE from tblservicio ORDER BY STRNOMBRE asc"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$result</span> = <a href="http://www.php.net/mysql_query"><span style="color:#000066;">mysql_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$sql</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">while</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$row</span> = <a href="http://www.php.net/mysql_fetch_object"><span style="color:#000066;">mysql_fetch_object</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$result</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$servicios</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0000FF;">$row</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span>&nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_destruir<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$servicios</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#008000;">/* Métodos para la tabla tbloperacion */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> insertarOperacion<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$fecha</span>, <span style="color:#0000FF;">$concepto</span>, <span style="color:#0000FF;">$cantidad</span>, <span style="color:#0000FF;">$id_divisa</span>, <span style="color:#0000FF;">$servicio</span>, <span style="color:#0000FF;">$operacion</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_conectarBaseDatos<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> = <span style="color:#FF0000;">"INSERT INTO `tbloperacion` (DTMFECHA, STRCONCEPTO, NUMCANTIDAD, INTNUMDIVISA, INTNUMSERVICIO, INTOPERACION) VALUES ('"</span> . <span style="color:#0000FF;">$fecha</span> . <span style="color:#FF0000;">"','"</span> . <span style="color:#0000FF;">$concepto</span> . <span style="color:#FF0000;">"',"</span> . <span style="color:#0000FF;">$cantidad</span> . <span style="color:#FF0000;">","</span> . <span style="color:#0000FF;">$id_divisa</span> . <span style="color:#FF0000;">","</span> . <span style="color:#0000FF;">$servicio</span> . <span style="color:#FF0000;">","</span> . <span style="color:#0000FF;">$operacion</span> . <span style="color:#FF0000;">")"</span>;&nbsp; &nbsp;&nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$result</span> = <span style="color:#0000FF;">$this</span>-&gt;_ejecutarQuery<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$sql</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_destruir<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$result</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> actualizarOperacion<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$idOperacion</span>, <span style="color:#0000FF;">$fecha</span>, <span style="color:#0000FF;">$concepto</span>, <span style="color:#0000FF;">$cantidad</span>, <span style="color:#0000FF;">$id_divisa</span>, <span style="color:#0000FF;">$servicio</span>, <span style="color:#0000FF;">$operacion</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_conectarBaseDatos<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> = <span style="color:#FF0000;">"Update `tbloperacion` set `DTMFECHA` = '"</span> . <span style="color:#0000FF;">$fecha</span> . <span style="color:#FF0000;">"', `STRCONCEPTO` = '"</span> . <span style="color:#0000FF;">$concepto</span> . <span style="color:#FF0000;">"', `NUMCANTIDAD` = "</span> . <span style="color:#0000FF;">$cantidad</span> . <span style="color:#FF0000;">", `INTNUMDIVISA` = "</span> . <span style="color:#0000FF;">$id_divisa</span> . <span style="color:#FF0000;">", `INTNUMSERVICIO` = "</span> . <span style="color:#0000FF;">$servicio</span> . <span style="color:#FF0000;">", `INTOPERACION` = "</span> . <span style="color:#0000FF;">$operacion</span> . <span style="color:#FF0000;">" where `INTNUMOPERACION` = "</span> . <span style="color:#0000FF;">$idOperacion</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$result</span> = <span style="color:#0000FF;">$this</span>-&gt;_ejecutarQuery<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$sql</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_destruir<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$result</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> eliminarOperacion<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$idOperacion</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_conectarBaseDatos<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> = <span style="color:#FF0000;">"Delete from `tbloperacion` where `INTNUMOPERACION`= "</span> . <span style="color:#0000FF;">$idOperacion</span>;&nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$result</span> = <a href="http://www.php.net/mysql_query"><span style="color:#000066;">mysql_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$sql</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_destruir<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$result</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> obtenerOperaciones<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_conectarBaseDatos<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> = <span style="color:#FF0000;">"Select * from `tbloperacion` ORDER BY DTMFECHA asc"</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$result</span> = <a href="http://www.php.net/mysql_query"><span style="color:#000066;">mysql_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$sql</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">while</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$row</span> = <a href="http://www.php.net/mysql_fetch_object"><span style="color:#000066;">mysql_fetch_object</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$result</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$operaciones</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0000FF;">$row</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span>&nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_destruir<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$operaciones</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> realizarConsulta<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$servicio</span>, <span style="color:#0000FF;">$divisa</span>, <span style="color:#0000FF;">$concepto</span>, <span style="color:#0000FF;">$fecha1</span>, <span style="color:#0000FF;">$fecha2</span>, <span style="color:#0000FF;">$cantidad1</span>, <span style="color:#0000FF;">$cantidad2</span>, <span style="color:#0000FF;">$operacion</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_conectarBaseDatos<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> = <span style="color:#FF0000;">"Select top.DTMFECHA, top.STRCONCEPTO, top.NUMCANTIDAD, top.INTNUMDIVISA, top.INTNUMSERVICIO, top.INTOPERACION, td.STRNOMBRE, td.STRSIMBOLO FROM tbloperacion AS top, tbldivisa as td WHERE td.INTNUMDIVISA = top.INTNUMDIVISA"</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008000;">/* Selección Concepto */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$concepto</span> != <span style="color:#FF0000;">""</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> .= <span style="color:#FF0000;">" AND top.STRCONCEPTO LIKE '%"</span> . <span style="color:#0000FF;">$concepto</span> . <span style="color:#FF0000;">"%'"</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008000;">/* Selección Divisa */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$divisa</span> != <span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> .= <span style="color:#FF0000;">" AND top.INTNUMDIVISA = "</span> . <span style="color:#0000FF;">$divisa</span> . <span style="color:#FF0000;">" AND td.INTNUMDIVISA = "</span> . <span style="color:#0000FF;">$divisa</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008000;">/* Selección Servicio */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$servicio</span> != <span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> .= <span style="color:#FF0000;">" AND top.INTNUMSERVICIO = "</span> . <span style="color:#0000FF;">$servicio</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$cantidad1</span> != <span style="color:#FF0000;">""</span> &amp;&amp; <span style="color:#0000FF;">$cantidad2</span> != <span style="color:#FF0000;">""</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$cantidad1</span> &lt;= <span style="color:#0000FF;">$cantidad2</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> .= <span style="color:#FF0000;">" AND top.NUMCANTIDAD BETWEEN "</span> . <span style="color:#0000FF;">$cantidad1</span> . <span style="color:#FF0000;">" AND "</span> . <span style="color:#0000FF;">$cantidad2</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">else</span> </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> .= <span style="color:#FF0000;">" AND top.NUMCANTIDADBETWEEN "</span> . <span style="color:#0000FF;">$cantidad2</span> . <span style="color:#FF0000;">" AND "</span> . <span style="color:#0000FF;">$cantidad1</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">else</span> <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$cantidad1</span> != <span style="color:#FF0000;">""</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> .= <span style="color:#FF0000;">" AND top.NUMCANTIDAD = "</span> . <span style="color:#0000FF;">$cantidad1</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">else</span> <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$cantidad2</span> != <span style="color:#FF0000;">""</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> .= <span style="color:#FF0000;">" AND top.NUMCANTIDAD = "</span> . <span style="color:#0000FF;">$cantidad2</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008000;">/* Selección Operación */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$operacion</span> == <span style="color:#CC66CC;color:#800000;">3</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> .= <span style="color:#FF0000;">" AND top.INTOPERACION&gt;= 1 AND top.INTOPERACION &lt;= 2"</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> .= <span style="color:#FF0000;">" AND top.INTOPERACION = "</span>&nbsp; . <span style="color:#0000FF;">$operacion</span>;&nbsp; &nbsp;&nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$fecha1</span> != <span style="color:#000000; font-weight:bold;">NULL</span> || <span style="color:#0000FF;">$fecha2</span> != <span style="color:#000000; font-weight:bold;">NULL</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$fecha1</span> != <span style="color:#FF0000;">""</span> &amp;&amp; <span style="color:#0000FF;">$fecha2</span> == <span style="color:#FF0000;">""</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> .= <span style="color:#FF0000;">" AND top.DTMFECHA = '"</span> . <span style="color:#0000FF;">$fecha1</span> . <span style="color:#FF0000;">"'"</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">else</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> .= <span style="color:#FF0000;">" AND top.DTMFECHA&gt;= '"</span> . <span style="color:#0000FF;">$fecha1</span> . <span style="color:#FF0000;">"' AND top.DTMFECHA &lt;= '"</span> . <span style="color:#0000FF;">$fecha2</span> . <span style="color:#FF0000;">"'"</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> .= <span style="color:#FF0000;">" ORDER BY top.DTMFECHA asc, top.NUMCANTIDAD asc"</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$result</span> = <a href="http://www.php.net/mysql_query"><span style="color:#000066;">mysql_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$sql</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">while</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$row</span> = <a href="http://www.php.net/mysql_fetch_object"><span style="color:#000066;">mysql_fetch_object</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$result</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$registros</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0000FF;">$row</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span>&nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_destruir<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$registros</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Los métodos que inician con guión bajo (_) son métodos privados y por lo tanto no podemos acceder a ellos desde Flex. Los otros métodos <em>insertarDivisa</em>, <em>modificarDivisa</em>, <em>eliminarDivisa</em>, <em>obtenerDivisas</em>, etc. son métodos públicos a los cuales accedemos desde Flex.<br />
Observa cómo en los métodos obtenerXXX almacenamos los registros en un arreglo y lo regresamos a nuestra aplicación. Los queries en realidad son muy sencillos, por lo que no requieren explicación; solamente observa cómo en los métodos <strong>eliminarServicio</strong> y <strong>eliminarDivisa</strong> hacemos el borrado de los registros que involucran estos registros en la tabla <em>tbloperacion</em>. Esto es para evitar que haya inconsistencia en la base de datos.</p>
<p>Ahora veremos el código principal de nuestra aplicación en Flex.<br />
Para poder hacer uso del AMFPHP necesitamos de las librerías <strong>NetConnection</strong> y <strong>Responder</strong>.</p>
<div class="igBar"><span id="lactionscript-65"><a href="#" onclick="javascript:showPlainTxt('actionscript-65'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-65">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #0066CC;">NetConnection</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #006600;">Responder</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Para poder acceder a los servicios en AMFPHP debemos especificar la ruta en la cual se encuentra el archivo gateway.php de AMFPHP:</p>
<div class="igBar"><span id="lactionscript-66"><a href="#" onclick="javascript:showPlainTxt('actionscript-66'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-66">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> gateway:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">"http://www.codigometropoli.com/wp-content/uploads/2008/10/SistemaGastos/AMFPHP1.9/gateway.php"</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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> connection:<span style="color: #0066CC;">NetConnection</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<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> responder:Responder; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Al iniciar la aplicación debemos llamar a la función <em>connect</em> pasándole como parámetro el <em>gateway</em>:</p>
<div class="igBar"><span id="lactionscript-67"><a href="#" onclick="javascript:showPlainTxt('actionscript-67'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-67">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> iniciaAplicacion<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; connection = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">NetConnection</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; connection.<span style="color: #0066CC;">connect</span><span style="color: #66cc66;">&#40;</span>gateway<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Dentro del constructor de la clase Responder debemos especificar las funciones que se ejecutarán en caso de que la llamada haya sido sido exitosa y en caso de que haya existido un error. Para hacer la llamada al servicio utilizamos la función <em>call</em>; a la cual pasamos como parámetro el nombre de la función que queremos llamar y que se encuentra en la clase <strong>SistemaGastos.php</strong>, nuestro objeto de la clase Responder y los parámetros que debemos pasarle a la función:</p>
<div class="igBar"><span id="lactionscript-68"><a href="#" onclick="javascript:showPlainTxt('actionscript-68'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-68">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">responder = <span style="color: #000000; font-weight: bold;">new</span> Responder<span style="color: #66cc66;">&#40;</span>insertarOperacionResult, errorConsulta<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">connection.<span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"SistemaGastos.insertarOperacion"</span>, responder, param1, param2, param3...<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Del código anterior podemos deducir que el nombre de nuestra clase en PHP es <strong>SistemaGastos</strong> y que tiene un método público llamado <strong>insertarOperacion</strong>.</p>
<p>En caso de que la llamada haya sido exitosa, se ejecutará el método <em>insertarOperacionResult</em>:</p>
<div class="igBar"><span id="lactionscript-69"><a href="#" onclick="javascript:showPlainTxt('actionscript-69'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-69">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<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> insertarOperacionResult<span style="color: #66cc66;">&#40;</span>result:<span style="color: #0066CC;">Object</span><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:#0B1558;">
<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>result.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> != <span style="color: #ff0000;">"0"</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:#2C442A;">
<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; restablecerForma<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Registro almacenado"</span>, <span style="color: #ff0000;">"Aviso"</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">else</span> </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"No se pudo almacenar el registro"</span>, <span style="color: #ff0000;">"Error"</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>En caso contrario, si existiera algún error en la llamada al servicio, la función <em>errorConsulta</em> se ejecutará:</p>
<div class="igBar"><span id="lactionscript-70"><a href="#" onclick="javascript:showPlainTxt('actionscript-70'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-70">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<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> errorConsulta<span style="color: #66cc66;">&#40;</span>fault:<span style="color: #0066CC;">Object</span><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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span>fault.<span style="color: #006600;">description</span>, <span style="color: #ff0000;">"Error"</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; CursorManager.<span style="color: #006600;">removeBusyCursor</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Nuestra forma de alta de operación (Gasto o Ingreso) será la siguiente:</p>
<div align="center"><img src="http://www.codigometropoli.com/images/screens/sistema_gastos_flex_alta.jpg" alt="Formulario de alta de gastos o ingresos" /></div>
<p>De la imagen anterior puedes saber qué tipo de información estamos solicitando, cuál es la obligatoria (Fecha, Cantidad y Divisa), así como la forma en qué estamos mostrando al usuario las divisas y servicios dados de alta (por medio de ComboBox).</p>
<p>Las partes de código mostradas forman parte de la llamada a una función que se encarga de insertar un registro. El código no tendrá variación cuando se trate de modificar un registro; y cuando se trate de eliminar un registro solamente le pasaremos el ID del registro a eliminar. ¿Pero qué pasa cuando se trata de una consulta? ¿Cómo obtenemos los registros registros regresados por la base de datos? ¿Cómo mostramos esos registros?</p>
<p>Si leíste el tutorial sobre <a href="http://www.codigometropoli.com/componente-datagrid/">Componente DataGrid</a> y las cuatro entregas del tutorial <a href="http://www.codigometropoli.com/category/air/">Sistema de Clientes en AIR</a> sabrás que podemos recorrer cada uno de los registros obtenidos de la base de datos y almacenarlos en un arreglo por medio del método <em>push</em>; posteriormente ese arreglo es pasado al DataGrid como su proveedor de datos (<em>dataProvider</em>).</p>
<p>Primero hacemos la llamada al método <em>realizarConsulta</em> del servicio <strong>SistemaGastos</strong>:</p>
<div class="igBar"><span id="lactionscript-71"><a href="#" onclick="javascript:showPlainTxt('actionscript-71'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-71">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">responder = <span style="color: #000000; font-weight: bold;">new</span> Responder<span style="color: #66cc66;">&#40;</span>realizarConsultaResult, errorConsulta<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">connection.<span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"SistemaGastos.realizarConsulta"</span>, responder, param1, param2, param3...<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Definimos el código de nuestra función realizarConsultaResult:</p>
<div class="igBar"><span id="lactionscript-72"><a href="#" onclick="javascript:showPlainTxt('actionscript-72'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-72">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<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> realizarConsultaResult<span style="color: #66cc66;">&#40;</span>result:<span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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:#2C442A;">
<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>result != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> totalRegistros:<span style="color: #0066CC;">Number</span> = result.<span style="color: #0066CC;">length</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> totales_array:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;color:#800000;">0</span>; i &lt;result.<span style="color: #0066CC;">length</span>; i++<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; ...</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">var</span> divisa_txt:<span style="color: #0066CC;">String</span> = result<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">STRNOMBRE</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">var</span> simbolo_txt:<span style="color: #0066CC;">String</span> = result<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">STRSIMBOLO</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;...&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> cantidad:<span style="color: #0066CC;">Number</span> = result<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">NUMCANTIDAD</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>totales_array.<span style="color: #0066CC;">length</span> == <span style="color: #cc66cc;color:#800000;">0</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; totales_array.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>cantidad:cantidad, divisaID:result<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">INTNUMDIVISA</span>, divisa:divisa_txt, simbolo:result<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">STRSIMBOLO</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> posicion:<span style="color: #0066CC;">Number</span> = regresaPosicionMoneda<span style="color: #66cc66;">&#40;</span>totales_array, result<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">INTNUMDIVISA</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>posicion != -<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> total:<span style="color: #0066CC;">Number</span> = totales_array<span style="color: #66cc66;">&#91;</span>posicion<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">cantidad</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; total += cantidad;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; totales_array<span style="color: #66cc66;">&#91;</span>posicion<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">cantidad</span> = total;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; totales_array.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>cantidad:cantidad, divisaID:result<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">INTNUMDIVISA</span>, divisa:divisa_txt, simbolo:result<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">STRSIMBOLO</span><span style="color: #66cc66;">&#125;</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">data_provider.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>fecha_operacion:DateUtilities.<span style="color: #006600;">returnReadableDate</span><span style="color: #66cc66;">&#40;</span>result<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">DTMFECHA</span><span style="color: #66cc66;">&#41;</span>, concepto:result<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">STRCONCEPTO</span>, cantidad:currencyFormatter.<span style="color: #006600;">format</span><span style="color: #66cc66;">&#40;</span>result<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">NUMCANTIDAD</span><span style="color: #66cc66;">&#41;</span>, cantidad_numero:result<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">NUMCANTIDAD</span>, servicio:servicio_txt, divisa:divisa_txt, operacion:returnTipoOperacion<span style="color: #66cc66;">&#40;</span>result<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">INTOPERACION</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#125;</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; registros_dg.<span style="color: #006600;">dataProvider</span> = data_provider;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; info_txt.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">"Total registros: "</span> + totalRegistros + <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> j:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>; j &lt;totales_array.<span style="color: #0066CC;">length</span>; j++<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">var</span> simbolo:<span style="color: #0066CC;">String</span> = totales_array<span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">simbolo</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>simbolo == <span style="color: #ff0000;">"?"</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;simbolo = <span style="color: #ff0000;">"€"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;currencyFormatter.<span style="color: #006600;">currencySymbol</span> = simbolo;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;info_txt.<span style="color: #0066CC;">text</span> += <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>&nbsp; &nbsp; &nbsp;--&gt; "</span> + totales_array<span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">divisa</span> +&nbsp; <span style="color: #ff0000;">" = "</span> + currencyFormatter.<span style="color: #006600;">format</span><span style="color: #66cc66;">&#40;</span>totales_array<span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">cantidad</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span style="color: #66cc66;">&#125;</span>&nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">else</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; info_txt.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">""</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; CursorManager.<span style="color: #006600;">removeBusyCursor</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Del código anterior podemos decir que... primero verificamos que el resultado obtenido por el servicio sea distinto de nulo (es decir, que no esté vacío) ya que si no nos mostraría error. En la variable totalRegistros almacenamos el número de registros obtenidos mediante la propiedad <strong>length</strong> del arreglo. Recorremos el arreglo result por medio de un ciclo <strong>for</strong> y dentro de este ciclo hacemos las operaciones que requerimos con los valores obtenidos. Observa que para acceder a cada una de las columnas de nuestros registros lo hacemos de la forma result[i].STRNOMBRE, result[i].STRSIMBOLO, result[i].INTNUMDIVISA, etc. donde STRNOMBRE, STRSIMBOLO, ... son los nombres de nuestras columnas en la tabla <strong>tbloperacion</strong> de nuestra base de datos. Dentro del código de nuestro ciclo for estamos sumando (ingreso) o restando (si se trata de gasto) las cantidades pertenecientes a un mismo tipo de moneda; y así mostrar la cantidad ganada o gastada por tipo de moneda.</p>
<div align="center"><img src="http://www.codigometropoli.com/images/screens/sistema_gastos_flex1.jpg" alt="Resultado de las operaciones por moneda" /></div>
<p>Dentro del archivo SistemaGastos.php observarás que el código de la función realizarConsulta es largo y está lleno de condicionales. Esto es porque las consultas las podemos realizar de acuerdo a los siguientes criterios:</p>
<div align="center" style="margin-bottom:10px;"><a href="http://www.codigometropoli.com/images/screens/sistema_gastos_flex_consulta.jpg" target="_blank"><br />
<img src="http://www.codigometropoli.com/images/previews/sistema_gastos_flex_consulta.jpg" alt="Forma de consulta de gastos e ingresos" /></a></div>
<p>Hemos llegado al final de este tutorial, no olvidemos revisar el ejemplo y bajar los archivos fuentes.</p>
<div align="center" style="margin-top:10px"><script type="text/javascript"><!--
      google_ad_client = "pub-5808310808246221";
      /* 250x250, Posts */
      google_ad_slot = "8254875600";
      google_ad_width = 250;
      google_ad_height = 250;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></div>
<div align="center" style="margin-top:40px;margin-bottom:40px;">
<table border="0" cellspacing="0" cellpadding="0" width="180">
<tbody>
<tr>
<td valign="top"><a href="http://www.codigometropoli.com/wp-content/uploads/2008/10/SistemaGastos/Sistema_Gastos.html" target="center"><img title="Ver Ejempo" src="http://codigometropoli.com/images/ver_ejemplo.jpg" alt="Ver Ejemplo" /></a></td>
<td valign="top"><a href="http://codigometropoli.com/wp-content/uploads/descarga.php?file=2008/10/Sistema_Gastos_AMFPHP.zip"><img title="Descargar Archivo" src="../images/descargar_archivo.jpg" alt="Descargar Archivo" /></a></td>
</tr>
</tbody>
</table>
</div>

<p><a href="http://feedads.g.doubleclick.net/~a/KWKUTSwxVBLtOLTRaFlv1WEYBXQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/KWKUTSwxVBLtOLTRaFlv1WEYBXQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/KWKUTSwxVBLtOLTRaFlv1WEYBXQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/KWKUTSwxVBLtOLTRaFlv1WEYBXQ/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/feedburner/ERTc/~4/PwjkNAQD-Bg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codigometropoli.com/sistema-de-gastos-en-flex-con-amfphp-y-mysql/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.codigometropoli.com/sistema-de-gastos-en-flex-con-amfphp-y-mysql/</feedburner:origLink></item>
		<item>
		<title>Introducción a AMFPHP</title>
		<link>http://feedproxy.google.com/~r/feedburner/ERTc/~3/yshNJ-5s-lg/</link>
		<comments>http://www.codigometropoli.com/introduccion-a-amfphp/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 00:56:21 +0000</pubDate>
		<dc:creator>Carla Macías</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[AMFPHP]]></category>

		<guid isPermaLink="false">http://www.codigometropoli.com/?p=411</guid>
		<description><![CDATA[AMFPHP es una implementación en PHP,  gratuita y de código abierto del AMF (Action Message Format), el cual es un formato binario basado en SOAP. AMF permite la serialización binaria de objetos y tipos nativos de ActionScript 2 y ActionScript 3 para ser enviados a servicios del lado del servidor. AMFPHP permite que aplicaciones [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="float: right;" src="http://codigometropoli.com/images/flash_sticker.jpg" alt="Flash" width="93" height="93" /><a href="http://www.amfphp.org/" target="_blank">AMFPHP</a> es una implementación en PHP,  gratuita y de código abierto del <a href="http://en.wikipedia.org/wiki/Action_Message_Format" target="_blank">AMF</a> (Action Message Format), el cual es un formato binario basado en SOAP. AMF permite la serialización binaria de objetos y tipos nativos de ActionScript 2 y ActionScript 3 para ser enviados a servicios del lado del servidor. AMFPHP permite que aplicaciones realizadas en Flash, Flex y AIR puedan comunicarse  directamente con objetos de clases de PHP.</p>
<p>Prácticamente, la forma en la que funciona se resume en que podemos crear clases en PHP, acceder a los métodos de esas clases por medio de Flash, Flex o AIR y obtener los datos retornados por esos métodos. Por ejemplo, podemos crear una clase para conectarnos a una base de datos en MySQL. Esta clase podría contener un método para insertar datos a la base, otro método para generar consultas y obtener en nuestra aplicación de Flash, Flex o AIR los registros regresados por la consulta.</p>
<p>En esta entrada veremos cómo está formado el AMFPHP y cómo acceder a él desde Flash CS3. Para una mejor explicación de cómo acceder a AMFPHP haremos una sencilla clase en PHP la cual no accederá a ninguna base de datos (eso lo dejaremos para nuestro próximo tutorial).</p>
<p><span id="more-411"></span></p>
<p><span style="color: #ff0000;"><strong>Tutorial</strong></span></p>
<p>1. Baja el archivo amfphp-1.9.beta.20080120.zip de <a href="http://sourceforge.net/project/showfiles.php?group_id=72483&amp;package_id=72363&amp;release_id=541961" target="_blank">aquí</a>. El amfphp-1.9 lo podemos usar con ActionScript 3 (Flash CS3, Flex y AIR), mientras que la versión anterior puede ser usada con ActionScript 2.</p>
<p>2. Descomprímelo y ponlo en algún directorio de tu servidor Web, en tu directorio <strong>htdocs</strong> o <strong>www</strong> en tu <em>localhost</em>. Si lo deseas, puedes renombrar la carpeta y ponerle AMFPHP1.9.</p>
<p>La estructura del directorio quedaría de la siguiente manera (en mi caso, la carpeta AMFPHP1.9 la puse en la carpeta raíz de mi servidor):</p>
<p>--&gt; root ó carpeta raíz<br />
<span style="padding-left: 30px;">--&gt;AMFPHP1.9 (D)</span><br />
<span style="padding-left: 60px;">--&gt; browser (D)</span><br />
<span style="padding-left: 60px;">--&gt; core (D)</span><br />
<span style="padding-left: 60px;">--&gt; services (D)</span><br />
<span style="padding-left: 60px;">--&gt; gateway.php</span><br />
<span style="padding-left: 60px;">--&gt; globals.php</span><br />
<span style="padding-left: 60px;">--&gt; json.php</span><br />
<span style="padding-left: 60px;">--&gt; phpinfo</span><br />
<span style="padding-left: 60px;">--&gt; xmlrpc</span></p>
<p>Donde (D) indica que se trata de un directorio. Observa la carpeta <em>browser</em>, si accediéramos a él desde el navegador observaremos  una aplicación creada en Flex donde nos muestra la lista de servicios que tenemos en AMFPHP, como se muestra en la siguiente <a href="http://www.codigometropoli.com/AMFPHP1.9/browser/" target="_blank">liga</a>. Si es la primera vez que accedes al <em>browser</em>, aparecerá la siguiente ventana de configuración:</p>
<div align="center"><img title="Imagen 1: Ventana de Configuración de AMFPHP" src="http://www.codigometropoli.com/images/screens/amfphp_configuracion_1.jpg" alt="Imagen 1: Ventana de Configuración de AMFPHP" width="514" height="247" /></div>
<p></p>
<p>En esta ventana de configuración deberás asegurarte que la dirección del <em>Gateway</em> es correcta. Después de hacer click en el botón <em>Save</em> te aparecerá la lista de servicios. Por default y cuando todavía no hemos creado ningún servicio nuevo, solamente aparecerá el servicio <em>DiscoveryService</em>. <strong>Importante:</strong> Cuando tenemos servicios que deben acceder a una base de datos o tratan información importante o crítica, lo mejor será no poner el directorio <em>browser</em> en el servidor. Continuando con nuestra estructura de directorios, como podrás imaginar, todos nuestros servicios (clases en PHP) deberán ir en el directorio <em>services</em>.</p>
<p>3. Vamos a crear una sencilla clase de PHP, la cual simulará las operaciones básicas de una calculadora. Sus métodos serán <em>sumar</em>, <em>restar</em>, <em>multiplicar</em> y <em>dividir</em>. Cada método recibirá como parámetro los dos números sobre los cuales hay que hacer la operación. <strong>Nota:</strong> Este tutorial es solamente para explicar cómo funciona AMFPHP y cómo podemos acceder a él desde Flash. Es por eso que nuestra clase de ejemplo es muy sencilla y muchos de ustedes dirán que no se requiere de PHP para sumar, restar, multiplicar y dividir dos números =0).<br />
En PHP, al igual que en Flash, el nombre del archivo de una clase deberá tener el mismo nombre de la clase; por lo tanto, crea un nuevo archivo PHP, nómbralo <strong>Calculadora.php</strong> y guárdalo dentro del directorio <em>services</em> de nuestra carpeta AMFPHP19. Coloca el siguiente código dentro de Calculadora.php:</p>
<div class="igBar"><span id="lphp-80"><a href="#" onclick="javascript:showPlainTxt('php-80'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-80">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> Calculadora</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#008000;">/**</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * Suma dos números pasados por parámetro</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * @returns Regresa un valor numérico</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; */</span>&nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> sumar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeroA</span>, <span style="color:#0000FF;">$numeroB</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeroA</span> + <span style="color:#0000FF;">$numeroB</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span>&nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#008000;">/**</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * Resta dos números pasados por parámetro</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * @returns Regresa un valor numérico</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> restar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeroA</span>, <span style="color:#0000FF;">$numeroB</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeroA</span> - <span style="color:#0000FF;">$numeroB</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#008000;">/**</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * Multiplica dos números pasados por parámetro</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * @returns Regresa un valor numérico</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> multiplicar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeroA</span>, <span style="color:#0000FF;">$numeroB</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeroA</span> * <span style="color:#0000FF;">$numeroB</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#008000;">/**</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * Divide dos números pasados por parámetro</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * @returns Regresa un valor numérico</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> dividir<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeroA</span>, <span style="color:#0000FF;">$numeroB</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeroA</span> / <span style="color:#0000FF;">$numeroB</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Observa los comentarios antes de cada función; estos comentarios nos dan una descripción de qué es lo que hace cada método y además le estamos indicando qué es lo que nos regresa cada método (@returns). Si bien estos comentarios no son obligatorios, nos ayudarán a recordar en el momento en que queramos modificar el archivo. Además, dentro de la lista de servicios en el browser, cuando seleccionamos alguno de estos métodos se nos mostrará esta descripción (Como prueba, ingresa al <a href="http://www.codigometropoli.com/AMFPHP1.9/browser/" target="_blank">navegador</a>, de la lista de la izquierda selecciona la clase Calculadora y posteriormente selecciona de la ventana de la derecha el método <em>dividir</em>. Observarás que antes de los campos de texto para ingresar los números aparece la descripción del método). Ahora ingresa un número dentro del campo de texto <em>$numeroA</em> e ingresa otro número dentro del campo <em>$numeroB</em>, haz click en el botón <strong>Call</strong> y observa cómo en el área de resultados (<em>Results</em>) se muestra el resultado regresado por el método <em>dividir</em> de nuestra clase <em>Calculadora</em> en PHP.</p>
<p>4. Dentro de nuestra clase podemos utilizar métodos privados, los cuales no podrán ser utilizados desde el navegador de servicios (<em>browser</em>) ni desde nuestras aplicaciones en Flash, Flex o AIR. Esto es útil cuando dichos métodos realizan operaciones importantes o críticas y que requieran de mayor seguridad. Para establecer que un método es privado, bastará con agregarle un guión bajo (_) antes del nombre. Para hacer la prueba, agrega el siguiente código a la clase Calculadora.php (Insértalo antes de la última llave (}) y del tag de cierre de PHP (?>):</p>
<div class="igBar"><span id="lphp-81"><a href="#" onclick="javascript:showPlainTxt('php-81'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-81">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">/**</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * Este método es privado y no aparecerá en el browser de servicios</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * @returns Regresa la fecha y tiempo del servidor</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> _esteMetodoEsPrivado<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$fecha_hoy</span> = <a href="http://www.php.net/date"><span style="color:#000066;">date</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"d/m/Y"</span><span style="color:#006600; font-weight:bold;">&#41;</span> . <span style="color:#FF0000;">' '</span> . <a href="http://www.php.net/date"><span style="color:#000066;">date</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"H:i:s"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$fecha_hoy</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Observa cómo en el código anterior el nombre de la función empieza con guión bajo _, eso quiere decir que se trata de un método privado. El código de este método privado lo que hace es regresarnos la fecha y el tiempo del servidor (por medio del método date).</p>
<p>Desde nuestra clase de PHP podemos acceder a ese método privado por medio de otro método. Para acceder a este método es necesario utilizar la palabra clave <em>$this</em>. A continuación te muestro cómo:</p>
<div class="igBar"><span id="lphp-82"><a href="#" onclick="javascript:showPlainTxt('php-82'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-82">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">/**</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * Este método es público y está accediendo a nuestro método privado</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * @returns Regresa la fecha y tiempo del servidor</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> obtenFechaServidor<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$fecha_hoy</span> = <span style="color:#0000FF;">$this</span>-&gt;_esteMetodoEsPrivado<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$fecha_hoy</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>El método <em>obtenFechaServidor</em> hace un llamado a la función <em>esteMetodoEsPrivado</em> y almacena en la variable <em>$fecha_hoy</em> el valor regresado por el método privado. Este valor es regresado por el método <em>obtenFechaServidor</em>. </p>
<p>Ingresa a nuestro navegador de <a href="http://www.codigometropoli.com/AMFPHP1.9/browser/" target="_blank">servicios</a>, selecciona la clase Calculadora y observa cómo el método <em>esteMetodoEsPrivado</em> no aparece dentro de los métodos de esta clase. Ahora haz click en el botón <em>obtenFechaServidor</em> y posteriormente en el botón <strong>Call</strong>. En el área de resultados (<em>Results</em>) se mostrará la fecha y hora del servidor.</p>
<p>Antes de pasar a la interfaz y al código ActionScript, te dejo el código completo del archivo <em>Calculadora.php</em></p>
<div class="igBar"><span id="lphp-83"><a href="#" onclick="javascript:showPlainTxt('php-83'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-83">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> Calculadora</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#008000;">/**</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * Suma dos números pasados por parámetro</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * @returns Regresa un valor numérico</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; */</span>&nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> sumar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeroA</span>, <span style="color:#0000FF;">$numeroB</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeroA</span> + <span style="color:#0000FF;">$numeroB</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span>&nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#008000;">/**</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * Resta dos números pasados por parámetro</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * @returns Regresa un valor numérico</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> restar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeroA</span>, <span style="color:#0000FF;">$numeroB</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeroA</span> - <span style="color:#0000FF;">$numeroB</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#008000;">/**</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * Multiplica dos números pasados por parámetro</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * @returns Regresa un valor numérico</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> multiplicar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeroA</span>, <span style="color:#0000FF;">$numeroB</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeroA</span> * <span style="color:#0000FF;">$numeroB</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#008000;">/**</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * Divide dos números pasados por parámetro</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * @returns Regresa un valor numérico</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> dividir<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeroA</span>, <span style="color:#0000FF;">$numeroB</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeroA</span> / <span style="color:#0000FF;">$numeroB</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#008000;">/**</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * Este método es privado y no aparecerá en el browser de servicios</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * @returns Regresa la fecha y tiempo del servidor</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> _esteMetodoEsPrivado<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$fecha_hoy</span> = <a href="http://www.php.net/date"><span style="color:#000066;">date</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"d/m/Y"</span><span style="color:#006600; font-weight:bold;">&#41;</span> . <span style="color:#FF0000;">' '</span> . <a href="http://www.php.net/date"><span style="color:#000066;">date</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"H:i:s"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$fecha_hoy</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#008000;">/**</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * Este método es público y está accediendo a nuestro método privado</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; * @returns Regresa la fecha y tiempo del servidor</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp;&nbsp; */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> obtenFechaServidor<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$fecha_hoy</span> = <span style="color:#0000FF;">$this</span>-&gt;_esteMetodoEsPrivado<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$fecha_hoy</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>5. Crea un nuevo documento de Flash en Flash CS3 ActionScript 3.0. Cambia las dimensiones del área de trabajo por 300px de ancho y 190px de alto. Renombra la única capa que existe y ponle de nombre Forma. Agrega 3 textos, 3 TextInput(s) y 4 botones de tal forma que tu forma quede similar a la de la imagen:</p>
<div align="center"><img title="Imagen 2: Forma de nuestra aplicación" src="http://www.codigometropoli.com/images/screens/amfphp_flashcs3_2.jpg" alt="Imagen 2: Forma de nuestra aplicación" width="310" height="198" /></div>
<p></p>
<p>El nombre de instancia de cada uno de los TextInput(s) es (de arriba a abajo):</p>
<ul>
<li>numeroA_txt</li>
</ul>
<ul>
<li>numeroB_txt</li>
</ul>
<ul>
<li>resultado_txt</li>
</ul>
<p>El nombre de instancia de cada uno de los botones es (de arriba a abajo):</p>
<ul>
<li>mas_btn</li>
</ul>
<ul>
<li>menos_btn</li>
</ul>
<ul>
<li>por_btn</li>
</ul>
<ul>
<li>entre_btn</li>
</ul>
<p>6. Agrega otra capa y ponle de nombre <em>Acciones</em>. Agrega el siguiente código a dicha capa:</p>
<div class="igBar"><span id="lactionscript-84"><a href="#" onclick="javascript:showPlainTxt('actionscript-84'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-84">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* Las siguientes librerías son necesarias para hacer las llamadas y conexión a AMFPHP */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #0066CC;">NetConnection</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #006600;">Responder</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* Dentro de la variable gateway especificamos la URL completa de donde se encuentra nuestro archivo gateway.php. Si estás trabajando en local, es posible que tu URL sea similar a&nbsp; http://localhost/AMFPHP1.9/gateway.php */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> gateway:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">"http://localhost/AMFPHP1.9/gateway.php"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* Creamos una variable de tipo NetConnection para poder establecer la conexión. Este objeto funcionará como enlace entre el cliente y el servidor */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> conexion:<span style="color: #0066CC;">NetConnection</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">NetConnection</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* Establecemos una conexión bidireccional entre el Flash Player y el servidor */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">conexion.<span style="color: #0066CC;">connect</span><span style="color: #66cc66;">&#40;</span>gateway<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* Este objeto de clase Responder se encargará de administrar los valores que son regresados por el servidor, ya sea si la operación fue todo un éxito o si hubo un error */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> responder:Responder;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* Deshabilitamos el campo de texto donde se mostrará el resultado para que sea sólo de lectura */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resultado_txt.<span style="color: #0066CC;">enabled</span> = <span style="color: #000000; font-weight: bold;">false</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Revisa con atención el código anterior y los comentarios que están insertados en él. Hasta ahora solamente hemos importado las librerías que necesitamos, hemos declarado e instanciado las variables que usaremos a lo largo del programa.</p>
<p>Coloca el siguiente código debajo del anterior. Aquí estamos declarando cuatro métodos que serán llamados dependiendo de si el usuario hizo click en el botón de mas, menos, por o entre. Observa bien que el código de cada uno de estos métodos sólo cambia en la llamada de los métodos de la clase (la última línea de cada método, antes de }), es por eso que sólo comentaré la primera función (suma).</p>
<div class="igBar"><span id="lactionscript-85"><a href="#" onclick="javascript:showPlainTxt('actionscript-85'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-85">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> suma<span style="color: #66cc66;">&#40;</span>evento:MouseEvent<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* Obtenemos el valor ingresado en cada uno de los campos de texto&nbsp; */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> numeroA:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>numeroA_txt.<span style="color: #0066CC;">text</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> numeroB:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>numeroB_txt.<span style="color: #0066CC;">text</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* Le especificamos a la variable responder qué métodos debe llamar en caso de éxito (método respuesta) o en caso de error (método error)&nbsp; */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; responder = <span style="color: #000000; font-weight: bold;">new</span> Responder<span style="color: #66cc66;">&#40;</span>respuesta, <span style="color: #0066CC;">error</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* Invocamos, por medio del método call, al método sumar que se encuentra en la clase Calculadora (Calculadora.sumar). El segundo parámetro del método call es nuestro objeto de la clase Responder (el que se encargará de gestionar los valores obtenidos de dicha llamada. Por último, le pasamos como cuarto y quinto parámetro los dos números que deberá recibir la función sumar. */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; conexion.<span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Calculadora.sumar"</span>, responder, numeroA, numeroB<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:#2C442A;">
<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> resta<span style="color: #66cc66;">&#40;</span>evento:MouseEvent<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> numeroA:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>numeroA_txt.<span style="color: #0066CC;">text</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> numeroB:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>numeroB_txt.<span style="color: #0066CC;">text</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; operacion_mc.<span style="color: #0066CC;">gotoAndStop</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"menos"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; responder = <span style="color: #000000; font-weight: bold;">new</span> Responder<span style="color: #66cc66;">&#40;</span>respuesta, <span style="color: #0066CC;">error</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; conexion.<span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Calculadora.restar"</span>, responder, numeroA, numeroB<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:#2C442A;">
<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> multiplicacion<span style="color: #66cc66;">&#40;</span>evento:MouseEvent<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> numeroA:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>numeroA_txt.<span style="color: #0066CC;">text</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> numeroB:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>numeroB_txt.<span style="color: #0066CC;">text</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; operacion_mc.<span style="color: #0066CC;">gotoAndStop</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"por"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; responder = <span style="color: #000000; font-weight: bold;">new</span> Responder<span style="color: #66cc66;">&#40;</span>respuesta, <span style="color: #0066CC;">error</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; conexion.<span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Calculadora.multiplicar"</span>, responder, numeroA, numeroB<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:#2C442A;">
<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> division<span style="color: #66cc66;">&#40;</span>evento:MouseEvent<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> numeroA:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>numeroA_txt.<span style="color: #0066CC;">text</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> numeroB:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>numeroB_txt.<span style="color: #0066CC;">text</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; operacion_mc.<span style="color: #0066CC;">gotoAndStop</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"entre"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; responder = <span style="color: #000000; font-weight: bold;">new</span> Responder<span style="color: #66cc66;">&#40;</span>respuesta, <span style="color: #0066CC;">error</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; conexion.<span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Calculadora.dividir"</span>, responder, numeroA, numeroB<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Después del código anterior solamente nos faltan los métodos respuesta y error, además de las acciones de cada uno de nuestros botones:</p>
<div class="igBar"><span id="lactionscript-86"><a href="#" onclick="javascript:showPlainTxt('actionscript-86'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-86">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* En caso de éxito tras ejecutar el método call, esta función es llamada pasándole como parámetro un objeto con el resultado regresado. Este resultado lo mostraremos dentro del TextInput resultado_txt. */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> respuesta<span style="color: #66cc66;">&#40;</span>resultado:<span style="color: #0066CC;">Object</span><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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; resultado_txt.<span style="color: #0066CC;">text</span> = <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#40;</span>resultado<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* En caso de error tras ejecutar el método call, esta función es llamada pasándole como parámetro un objeto con el error generado. Este error lo desplegaremos dentro de un trace. */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">error</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">error</span>:<span style="color: #0066CC;">Object</span><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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Error: "</span> + <span style="color: #0066CC;">error</span>.<span style="color: #006600;">description</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:#2C442A;">
<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* Establecemos las acciones de nuestros botones */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mas_btn.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, suma<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">menos_btn.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, resta<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">por_btn.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, multiplicacion<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">entre_btn.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, division<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>A continuación puedes ver el SWF funcionando. A este archivo le añadí un campo de texto dinámico en el lado inferior derecho en el cual muestro el resultado de hacer una llamada al método <em>obtenFechaServidor</em> de nuestra clase Calculadora. No olvides bajar los archivos de este tutorial que se encuentran al final de esta entrada.</p>
<div align="center" style="margin-top:0px"><script type="text/javascript"><!--
      google_ad_client = "pub-5808310808246221";
      /* 250x250, Posts */
      google_ad_slot = "8254875600";
      google_ad_width = 250;
      google_ad_height = 250;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></div>
<div align="center" style="margin-top:30px; margin-bottom:20px; border:1px solid #000000; width=300px; height=220px;">
<object type="application/x-shockwave-flash" width="300" height="220">
<param name="movie" value=" http://codigometropoli.com/wp-content/uploads/2008/09/introduccion-a-amfphp.swf" />
<embed src=" http://codigometropoli.com/wp-content/uploads/2008/09/introduccion-a-amfphp.swf" type="application/x-shockwave-flash" width="300" height="220" >
</object>
</div>
<div style="margin-top:30px; margin-bottom:20px;" align="center">
<table border="0" cellspacing="0" cellpadding="0" width="180">
<tbody>
<tr>
<td valign="top"><a href="http://codigometropoli.com/wp-content/uploads/descarga.php?file=2008/09/introduccion-a-amfphp.zip"><img src="http://codigometropoli.com/images/descargar_archivo.jpg" alt="Descargar Archivo" /></a></td>
</tr>
</tbody>
</table>
</div>
<div style="margin-top:40px; margin-bottom:30px;">
<p><strong>Enlaces recomendados:</strong></p>
<p>» <a href="http://www.amfphp.org/" target="_blank">Sitio del AMFPHP</a><br />
» <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/NetConnection.html" target="_blank">ActionScript 3.0 Language and Components Reference (Clase NetConnection) </a></div>

<p><a href="http://feedads.g.doubleclick.net/~a/lJUs8CEcwSSJA6sLNYC8Sw2y3IA/0/da"><img src="http://feedads.g.doubleclick.net/~a/lJUs8CEcwSSJA6sLNYC8Sw2y3IA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/lJUs8CEcwSSJA6sLNYC8Sw2y3IA/1/da"><img src="http://feedads.g.doubleclick.net/~a/lJUs8CEcwSSJA6sLNYC8Sw2y3IA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/feedburner/ERTc/~4/yshNJ-5s-lg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codigometropoli.com/introduccion-a-amfphp/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.codigometropoli.com/introduccion-a-amfphp/</feedburner:origLink></item>
		<item>
		<title>Sistema de Clientes (AIR y SQLite) Parte IV (Consulta a la base de datos)</title>
		<link>http://feedproxy.google.com/~r/feedburner/ERTc/~3/5A-jPbNyn7A/</link>
		<comments>http://www.codigometropoli.com/sistema-de-clientes-parte-iv/#comments</comments>
		<pubDate>Wed, 10 Sep 2008 05:30:04 +0000</pubDate>
		<dc:creator>Carla Macías</dc:creator>
		
		<category><![CDATA[AIR]]></category>

		<category><![CDATA[Proyectos]]></category>

		<category><![CDATA[Base de datos]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Proyecto]]></category>

		<category><![CDATA[Sistema]]></category>

		<guid isPermaLink="false">http://www.codigometropoli.com/?p=350</guid>
		<description><![CDATA[Esta es la cuarta y última parte del proyecto "Sistema de Clientes" desarrollado en AIR con SQLite como administrador de base de datos. En la entrada anterior vimos cómo modificar y eliminar registros en la base de datos (clientesDB.sqlite) desde nuestra aplicación en AIR.

En esta ocasión veremos cómo realizar consultas de los registros en la [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="float: right;" src="http://codigometropoli.com/images/air_sticker.jpg" alt="Adobe AIR" width="93" height="93" />Esta es la cuarta y última parte del proyecto "Sistema de Clientes" desarrollado en AIR con SQLite como administrador de base de datos. En la <a href="http://www.codigometropoli.com/sistema-de-clientes-parte-iii/" target="_blank">entrada</a> anterior vimos cómo modificar y eliminar registros en la base de datos (<em>clientesDB.sqlite</em>) desde nuestra aplicación en AIR.</p>
<p><span id="more-350"></span></p>
<p>En esta ocasión veremos cómo realizar consultas de los registros en la base de datos; para esto crearemos una forma en la cual el usuario puede introducir el nombre, teléfono o correo del cliente que está buscando. Los resultados de esta consulta los escribiremos en un archivo HTML y lo mostraremos dentro del componente <strong>HTML </strong>(aprovechando el <a href="http://www.codigometropoli.com/crear-archivo-en-air-con-flex-builder-3/" target="_blank">post</a> que publiqué hace ya tiempo sobre cómo crear un archivo en AIR).</p>
<p><span style="color: #ff0000;"><strong>Parte 4: Consulta a la base de datos en SQLite con AIR</strong></span></p>
<p>Recuerda que para mantener organizado el código de nuestro proyecto y para evitar que se pierdan con toda la información aquí mostrada, dividí el código del proyecto en archivos .as. Estos archivos estarán almacenados en la carpeta actionscript. La estructura de nuestro proyecto será la siguiente:</p>
<div align="center">
<div class="wp-caption aligncenter" style="width: 255px"><img title="Imagen 1: Estructura de la aplicación" src="http://www.codigometropoli.com/wp-content/uploads/2008/08/proy1image1.jpg" alt="Imagen 1: Estructura de la aplicación" width="245" height="373" />
<p class="wp-caption-text">Imagen 1: Estructura de la aplicación</p>
</div>
</div>
<p>Todas las interfaces de este proyecto están incluidas en la carpeta <em>componentes</em>. La interfaz que en esta ocasión veremos es la del archivo <em>ConsultaClientes.mxml</em>. Esta interfaz funciona de la siguiente manera:</p>
<div align="center">
<div class="wp-caption aligncenter" style="width: 391px"><a href="http://www.codigometropoli.com/images/screens/proy1image7.jpg" target="_blank"><img alt="Imagen 2: Interfaz del usuario" src="http://www.codigometropoli.com/images/previews/proy1image7.jpg" title="Imagen 2: Interfaz del usuario" width="381" height="295" /></a><p class="wp-caption-text">Imagen 2: Interfaz del usuario</p></div>
</div>
<p>Al seleccionar la opción "Consultar…" del menú, se mostrará una forma con tres campos de texto, en donde el usuario podrá introducir el nombre, teléfono y correo del cliente que está buscando. Además, en la forma tendremos el botón de <em>Mostrar</em>el cual ejecutará la búsqueda. Los resultados serán mostrados dentro del rectángulo que ves en la parte de abajo de la imagen anterior.</p>
<p>Una vez que el usuario ejecute al búsqueda, si no se encontraron registros que coincidan con los datos buscados, el sistema mostrará dentro del archivo HTML la leyenda "<em>No se encontraron resultados</em>". En caso contrario, el sistema mostrará los resultados de forma similar a la mostrada a continuación:</p>
<div align="center">
<div class="wp-caption aligncenter" style="width: 389px"><a href="http://www.codigometropoli.com/images/screens/proy1image8.jpg" target="_blank"><img alt="Imagen 2: Interfaz del usuario" src="http://www.codigometropoli.com/images/previews/proy1image8.jpg" title="Imagen 3: Resultado de la consulta" width="379" height="267" /></a><p class="wp-caption-text">Imagen 2: Interfaz del usuario</p></div>
</div>
<p>Dicho lo anterior, comenzaremos mostrando la estructura y el código del archivo <em>ConsultaClientes.mxml</em>:</p>
<ul>
<li>El <strong>ID</strong> del <strong>TextInput</strong> Nombre es <em>nombre_txt</em></li>
<li>El <strong>ID</strong> del <strong>TextInput</strong> Correo es <em>correo_txt</em></li>
<li>El <strong>ID</strong> del <strong>TextInput</strong> Teléfono es <em>teléfono_txt</em></li>
<li>El <strong>ID</strong> del componente <strong>HTML</strong> es <em>HTMLLoader</em></li>
</ul>
<p>El código de este  archivo  es el siguiente:</p>
<div class="igBar"><span id="lactionscript-92"><a href="#" onclick="javascript:showPlainTxt('actionscript-92'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-92">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;?<span style="color: #0066CC;">xml</span> <span style="color: #0066CC;">version</span>=<span style="color: #ff0000;">"1.0"</span> encoding=<span style="color: #ff0000;">"utf-8"</span>?&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;mx:Canvas <span style="color: #0066CC;">show</span>=<span style="color: #ff0000;">"abreConexion();"</span> xmlns:mx=<span style="color: #ff0000;">"http://www.adobe.com/2006/mxml"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"100%"</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">"100%"</span> <span style="color: #0066CC;">backgroundColor</span>=<span style="color: #ff0000;">"#FFFFFF"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;mx:Script source=<span style="color: #ff0000;">"../actionscript/ConsultarCliente.as"</span>/&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;mx:Label y=<span style="color: #ff0000;">"13"</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">"Consulta de Clientes"</span> <span style="color: #0066CC;">right</span>=<span style="color: #ff0000;">"75"</span> <span style="color: #0066CC;">left</span>=<span style="color: #ff0000;">"55"</span> textAlign=<span style="color: #ff0000;">"center"</span> fontWeight=<span style="color: #ff0000;">"bold"</span> fontSize=<span style="color: #ff0000;">"14"</span> fontFamily=<span style="color: #ff0000;">"Verdana"</span> <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">"#F64507"</span>/&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;mx:Label y=<span style="color: #ff0000;">"61"</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">"Mostrar clientes por:"</span> textAlign=<span style="color: #ff0000;">"left"</span> fontWeight=<span style="color: #ff0000;">"normal"</span> fontSize=<span style="color: #ff0000;">"12"</span> fontFamily=<span style="color: #ff0000;">"Verdana"</span> <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">"#000000"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"151"</span> x=<span style="color: #ff0000;">"31"</span> textDecoration=<span style="color: #ff0000;">"underline"</span>/&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;mx:Label y=<span style="color: #ff0000;">"89"</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">"Nombre:"</span> textAlign=<span style="color: #ff0000;">"left"</span> fontWeight=<span style="color: #ff0000;">"normal"</span> fontSize=<span style="color: #ff0000;">"12"</span> fontFamily=<span style="color: #ff0000;">"Verdana"</span> <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">"#000000"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"83"</span> x=<span style="color: #ff0000;">"62"</span>/&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;mx:Label y=<span style="color: #ff0000;">"119"</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">"Correo:"</span> textAlign=<span style="color: #ff0000;">"left"</span> fontWeight=<span style="color: #ff0000;">"normal"</span> fontSize=<span style="color: #ff0000;">"12"</span> fontFamily=<span style="color: #ff0000;">"Verdana"</span> <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">"#000000"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"65"</span> x=<span style="color: #ff0000;">"62"</span>/&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;mx:Label y=<span style="color: #ff0000;">"89"</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">"Teléfono:"</span> textAlign=<span style="color: #ff0000;">"left"</span> fontWeight=<span style="color: #ff0000;">"normal"</span> fontSize=<span style="color: #ff0000;">"12"</span> fontFamily=<span style="color: #ff0000;">"Verdana"</span> <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">"#000000"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"74"</span> x=<span style="color: #ff0000;">"285"</span>/&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;mx:<span style="color: #0066CC;">Button</span> x=<span style="color: #ff0000;">"415"</span> y=<span style="color: #ff0000;">"119"</span> label=<span style="color: #ff0000;">"Mostrar"</span> click=<span style="color: #ff0000;">"generaConsulta();"</span>/&gt;&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;mx:<span style="color: #0066CC;">HTML</span> <span style="color: #0066CC;">focusEnabled</span>=<span style="color: #ff0000;">"false"</span> id=<span style="color: #ff0000;">"HTMLLoader"</span> borderStyle=<span style="color: #ff0000;">"solid"</span> <span style="color: #0066CC;">left</span>=<span style="color: #ff0000;">"31"</span> top=<span style="color: #ff0000;">"171"</span> <span style="color: #0066CC;">right</span>=<span style="color: #ff0000;">"31"</span> bottom=<span style="color: #ff0000;">"21"</span>/&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;mx:TextInput y=<span style="color: #ff0000;">"89"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"130"</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">"21"</span> id=<span style="color: #ff0000;">"nombre_txt"</span> fontSize=<span style="color: #ff0000;">"10"</span> fontFamily=<span style="color: #ff0000;">"Verdana"</span> x=<span style="color: #ff0000;">"123"</span>/&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;mx:TextInput y=<span style="color: #ff0000;">"89"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"130"</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">"21"</span> id=<span style="color: #ff0000;">"telefono_txt"</span> fontSize=<span style="color: #ff0000;">"10"</span> fontFamily=<span style="color: #ff0000;">"Verdana"</span> x=<span style="color: #ff0000;">"355"</span>/&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;mx:TextInput y=<span style="color: #ff0000;">"119"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"130"</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">"21"</span> id=<span style="color: #ff0000;">"correo_txt"</span> fontSize=<span style="color: #ff0000;">"10"</span> fontFamily=<span style="color: #ff0000;">"Verdana"</span> x=<span style="color: #ff0000;">"123"</span>/&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/mx:Canvas&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Observa en el código anterior que el tag principal de este archivo es <strong>&lt;mx:Canvas&gt;</strong> y no <strong>&lt;mx:WindowedApplication&gt;</strong>, esto es porque todas las interfaces que están dentro del directorio componentes las desplegaremos dentro de la aplicación principal (<em>Sistema_Clientes.mxml</em>); a la propiedad <strong>show</strong> del <strong>Canvas</strong> le estamos especificando que llame a la función  <em>abreConexion() </em>una vez que se haya terminado de mostrar el componente. También observa cómo estamos incluyendo el código de <em>ConsultarCliente.as</em>:</p>
<div class="igBar"><span id="lactionscript-93"><a href="#" onclick="javascript:showPlainTxt('actionscript-93'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-93">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;mx:Script source=<span style="color: #ff0000;">"../actionscript/ConsultarCliente.as"</span>/&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Dentro del código del botón <em>Mostrar</em> hacemos la llamada a la función <em>generaConsulta</em> una vez que el usuario haya hecho click en dicho botón. El código de esta función (<em>generaConsulta</em>) y de la función principal (<em>abreConexion</em>) se encuentra dentro del archivo ConsultarCliente.as:</p>
<div class="igBar"><span id="lactionscript-94"><a href="#" onclick="javascript:showPlainTxt('actionscript-94'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-94">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* Importamos todas las librerías y clases que necesitamos. La clase HTMLTags la hice para establecer el código de cada elemento del archivo HTML, así como los estilos que usa dicho archivo; esta clase la veremos más adelante. */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> clases.<span style="color: #006600;">HTMLTags</span>;&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">SQLConnection</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">SQLErrorEvent</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">SQLEvent</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">filesystem</span>.<span style="color: #006600;">File</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">html</span>.<span style="color: #006600;">HTMLLoader</span>;&nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">Alert</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* Es importante establecer el tipo de codficación (encodeType) para que, al momento de escribir y generar el archivo, se muestren los acentos correctamente.&nbsp; */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<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> _encodeType:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">"iso-8859-1"</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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> conexion:SQLConnection;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<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> database:File;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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> stream:FileStream = <span style="color: #000000; font-weight: bold;">new</span> FileStream<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">/* Declaramos una variable de tipo FileStream para poder crear y escribir en el archivo */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<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> htmlElements:HTMLTags = <span style="color: #000000; font-weight: bold;">new</span> HTMLTags<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<span style="color: #808080; font-style: italic;">/* Este es un objeto de nuestra clase HTMLTags */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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> queryStatement:SQLStatement = <span style="color: #000000; font-weight: bold;">new</span> SQLStatement<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:#2C442A;">
<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> abreConexion<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp;&nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;database = <span style="color: #000000; font-weight: bold;">new</span> File<span style="color: #66cc66;">&#40;</span>File.<span style="color: #006600;">applicationStorageDirectory</span>.<span style="color: #006600;">nativePath</span> + <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\d</span>atabase<span style="color: #000099; font-weight: bold;">\c</span>lientesDB.sqlite"</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;conexion = <span style="color: #000000; font-weight: bold;">new</span> SQLConnection<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;conexion.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>SQLEvent.<span style="color: #006600;">OPEN</span>, dbAbrirConexion<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;conexion.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>SQLErrorEvent.<span style="color: #0066CC;">ERROR</span>, dbErrorConexion<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;conexion.<span style="color: #006600;">open</span><span style="color: #66cc66;">&#40;</span>database<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:#2C442A;">
<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<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> dbAbrirConexion<span style="color: #66cc66;">&#40;</span>event:SQLEvent<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<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> dbErrorConexion<span style="color: #66cc66;">&#40;</span><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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"No se pudo conectar a la base de datos"</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Después de haber importado las librerías necesarias y de haber declarado nuestras variables, escribimos el código de la función <em>abreConexion</em>. Esta función la hemos estado utilizando en las entradas anteriores, por lo que su código no debería causarte ruido.</p>
<p>Antes de ver el código de la función <em>generaConsulta</em>, mostraré el código de la clase HTMLTags:</p>
<div class="igBar"><span id="lactionscript-95"><a href="#" onclick="javascript:showPlainTxt('actionscript-95'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-95">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package clases</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<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:#2C442A;">
<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;">class</span> HTMLTags</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> HTMLTags<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getEndTags<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> _texto:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">'&lt;/body&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;/html&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> _texto;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getRulerTag<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> _texto:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">'&lt;hr class=&quot;Ruler&quot; /&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> _texto;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getFirstTags<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> _texto:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">'&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&lt;head&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-2&quot; /&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&lt;title&gt;Consulta: Tarjetas&lt;/title&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&lt;style&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'body {<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp;font:Arial, Helvetica, sans-serif;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp;font-family:Arial, Helvetica, sans-serif;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp;font-size:12px;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp;margin-left:30px;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'}<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'hr.Ruler {<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp;margin-left:-20px !important;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp;color:#003366;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp;border:1px solid #003366;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp;background-color:#003366;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp;width:800px;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'}<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'.Estilo3 {<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp;color: #993300;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp;font-weight: bold;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp;font-size: 14px;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'}<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'.Estilo4 {font-size: 12px; color: #666666;}<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'.Tabla_Datos td {<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp;height:25px;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'}<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&lt;/style&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&lt;/head&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +&nbsp; &nbsp;&nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&lt;body&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> _texto;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getTitleTags<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> _texto:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">'&lt;br /&gt;&lt;span class=&quot;Estilo3&quot;&gt;'</span> + <span style="color: #0066CC;">name</span> + <span style="color: #ff0000;">'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> _texto;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getTable1Tags<span style="color: #66cc66;">&#40;</span>nombre:<span style="color: #0066CC;">String</span>, direccion:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> _texto:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">'&lt;table class=&quot;Tabla_Datos&quot; width=&quot;700&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &lt;tr&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp; &lt;td&gt;&lt;strong&gt;Nombre:&lt;/strong&gt;&lt;/td&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp; &lt;td&gt;'</span> + nombre + <span style="color: #ff0000;">'&lt;/td&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp; &lt;td&gt;&lt;strong&gt;Dirección:&lt;/strong&gt;&lt;/td&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp; &lt;td&gt;'</span> + direccion + <span style="color: #ff0000;">'&lt;/td&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &lt;/tr&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> _texto;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getTable2Tags<span style="color: #66cc66;">&#40;</span>telefono:<span style="color: #0066CC;">String</span>, correo:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> _texto:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">''</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &lt;tr&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp; &lt;td&gt;&lt;strong&gt;Teléfono:&lt;/strong&gt;&lt;/td&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp; &lt;td&gt;'</span> + telefono + <span style="color: #ff0000;">'&lt;/td&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp; &lt;td&gt;&lt;strong&gt;Correo:&lt;/strong&gt;&lt;/td&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &nbsp; &lt;td&gt;'</span> + correo + <span style="color: #ff0000;">'&lt;/td&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&nbsp; &lt;/tr&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'&lt;/table&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> _texto;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &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:#2C442A;">
<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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Como pudiste observar en el código anterior, esta clase lo único que hace es regresarnos los tags del documento HTML que vamos a generar. Por ejemplo, la función <em>getFirstTags</em> nos regresa los primeros elementos que debe llevar el archivo HTML (los tags &lt;html&gt;, &lt;head&gt;, &lt;meta&gt; y los estilos que usaremos &lt;style&gt;). La función <em>getTitleTags</em> la mandaremos a llamar cada vez que recorramos un nuevo registro, le pasaremos como parámetro un texto de tipo "Cliente N" donde N es el valor de un contador que pondremos en el código (Cliente #1, Cliente #2, etc.) y nos regresará un texto con los tags y estilo que debe llevar. A la función <em>getTable1Tags</em> le estamos pasando como parámetro el nombre y la dirección del cliente, y ésta a su vez nos está regresando la información en forma de tabla con el código en HTML. Lo mismo sucede con la función <em>getTable2Tags</em>. La función <em>getRulerTag</em> nos regresa el tag &lt;hr&gt; para mostrar una línea horizontal. Por último, la función <em>getEndTags</em> nos regresa un texto con los tags que nos faltaban por cerrar (&lt;/body&gt; y &lt;/html&gt;).</p>
<p>Ahora veremos el código de generaConsulta. Presta atención en los comentarios que se encuentran dentro del código:</p>
<div class="igBar"><span id="lactionscript-96"><a href="#" onclick="javascript:showPlainTxt('actionscript-96'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-96">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<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> generaConsulta<span style="color: #66cc66;">&#40;</span><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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> prep:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">" WHERE "</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; queryStatement.<span style="color: #006600;">clearParameters</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; queryStatement.<span style="color: #006600;">sqlConnection</span> = conexion;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> genericQuery:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">"SELECT * FROM cliente "</span>; <span style="color: #808080; font-style: italic;">/* Seleccionamos todas las columnas del registro */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>nombre_txt.<span style="color: #0066CC;">text</span> != <span style="color: #ff0000;">""</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">/* Si el usuario sí escribió algo en el campo de texto nombre_txt */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; genericQuery += prep + <span style="color: #ff0000;">" nombre LIKE '%"</span> + nombre_txt.<span style="color: #0066CC;">text</span> + <span style="color: #ff0000;">"%'"</span>; <span style="color: #808080; font-style: italic;">/* Adjuntamos al query el valor del campo de texto nombre */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prep = <span style="color: #ff0000;">" AND "</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>correo_txt.<span style="color: #0066CC;">text</span> != <span style="color: #ff0000;">""</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">/* Si el usuario sí escribió algo en el campo de texto correo_txt */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; genericQuery += prep + <span style="color: #ff0000;">" email LIKE '%"</span> + correo_txt.<span style="color: #0066CC;">text</span> + <span style="color: #ff0000;">"%'"</span>; <span style="color: #808080; font-style: italic;">/* Adjuntamos al query el valor del campo de texto correo */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prep = <span style="color: #ff0000;">" AND "</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>telefono_txt.<span style="color: #0066CC;">text</span> != <span style="color: #ff0000;">""</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">/* Si el usuario sí escribió algo en el campo de texto telefono_txt */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; genericQuery += prep + <span style="color: #ff0000;">" telefono LIKE '%"</span> + telefono_txt.<span style="color: #0066CC;">text</span> + <span style="color: #ff0000;">"%'"</span>; <span style="color: #808080; font-style: italic;">/* Adjuntamos al query el valor del campo de texto telefono */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prep = <span style="color: #ff0000;">" AND "</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; genericQuery += <span style="color: #ff0000;">" ORDER BY nombre asc"</span>; <span style="color: #808080; font-style: italic;">/* Le especificamos al query que los resultados los ordene de manera ascendente de acuerdo al nombre del cliente */</span>&nbsp;&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; queryStatement.<span style="color: #0066CC;">text</span> = genericQuery; <span style="color: #808080; font-style: italic;">// Asignamos la variable del query al SQLStatement</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">try</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; queryStatement.<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// Ejecutamos la consulta</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* Este será el archivo HTML que estamos creando. Su nombre es ConsultaCliente.html y se encontrará dentro de la carpeta HTML */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> htmlFile:File = <span style="color: #000000; font-weight: bold;">new</span> File<span style="color: #66cc66;">&#40;</span>File.<span style="color: #006600;">applicationStorageDirectory</span>.<span style="color: #006600;">nativePath</span> + <span style="color: #ff0000;">"/HTML/ConsultaCliente.html"</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>stream != <span style="color: #000000; font-weight: bold;">null</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stream.<span style="color: #0066CC;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">/* Cerramos el stream si es que existe */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stream = <span style="color: #000000; font-weight: bold;">new</span> FileStream<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stream.<span style="color: #006600;">open</span><span style="color: #66cc66;">&#40;</span>htmlFile, FileMode.<span style="color: #006600;">WRITE</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">/* Abrimos el stream en modo de escritura */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stream.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>IOErrorEvent.<span style="color: #006600;">IO_ERROR</span>, writeIOErrorHandler<span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">/* Establecemos un listener para detectar el evento */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> result:SQLResult = queryStatement.<span style="color: #006600;">getResult</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">/* Obtenemos los resultados regresados por la consulta */</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>result.<span style="color: #0066CC;">data</span> != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// Si existen resultados... </span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> numResults:<span style="color: #0066CC;">int</span> = result.<span style="color: #0066CC;">data</span>.<span style="color: #0066CC;">length</span>; <span style="color: #808080; font-style: italic;">// Determinamos el total de resultados regresados</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stream.<span style="color: #006600;">writeUTFBytes</span><span style="color: #66cc66;">&#40;</span>htmlElements.<span style="color: #006600;">getFirstTags</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">/* Escribimos en el archivo el texto regresado por la clase HTMLTags en su función getFirstTags */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;color:#800000;">0</span>; i &lt;numResults; i++<span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">// Hacemos un ciclo para recorrer todos los registros obtenidos</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> row:<span style="color: #0066CC;">Object</span> = result.<span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; row.<span style="color: #006600;">nombre</span>;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* Esta parte entraría a un ciclo */</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stream.<span style="color: #006600;">writeMultiByte</span><span style="color: #66cc66;">&#40;</span>htmlElements.<span style="color: #006600;">getTitleTags</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Cliente #"</span> + <span style="color: #66cc66;">&#40;</span>i + <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>, _encodeType<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stream.<span style="color: #006600;">writeMultiByte</span><span style="color: #66cc66;">&#40;</span>htmlElements.<span style="color: #006600;">getTable1Tags</span><span style="color: #66cc66;">&#40;</span>row.<span style="color: #006600;">nombre</span>, row.<span style="color: #006600;">direccion</span><span style="color: #66cc66;">&#41;</span>, _encodeType<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stream.<span style="color: #006600;">writeMultiByte</span><span style="color: #66cc66;">&#40;</span>htmlElements.<span style="color: #006600;">getTable2Tags</span><span style="color: #66cc66;">&#40;</span>row.<span style="color: #006600;">telefono</span>, row.<span style="color: #006600;">email</span><span style="color: #66cc66;">&#41;</span>, _encodeType<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stream.<span style="color: #006600;">writeUTFBytes</span><span style="color: #66cc66;">&#40;</span>htmlElements.<span style="color: #006600;">getRulerTag</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:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* Esta parte entraría a un ciclo */</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;stream.<span style="color: #006600;">writeUTFBytes</span><span style="color: #66cc66;">&#40;</span>htmlElements.<span style="color: #006600;">getEndTags</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&nbsp; &nbsp;&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; stream.<span style="color: #006600;">writeUTFBytes</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"No se encontraron resultados"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;stream.<span style="color: #0066CC;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">catch</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">error</span>:SQLError<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Error: "</span> + <span style="color: #0066CC;">error</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</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:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* Si todo salió bien, ahora podremos mostrar el archivo html en nuestro HTMLLoader */</span>&nbsp;&nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; HTMLLoader.<span style="color: #006600;">location</span> = File.<span style="color: #006600;">applicationStorageDirectory</span>.<span style="color: #006600;">nativePath</span> + <span style="color: #ff0000;">"/HTML/ConsultaCliente.html"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Observa que al final estamos especificando al control <strong>HTML</strong> (cuyo <strong>ID</strong> es <em>HTMLLoader</em>) el archivo HTML que debe mostrar (ConsultaCliente.html dentro de la carpeta HTML).</p>
<p>Hemos llegado al final de esta cuarta parte y de todas las entregas, no olvides bajar los archivos que se encuentran más abajo.</p>
<div align="center" style="margin-top:0px"><script type="text/javascript"><!--
      google_ad_client = "pub-5808310808246221";
      /* 250x250, Posts */
      google_ad_slot = "8254875600";
      google_ad_width = 250;
      google_ad_height = 250;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></div>
<div style="margin-top:30px; margin-bottom:20px;" align="center">
<table border="0" cellspacing="0" cellpadding="0" width="180">
<tbody>
<tr>
<td valign="top"><a href="http://codigometropoli.com/wp-content/uploads/descarga.php?file=2008/09/Sistema_Clientes.zip"><img src="../images/descargar_archivo.jpg" alt="Descargar Archivo" /></a></td>
</tr>
</tbody>
</table>
</div>
<div style="margin-top:40px; margin-bottom:30px;">
<p><strong>Enlaces recomendados:</strong></p>
<p>» <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=SQL_01.html" target="_blank">Working with local SQL databases</a><br />
» <a href="http://livedocs.adobe.com/flex/3/langref/index.html" target="_blank">Adobe® Flex® 3 Language Reference</a></div>

<p><a href="http://feedads.g.doubleclick.net/~a/jiBMWIBl3ecNdFOu9Zn9A9TAT2E/0/da"><img src="http://feedads.g.doubleclick.net/~a/jiBMWIBl3ecNdFOu9Zn9A9TAT2E/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/jiBMWIBl3ecNdFOu9Zn9A9TAT2E/1/da"><img src="http://feedads.g.doubleclick.net/~a/jiBMWIBl3ecNdFOu9Zn9A9TAT2E/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/feedburner/ERTc/~4/5A-jPbNyn7A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codigometropoli.com/sistema-de-clientes-parte-iv/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.codigometropoli.com/sistema-de-clientes-parte-iv/</feedburner:origLink></item>
	</channel>
</rss>
