<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Código Metrópoli &#187; Flex</title>
	<atom:link href="http://www.codigometropoli.com/category/flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codigometropoli.com</link>
	<description>Programación para Super Héroes</description>
	<lastBuildDate>Tue, 08 Jun 2010 00:30:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Sistema de Gastos en Flex con AMFPHP y MySQL</title>
		<link>http://www.codigometropoli.com/sistema-de-gastos-en-flex-con-amfphp-y-mysql/</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-11"><a href="#" onclick="javascript:showPlainTxt('sql-11'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-11">
<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-12"><a href="#" onclick="javascript:showPlainTxt('php-12'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-12">
<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-13"><a href="#" onclick="javascript:showPlainTxt('actionscript-13'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-13">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#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-14"><a href="#" onclick="javascript:showPlainTxt('actionscript-14'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-14">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#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-15"><a href="#" onclick="javascript:showPlainTxt('actionscript-15'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-15">
<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-16"><a href="#" onclick="javascript:showPlainTxt('actionscript-16'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-16">
<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-17"><a href="#" onclick="javascript:showPlainTxt('actionscript-17'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-17">
<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-18"><a href="#" onclick="javascript:showPlainTxt('actionscript-18'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-18">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#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-19"><a href="#" onclick="javascript:showPlainTxt('actionscript-19'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-19">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#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-20"><a href="#" onclick="javascript:showPlainTxt('actionscript-20'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-20">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#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="_blank"><img title="Ver Ejempo" src="http://codigometropoli.com/images/ver_ejemplo.jpg" alt="Ver Ejemplo" /></a></td>
<td valign="top"><a href="http://www.megaupload.com/?d=DM0QBFMO" target="_blank"><img title="Descargar Archivo" src="../images/descargar_archivo.jpg" alt="Descargar Archivo" /></a></td>
</tr>
</tbody>
</table>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.codigometropoli.com/sistema-de-gastos-en-flex-con-amfphp-y-mysql/feed/</wfw:commentRss>
		<slash:comments>47</slash:comments>
		</item>
		<item>
		<title>Componente DataGrid</title>
		<link>http://www.codigometropoli.com/componente-datagrid/</link>
		<comments>http://www.codigometropoli.com/componente-datagrid/#comments</comments>
		<pubDate>Mon, 18 Aug 2008 21:12:26 +0000</pubDate>
		<dc:creator>Carla Macías</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Componente]]></category>
		<category><![CDATA[DataGrid]]></category>

		<guid isPermaLink="false">http://www.codigometropoli.com/?p=248</guid>
		<description><![CDATA[El componente DataGrid nos permite listar información dentro de un control formado por renglones y columnas. Tiene la propiedad de añadir un scrollbar horizontal o vertical en caso de que la información no se muestre completamente dentro de las dimensiones establecidas del DataGrid. Este componente es ideal para mostrar objetos que  tienen varias propiedades, [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="float: right;" src="http://codigometropoli.com/images/flex_sticker.jpg" alt="Flash y PHP" width="93" height="93" />El componente DataGrid nos permite listar información dentro de un control formado por renglones y columnas. Tiene la propiedad de añadir un scrollbar horizontal o vertical en caso de que la información no se muestre completamente dentro de las dimensiones establecidas del DataGrid. Este componente es ideal para mostrar objetos que  tienen varias propiedades, por ejemplo un arreglo que contiene la información obtenida de un query o consulta a una base de datos.</p>
<p><span id="more-248"></span></p>
<p>Este control tiene las siguientes propiedades:</p>
<ul>
<li> Columnas con diferente o igual tamaño</li>
<li>Columnas cuyo tamaño el usuario puede agrandar o disminuir en tiempo de ejecución</li>
<li>Columnas que el usuario puede reordenar en tiempo de ejecución</li>
<li>Las cabeceras de las columnas pueden ser personalizables</li>
<li>Usar un "Item Renderer"específico para mostrar datos, que no sean texto, dentro de cualquier columna. Por ejemplo, podemos crear un Item Rendender para mostrar botones, combobox, botones de radio, iconos, etc. dentro de una columna.</li>
<li>Ordenar la información mostrada en el DataGrid de acuerdo al criterio de alguna columna en específico.</li>
</ul>
<p>Si deseas conocer todos los métodos y propiedades que conforman la clase DataGrid, ingresa a la siguiente página y de lado inferior izquierdo, dentro de la lista "<strong>All Classes</strong>" busca la clase DataGrid. Esta clase pertenece al paquete <strong>mx.controls</strong>, por lo que también podrías llegar a la información de la clase DataGrid haciendo click en la parte superior izquierda (Packages) en donde dice <strong>mx.controls</strong>.</p>
<p><span style="color: #560e00; text-decoration: underline;"><strong>Tutorial</strong></span></p>
<p>Abre el programa <strong>Flex Builder 3</strong> y crea un nuevo proyecto (Flex Project) con el nombre DataGridControl. No olvides seleccionar la opción "Web application" como tipo de aplicación (Application type).<br />
En el panel <strong>Components</strong>, dentro de la sección <strong>Controls</strong>, busca el control <strong>DataGrid </strong>y arrástralo al área de trabajo. Selecciona el <strong>DataGrid </strong>que tienes en el área de trabajo y dentro del panel <strong>Properties </strong>asígnale el ID de <em>productos_dg</em>.</p>
<p>Haz click en el botón <strong>Source </strong>para cambiarte de la vista de diseño a la vista de código. Observarás que el programa creó automáticamente el código del <strong>DataGrid</strong>; este código es similar a:</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;">&lt;mx:DataGrid x=<span style="color: #ff0000;">"204"</span> y=<span style="color: #ff0000;">"135"</span> id=<span style="color: #ff0000;">"productos_dg"</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:columns&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; &nbsp; &nbsp; &lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Column 1"</span> dataField=<span style="color: #ff0000;">"col1"</span>/&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Column 2"</span> dataField=<span style="color: #ff0000;">"col2"</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; &nbsp; &nbsp; &lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Column 3"</span> dataField=<span style="color: #ff0000;">"col3"</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:columns&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;">&lt;/mx:DataGrid&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Como podrás darte cuenta, este DataGrid recién creado está formado por tres columnas (cada <strong>DataGridColumn </strong>que se encuentra dentro de los tags <strong>mx:columns</strong>). El encabezado  por default de estas columnas es <em>Column 1</em>, <em>Column 2</em> y <em>Column 3</em>. Agrega una nueva columna y cambiales el nombre por <em>Producto</em>, <em>Precio Unitario</em>, <em>Cantidad </em>y <em>Total</em>. El código quedará de la siguiente forma:</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;">&lt;mx:DataGrid x=<span style="color: #ff0000;">"278.5"</span> y=<span style="color: #ff0000;">"46"</span> id=<span style="color: #ff0000;">"productos_dg"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"638"</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">"281"</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:columns&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; &nbsp; &nbsp; &lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Título DVD"</span> dataField=<span style="color: #ff0000;">"titulo"</span>/&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Protagonistas"</span> dataField=<span style="color: #ff0000;">"protagonistas"</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; &nbsp; &nbsp; &lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Precio"</span> dataField=<span style="color: #ff0000;">"precio"</span>/&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Año"</span> dataField=<span style="color: #ff0000;">"fecha"</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:columns&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/mx:DataGrid&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>En el código anterior podrás ver que también le cambié el valor de la propiedad <strong>dataField </strong>a cada columna.<br />
La propiedad <strong>dataField </strong>es el nombre del campo o propiedad a la que hace referencia en el arreglo o colección que contiene la información que llenará el <strong>DataGrid</strong>. A este arreglo o colección de datos se le conoce como <em>Data Provider</em> (proveedor de datos o de información).</p>
<p>Existen varias formas de llenar de información el dataProvider. La forma más sencilla y menos dinámica es usando el siguiente código:</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;">&lt;mx:dataProvider&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:<span style="color: #0066CC;">Object</span> titulo=<span style="color: #ff0000;">"Dexter - The complete second season"</span> &nbsp; &nbsp; &nbsp; &nbsp; protagonistas=<span style="color: #ff0000;">"Michael C. Hall"</span> precio=<span style="color: #ff0000;">"24.99"</span> fecha=<span style="color: #ff0000;">"2006"</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;">Object</span> titulo=<span style="color: #ff0000;">"The Office - Season Four"</span> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;protagonistas=<span style="color: #ff0000;">"Steve Carell"</span> &nbsp; precio=<span style="color: #ff0000;">"30.99"</span> fecha=<span style="color: #ff0000;">"2005"</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:<span style="color: #0066CC;">Object</span> titulo=<span style="color: #ff0000;">"Gilmore Girls - The complete seventh season"</span> protagonistas=<span style="color: #ff0000;">"Lauren Graham, Alexis Bledel"</span> precio=<span style="color: #ff0000;">"22.99"</span> fecha=<span style="color: #ff0000;">"2006"</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;">Object</span> titulo=<span style="color: #ff0000;">"21 Jump Street - The complete first season"</span> &nbsp;protagonistas=<span style="color: #ff0000;">"Peter DeLuise, Johnny Depp"</span> precio=<span style="color: #ff0000;">"21.99"</span> fecha=<span style="color: #ff0000;">"1987"</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:<span style="color: #0066CC;">Object</span> titulo=<span style="color: #ff0000;">"Friends - The complete ninth season"</span> &nbsp; &nbsp; &nbsp; &nbsp; protagonistas=<span style="color: #ff0000;">"Jennifer Aniston, Courteney Cox, Lisa Kudrow, Matt LeBlanc, Matthew Perry, David Schwimmer"</span> precio=<span style="color: #ff0000;">"24.99"</span> fecha=<span style="color: #ff0000;">"2002"</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;">&lt;/mx:dataProvider&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>El código anterior deberás colocarlo dentro de los tags &lt;mx:DataGrid&gt;  y &lt;/mx:DataGrid&gt;, ya sea antes del código de las columnas o bien después.</p>
<p>Si corres la aplicación verás la información en el DataGrid similar a la siguiente imagen:</p>
<p style="text-align: center;"><img src="http://www.codigometropoli.com/images/screens/ps14sc1.jpg" alt="" /></p>
<p>De la imagen anterior, podemos ver que automáticamente el ancho de las columnas del DataGrid es el mismo para las cuatro columnas. Para las columnas de <em>Precio </em>y <em>Año </em>es mucho desperdicio de espacio ya que la información de estas columnas es poca. Cambia el código por lo siguiente para ajustar las columnas:</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;">&lt;mx:columns&gt;&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; &lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Título DVD"</span> dataField=<span style="color: #ff0000;">"titulo"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"250"</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:DataGridColumn headerText=<span style="color: #ff0000;">"Protagonistas"</span> dataField=<span style="color: #ff0000;">"protagonistas"</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:DataGridColumn headerText=<span style="color: #ff0000;">"Precio"</span> dataField=<span style="color: #ff0000;">"precio"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"50"</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;">&lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Año"</span> dataField=<span style="color: #ff0000;">"fecha"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"50"</span>/&gt;&nbsp;&nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/mx:columns&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Después de realizar los cambios anteriores, la aplicación se verá igual a la siguiente imagen:</p>
<p style="text-align: center;"><img src="http://www.codigometropoli.com/images/screens/ps14sc2.jpg" alt="" /></p>
<p>Los títulos de los DVDs y los protagonistas se pueden leer mejor, sin embargo la información no se muestra completa. Si le das click en el borde derecho de cada columna (dentro del  área del encabezado) podrás ajustar el ancho de las columnas.</p>
<p>Si haces click sobre el título de la columna Título DVD verás que la información es ordenada alfabéticamente de forma ascendente de acuerdo a los títulos DVD. Si vuelves a hacer click sobre el título de la misma columna la información se mostrará en orden alfabético descendente. Si queremos evitar que una columna se pueda ordenar (en ocasiones esto es necesario cuando usamos ítem renderers en la columna), agrégale la propiedad <strong>sortable </strong>con el valor de <strong>false</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;">&lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Título DVD"</span> dataField=<span style="color: #ff0000;">"titulo"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"250"</span> sortable=<span style="color: #ff0000;">"false"</span>/&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ahora haz click sobre la columna <strong>Precio </strong>y, sin soltarlo, arrastra la columna y ponla en medio de la columna <em>Título DVD</em> y <em>Protagonistas</em>. Las columnas, por default, tienen la opción <strong>draggable </strong>activada, para desactivarlo agrega esta propiedad con el valor de <strong>false</strong>:</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;">&lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Precio"</span> dataField=<span style="color: #ff0000;">"precio"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"50"</span> draggable=<span style="color: #ff0000;">"false"</span>/&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>&nbsp;</p>
<p>Otra forma de pasarle la información al DataGrid es creando un arreglo y llenándolo con la información que contendrá el DataGrid. Arrastra otro control DataGrid al área de trabajo y ponle de ID <em>productos2_dg</em>. A este nuevo DataGrid ponle la misma cantidad de columnas y propiedades. El código de este DataGrid quedaría:</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;">&lt;mx:DataGrid x=<span style="color: #ff0000;">"279.5"</span> y=<span style="color: #ff0000;">"401"</span> id=<span style="color: #ff0000;">"productos2_dg"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"638"</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">"281"</span> creationComplete=<span style="color: #ff0000;">"llenaDataGrid()"</span>&gt;</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; &lt;mx:columns&gt;&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; &lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Título DVD"</span> dataField=<span style="color: #ff0000;">"titulo"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"250"</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; &nbsp; &nbsp; &lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Protagonistas"</span> dataField=<span style="color: #ff0000;">"protagonistas"</span>/&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Precio"</span> dataField=<span style="color: #ff0000;">"precio"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"50"</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; &nbsp; &nbsp; &lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Año"</span> dataField=<span style="color: #ff0000;">"fecha"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"50"</span>/&gt;&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; &lt;/mx:columns&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;&nbsp; &nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/mx:DataGrid&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Para crear y llenar el arreglo, añade el siguiente código a tu aplicación:</p>
<div class="igBar"><span id="lactionscript-41"><a href="#" onclick="javascript:showPlainTxt('actionscript-41'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-41">
<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&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">private</span> <span style="color: #000000; font-weight: bold;">var</span> data_provider:<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-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;">private</span> <span style="color: #000000; font-weight: bold;">function</span> llenaDataGrid<span style="color: #66cc66;">&#40;</span><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; data_provider.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>titulo:<span style="color: #ff0000;">"Dexter - The complete second season"</span>, protagonistas:<span style="color: #ff0000;">"Michael C. Hall"</span>, precio:<span style="color: #ff0000;">"$24.99"</span>, fecha:<span style="color: #ff0000;">"2006"</span>, imagen:<span style="color: #ff0000;">"Dexter.jpg"</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; data_provider.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>titulo:<span style="color: #ff0000;">"The Office - Season Four"</span>, protagonistas:<span style="color: #ff0000;">"Steve Carell"</span>, precio:<span style="color: #ff0000;">"$30.99"</span>, fecha:<span style="color: #ff0000;">"2005"</span>, imagen:<span style="color: #ff0000;">"The_Office.jpg"</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; data_provider.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>titulo:<span style="color: #ff0000;">"Gilmore Girls - The complete seventh season"</span>, protagonistas:<span style="color: #ff0000;">"Lauren Graham, Alexis Bledel"</span>, precio:<span style="color: #ff0000;">"$22.99"</span>, fecha:<span style="color: #ff0000;">"2006"</span>, imagen:<span style="color: #ff0000;">"Gilmore_Girls.jpg"</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; data_provider.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>titulo:<span style="color: #ff0000;">"21 Jump Street - The complete first season"</span>, protagonistas:<span style="color: #ff0000;">"Peter DeLuise, Johnny Depp"</span>, precio:<span style="color: #ff0000;">"$21.99"</span>, fecha:<span style="color: #ff0000;">"1987"</span>, imagen:<span style="color: #ff0000;">"21_Jump_Street.jpg"</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; data_provider.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>titulo:<span style="color: #ff0000;">"Friends - The complete ninth season"</span>, protagonistas:<span style="color: #ff0000;">"Jennifer Aniston, Courteney Cox, Lisa Kudrow, Matt LeBlanc, Matthew Perry, David Schwimmer"</span>, precio:<span style="color: #ff0000;">"$24.99"</span>, fecha:<span style="color: #ff0000;">"2002"</span>, imagen:<span style="color: #ff0000;">"Friends.jpg"</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; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; productos2_dg.<span style="color: #006600;">dataProvider</span> = data_provider;&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: #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; <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</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;">&lt;/mx:Script&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>A pesar de que en este ejemplo estamos poniendo la información directamente en el código y no lo estamos obteniendo dinámicamente, te puedes dar cuenta que de esta segunda forma podemos obtener la información dinámicamente metiendo el código de <strong>push </strong>dentro de un ciclo <strong>for </strong>que recorra los registros regresados por un query.</p>
<p><img style="float: left;" src="http://codigometropoli.com/images/nota.jpg" alt="Nota" /> Este post es para explicar a grandes rasgos la finalidad y funcionalidad de un <strong>DataGrid</strong>. Este post nos servirá como entrada a una serie de tutoriales que pondré en unos días sobre cómo crear, almacenar y eliminar registro de una base  <strong>SQLite </strong>con <strong>AIR</strong>. Dentro de estos tutoriales usaremos DataGrids para mostrar la información obtenida de la base de datos.</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;"><strong>Evento ListEvent.CHANGE</strong></span></p>
<p>Este evento es uno de los más importantes cuando se está trabajando con DataGrids. Este evento es disparado cuando un usuario selecciona alguno de los registros del DataGrid. Para ejemplificar  su uso, mostraremos la imagen del DVD que el usuario seleccionó (sí, para eso le agregamos al arreglo data_provider el nombre de la imagen de cada DVD).<br />
Después de la línea productos2_dg.dataProvider = data_provider; agrega las siguientes líneas:</p>
<div class="igBar"><span id="lactionscript-42"><a href="#" onclick="javascript:showPlainTxt('actionscript-42'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-42">
<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;">productos2_dg.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ListEvent.<span style="color: #006600;">CHANGE</span>, muestraImagen<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>En la línea anterior de código le estamos diciendo al programa que cada vez que el evento CHANGE se ejecute,  llame a la función muestraImagen.<br />
Al finalizar la función <strong>llenaDataGrid</strong>, crea la función <strong>muestraImagen </strong>con el siguiente código:</p>
<div class="igBar"><span id="lactionscript-43"><a href="#" onclick="javascript:showPlainTxt('actionscript-43'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-43">
<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> muestraImagen<span style="color: #66cc66;">&#40;</span>event:ListEvent<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; imagen_dvd.<span style="color: #006600;">source</span> = <span style="color: #ff0000;">"dvds/"</span> + event.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">selectedItem</span>.<span style="color: #006600;">imagen</span>;</div>
</li>
<li style="font-family: 'Courier 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 este código estamos recibiendo como parámetro un evento de tipo ListEvent. Este parámetro nos permite saber sobre qué registro del DataGrid el usuario hizo click (event.target.selectedItem). Además, estamos obteniendo la propiedad <em>imagen </em>(que nosotros establecimos en el dataProvider) de ese registro (event.target.selectedItem.imagen). Recuerda, que además de la propiedad <em>imagen </em>puedes obtener la propiedad event.target.selectedItem.titulo, event.target.selectedItem.precio, event.target.selectedItem.fecha, etc.  Genial ¿no? De esta forma podríamos pasarle a cada registro su ID en la base de datos para cuando queramos modificarlo o eliminarlo.<br />
Ya que tenemos la propiedad <em>imagen</em>, se lo pasamos a la propiedad source de <em>image_dvd</em>. Pero… ¿qué es imagen_dvd? <em>imagen_dvd</em> es un componente de tipo <strong>Image </strong>el cual nos permite cargar y mostrar imágenes en él. Este componente, al igual que el <strong>DataGrid</strong>,  se encuentra de la sección <strong>Control</strong>.</p>
<p>A continuación te muestro el código de este control. Antes de cerrar el tag Application (&lt;/mx:Application) inserta el siguiente código:</p>
<div class="igBar"><span id="lactionscript-44"><a href="#" onclick="javascript:showPlainTxt('actionscript-44'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-44">
<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:Image y=<span style="color: #ff0000;">"497"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"240"</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">"240"</span> horizontalCenter=<span style="color: #ff0000;">"0"</span> id=<span style="color: #ff0000;">"imagen_dvd"</span> themeColor=<span style="color: #ff0000;">"#000000"</span>/&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Por último nos queda llamar a la función <strong>llenaDataGrid</strong>, esta función la llamaremos cuando el segundo <strong>DataGrid </strong>se haya creado. Para eso usaremos la propiedad <strong>creationComplete</strong>:</p>
<div class="igBar"><span id="lactionscript-45"><a href="#" onclick="javascript:showPlainTxt('actionscript-45'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-45">
<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:DataGrid y=<span style="color: #ff0000;">"268"</span> id=<span style="color: #ff0000;">"productos2_dg"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"638"</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">"188"</span> creationComplete=<span style="color: #ff0000;">"llenaDataGrid()"</span> horizontalCenter=<span style="color: #ff0000;">"0"</span>&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>¡Listo! Con las líneas que acabamos de crear estamos insertando un control <strong>Image </strong>para desplegar los JPGs de cada DVD.</p>
<p>¿Te perdiste? No te preocupes, aquí va el código completo de la aplicación.</p>
<div class="igBar"><span id="lactionscript-46"><a href="#" onclick="javascript:showPlainTxt('actionscript-46'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-46">
<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:Application xmlns:mx=<span style="color: #ff0000;">"http://www.adobe.com/2006/mxml"</span> layout=<span style="color: #ff0000;">"absolute"</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:DataGrid y=<span style="color: #ff0000;">"50"</span> id=<span style="color: #ff0000;">"productos_dg"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"638"</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">"188"</span> horizontalCenter=<span style="color: #ff0000;">"0"</span>&gt;</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; &lt;mx:columns&gt;&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; &lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Título DVD"</span> dataField=<span style="color: #ff0000;">"titulo"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"250"</span> sortable=<span style="color: #ff0000;">"false"</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; &nbsp; &nbsp; &nbsp; &nbsp; &lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Protagonistas"</span> dataField=<span style="color: #ff0000;">"protagonistas"</span>/&gt;</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; &lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Precio"</span> dataField=<span style="color: #ff0000;">"precio"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"50"</span> draggable=<span style="color: #ff0000;">"false"</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; &nbsp; &nbsp; &nbsp; &nbsp; &lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Año"</span> dataField=<span style="color: #ff0000;">"fecha"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"50"</span>/&gt;&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; &lt;/mx:columns&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; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;mx:dataProvider&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; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&lt;mx:<span style="color: #0066CC;">Object</span> titulo=<span style="color: #ff0000;">"Dexter - The complete second season"</span> protagonistas=<span style="color: #ff0000;">"Michael C. Hall"</span> precio=<span style="color: #ff0000;">"$24.99"</span> fecha=<span style="color: #ff0000;">"2006"</span> imagen=<span style="color: #ff0000;">"Dexter.jpg"</span>/&gt;</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;&lt;mx:<span style="color: #0066CC;">Object</span> titulo=<span style="color: #ff0000;">"The Office - Season Four"</span> protagonistas=<span style="color: #ff0000;">"Steve Carell"</span> &nbsp; precio=<span style="color: #ff0000;">"$30.99"</span> fecha=<span style="color: #ff0000;">"2005"</span> imagen=<span style="color: #ff0000;">"The_Office.jpg"</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; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&lt;mx:<span style="color: #0066CC;">Object</span> titulo=<span style="color: #ff0000;">"Gilmore Girls - The complete seventh season"</span> protagonistas=<span style="color: #ff0000;">"Lauren Graham, Alexis Bledel"</span> precio=<span style="color: #ff0000;">"$22.99"</span> fecha=<span style="color: #ff0000;">"2006"</span> imagen=<span style="color: #ff0000;">"Gilmore_Girls.jpg"</span>/&gt;</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;&lt;mx:<span style="color: #0066CC;">Object</span> titulo=<span style="color: #ff0000;">"21 Jump Street - The complete first season"</span> protagonistas=<span style="color: #ff0000;">"Peter DeLuise, Johnny Depp"</span> precio=<span style="color: #ff0000;">"$21.99"</span> fecha=<span style="color: #ff0000;">"1987"</span> imagen=<span style="color: #ff0000;">"21_Jump_Street.jpg"</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; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&lt;mx:<span style="color: #0066CC;">Object</span> titulo=<span style="color: #ff0000;">"Friends - The complete ninth season"</span> protagonistas=<span style="color: #ff0000;">"Jennifer Aniston, Courteney Cox, Lisa Kudrow, Matt LeBlanc, Matthew Perry, David Schwimmer"</span> precio=<span style="color: #ff0000;">"$24.99"</span> fecha=<span style="color: #ff0000;">"2002"</span> imagen=<span style="color: #ff0000;">"Friends.jpg"</span> /&gt;</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;&lt;/mx:dataProvider&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;&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; &lt;/mx:DataGrid&gt;&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; &lt;mx:Script&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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: #0066CC;">import</span> mx.<span style="color: #006600;">events</span>.<span style="color: #006600;">ListEvent</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;">private</span> <span style="color: #000000; font-weight: bold;">var</span> data_provider:<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; &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: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> llenaDataGrid<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#2C442A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data_provider.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>titulo:<span style="color: #ff0000;">"Dexter - The complete second season"</span>, protagonistas:<span style="color: #ff0000;">"Michael C. Hall"</span>, precio:<span style="color: #ff0000;">"$24.99"</span>, fecha:<span style="color: #ff0000;">"2006"</span>, imagen:<span style="color: #ff0000;">"Dexter.jpg"</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; data_provider.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>titulo:<span style="color: #ff0000;">"The Office - Season Four"</span>, protagonistas:<span style="color: #ff0000;">"Steve Carell"</span>, precio:<span style="color: #ff0000;">"$30.99"</span>, fecha:<span style="color: #ff0000;">"2005"</span>, imagen:<span style="color: #ff0000;">"The_Office.jpg"</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; data_provider.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>titulo:<span style="color: #ff0000;">"Gilmore Girls - The complete seventh season"</span>, protagonistas:<span style="color: #ff0000;">"Lauren Graham, Alexis Bledel"</span>, precio:<span style="color: #ff0000;">"$22.99"</span>, fecha:<span style="color: #ff0000;">"2006"</span>, imagen:<span style="color: #ff0000;">"Gilmore_Girls.jpg"</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; data_provider.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>titulo:<span style="color: #ff0000;">"21 Jump Street - The complete first season"</span>, protagonistas:<span style="color: #ff0000;">"Peter DeLuise, Johnny Depp"</span>, precio:<span style="color: #ff0000;">"$21.99"</span>, fecha:<span style="color: #ff0000;">"1987"</span>, imagen:<span style="color: #ff0000;">"21_Jump_Street.jpg"</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; data_provider.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>titulo:<span style="color: #ff0000;">"Friends - The complete ninth season"</span>, protagonistas:<span style="color: #ff0000;">"Jennifer Aniston, Courteney Cox, Lisa Kudrow, Matt LeBlanc, Matthew Perry, David Schwimmer"</span>, precio:<span style="color: #ff0000;">"$24.99"</span>, fecha:<span style="color: #ff0000;">"2002"</span>, imagen:<span style="color: #ff0000;">"Friends.jpg"</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; </div>
</li>
<li style="font-family: 'Courier New', Courier, 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; productos2_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; &nbsp; &nbsp; &nbsp; productos2_dg.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ListEvent.<span style="color: #006600;">CHANGE</span>, muestraImagen<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; <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; </div>
</li>
<li style="font-family: 'Courier New', Courier, 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: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> muestraImagen<span style="color: #66cc66;">&#40;</span>event:ListEvent<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; &nbsp; &nbsp; imagen_dvd.<span style="color: #006600;">source</span> = <span style="color: #ff0000;">"dvds/"</span> + event.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">selectedItem</span>.<span style="color: #006600;">imagen</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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></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;">&#93;</span><span style="color: #66cc66;">&#93;</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&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:DataGrid y=<span style="color: #ff0000;">"268"</span> id=<span style="color: #ff0000;">"productos2_dg"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"638"</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">"188"</span> creationComplete=<span style="color: #ff0000;">"llenaDataGrid()"</span> horizontalCenter=<span style="color: #ff0000;">"0"</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; &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; &lt;mx:columns&gt;&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; &lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Título DVD"</span> dataField=<span style="color: #ff0000;">"titulo"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"250"</span>/&gt;</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; &lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Protagonistas"</span> dataField=<span style="color: #ff0000;">"protagonistas"</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; &nbsp; &nbsp; &nbsp; &nbsp; &lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Precio"</span> dataField=<span style="color: #ff0000;">"precio"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"50"</span>/&gt;</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; &lt;mx:DataGridColumn headerText=<span style="color: #ff0000;">"Año"</span> dataField=<span style="color: #ff0000;">"fecha"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"50"</span>/&gt;&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; &lt;/mx:columns&gt;</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;">&lt;/mx:DataGrid&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:Image y=<span style="color: #ff0000;">"497"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"240"</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">"240"</span> horizontalCenter=<span style="color: #ff0000;">"0"</span> id=<span style="color: #ff0000;">"imagen_dvd"</span> themeColor=<span style="color: #ff0000;">"#000000"</span>/&gt;&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;">&lt;/mx:Application&gt; </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 type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<div align="center" style="margin-top:10px;">
<table border="0" cellspacing="0" cellpadding="0" width="180">
<tbody>
<tr>
<td valign="top"><a href="http://www.codigometropoli.com/wp-content/uploads/2008/08/DataGridControl/DataGridControl.html" target="center"><img title="Ver Ejempo" src="http://codigometropoli.com/images/ver_ejemplo.jpg" alt="Ver Ejemplo" /></a></td>
</tr>
</tbody>
</table>
</div>
<div style="margin-top:40px; margin-bottom:30px;">
<strong>Enlaces recomendados:</strong></p>
<p>» <a href="http://livedocs.adobe.com/flex/3/langref/index.html" target="_blank">Adobe® Flex® 3 Language Reference</a></p>
<p><strong>Entradas relacionadas:</strong></p>
<p>» <a href="http://www.codigometropoli.com/web-services-en-flex/" target="_blank">Web Services en Flex</a><br />
» <a href="http://www.codigometropoli.com/cargar-swf-en-flex/" target="_blank">Cargar SWF en Flex</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.codigometropoli.com/componente-datagrid/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Web Services en Flex</title>
		<link>http://www.codigometropoli.com/web-services-en-flex/</link>
		<comments>http://www.codigometropoli.com/web-services-en-flex/#comments</comments>
		<pubDate>Sat, 07 Jun 2008 02:59:40 +0000</pubDate>
		<dc:creator>Carla Macías</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Servicios Web]]></category>
		<category><![CDATA[WebService]]></category>

		<guid isPermaLink="false">http://www.codigometropoli.com/?p=20</guid>
		<description><![CDATA[De acuerdo a WikiPedia, un Servicio Web es un conjunto de protocolos y estándares que permiten intercambiar datos entre aplicaciones desarrolladas en diferentes lenguajes de programación y ejecutadas sobre cualquier plataforma.
Dentro de Flex existe la clase WebService, al cual nos permite acceder a Servicios Web en SOAP. En esta entrada usaremos un servicio web que, [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;"><img class="alignright" style="float: right;" src="http://codigometropoli.com/images/flex_sticker.jpg" alt="Flex" width="93" height="93" />De acuerdo a <a href="http://es.wikipedia.org/wiki/Web_Service" target="_blank">WikiPedia</a>, un Servicio Web es un conjunto de protocolos y estándares que permiten intercambiar datos entre aplicaciones desarrolladas en diferentes lenguajes de programación y ejecutadas sobre cualquier plataforma.</p>
<p style="text-align: left;">Dentro de Flex existe la clase WebService, al cual nos permite acceder a Servicios Web en SOAP. En esta entrada usaremos un servicio web que, de acuerdo a nuestra consulta, nos regresa el número teléfonico (lada) internacional (International Dialing code) del país que seleccionemos.</p>
<p><span id="more-20"></span></p>
<p style="text-align: left;">Para este ejercicio usaremos Flex Builder 3 y Flash CS3.</p>
<p style="text-align: left;"><span style="color: #560e00;"><span style="text-decoration: underline;"><strong>Tutorial</strong></span></span></p>
<p style="text-align: left;">1. Abre Flex Builder 3 y crea un nuevo proyecto (En tipo de aplicación selecciona Aplicación Web). Ponle como nombre de proyecto <strong>LadaInternacional</strong>. Haz click en el botón de Finalizar.</p>
<p style="text-align: left;">2. Da click en el botón vista de &lt;em&gt;Diseño&lt;/em&gt; y arrastra los siguientes elementos al área de diseño:</p>
<p style="padding-left: 30px; text-align: left;">- 1 Componente <strong>SWFLoader</strong></p>
<p style="padding-left: 30px; text-align: left;">- 3 Controles <strong>Label</strong> con los siguientes textos: País, Lada y Respuesta</p>
<p style="padding-left: 30px; text-align: left;">- 2 Controles <strong>Label </strong>sin texto; el ID del primero deberá ser pais_lb, y del segundo lada_lb</p>
<p style="padding-left: 30px; text-align: left;">- 1 Control <strong>TextArea</strong> con ID info_txt</p>
<p style="padding-left: 30px; text-align: left;">La distribución deberá ser similar a la siguiente imagen:</p>
<p style="text-align: center;"><a title="Figura 1: Distribución de los controles" href="../images/screens/ps7sc1.png" target="_blank"><img src="../images/previews/ps7sc1.png" alt="Figura 1: Distribución de los controles" /></a></p>
<p style="text-align: left;">
<p style="text-align: left;">3. Baja el siguiente archivo SWF y guardalo en la carpeta raíz de tu proyecto (LadaInternacional).</p>
<p>
<object width="300" height="117">
<param name="movie" value="../wp-content/uploads/2008/05/mapa-en-flash.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<embed type="application/x-shockwave-flash" width="300" height="117" src="../wp-content/uploads/2008/05/mapa-en-flash.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" ></embed>
</object>
</p>
<div style="margin-top:30px; margin-bottom:20px;" align="center">
<table border="0" cellspacing="0" cellpadding="0" width="374">
<tbody>
<tr>
<td valign="top"><a href="http://codigometropoli.com/wp-content/uploads/2008/05/mapa-en-flash.swf"><img title="Descargar Archivo SWF" src="../images/descargar_swf.jpg" alt="Descargar Archivo SWF" /></a></td>
<td valign="top"><a href="http://codigometropoli.com/wp-content/uploads/2008/05/mapa-en-flash.fla"><img title="Descargar Archivo FLA" src="../images/descargar_fla.jpg" alt="Descargar Archivo FLA" /></a></td>
</tr>
</tbody>
</table>
</div>
<p><img align="absmiddle" src="../images/nota.jpg" alt="Nota" /> La imagen del mapa la bajé de FlashKit en <a href="http://www.flashkit.com/movies/Utilities/Other/World_Ma-Eduardo_-10825/index.php" target="_blank">esta</a> dirección.</p>
<p style="text-align: left;">El archivo de Flash está formado por un mapa y unos botones rojos, los cuales muestra el nombre del país al ponerse encima de ellos (rollOver). Los nombres de instancia de cada uno de estos botones son:</p>
<p style="padding-left: 30px; text-align: left;">- mex_btn: Botón para México</p>
<p style="padding-left: 30px; text-align: left;">- can_btn: Botón para Canadá</p>
<p style="padding-left: 30px; text-align: left;">- usa_btn: Botón para Estados Unidos</p>
<p style="padding-left: 30px; text-align: left;">- arg_btn: Botón para Argentina</p>
<p style="padding-left: 30px; text-align: left;">- bra_btn: Botón para Brasil</p>
<p style="padding-left: 30px; text-align: left;">- esp_btn: Botón para España</p>
<p style="text-align: left;">El código ActionScript que contiene el archivo de Flash es:</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;">mex_btn.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, muestraCodigo<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;">can_btn.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, muestraCodigo<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;">usa_btn.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, muestraCodigo<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;">arg_btn.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, muestraCodigo<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;">bra_btn.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, muestraCodigo<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;">esp_btn.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, muestraCodigo<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;</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> muestraCodigo<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-family: 'Courier New', Courier, 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> pais:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">""</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: #b1b100;">switch</span><span style="color: #66cc66;">&#40;</span>evento.<span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">name</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; <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">"mex_btn"</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; pais = <span style="color: #ff0000;">"Mexico"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">break</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;">case</span> <span style="color: #ff0000;">"can_btn"</span>:</div>
</li>
<li style="font-family: 'Courier New', Courier, 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; pais = <span style="color: #ff0000;">"Canada"</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;">break</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">case</span> <span style="color: #ff0000;">"usa_btn"</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; pais = <span style="color: #ff0000;">"United States"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">break</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;">case</span> <span style="color: #ff0000;">"arg_btn"</span>:</div>
</li>
<li style="font-family: 'Courier New', Courier, 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; pais = <span style="color: #ff0000;">"Argentina"</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;">break</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">case</span> <span style="color: #ff0000;">"bra_btn"</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; pais = <span style="color: #ff0000;">"Brazil"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">break</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;">case</span> <span style="color: #ff0000;">"esp_btn"</span>:</div>
</li>
<li style="font-family: 'Courier New', Courier, 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; pais = <span style="color: #ff0000;">"Spain"</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;">break</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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; root.<span style="color: #006600;">parent</span>.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'parentApplication'</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">llamadaServicio</span><span style="color: #66cc66;">&#40;</span>pais<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>El código anterior modifica el valor de la variable <strong>pais</strong> de acuerdo al botón que se hizo click, y se realiza la llamada a la función <strong>llamadaServicio</strong> que se encuentra en nuestra aplicación de Flex.</p>
<p style="text-align: left;">4. Selecciona el <em>SWFLoader</em> y en el panel de propiedades haz click en el botón <em>Browse</em> del lado derecho de <em>Source</em> (Fuente). Selecciona el archivo SWF que acabas de bajar (mapa-en-flash.swf) y haz click en el botón abrir.</p>
<p style="text-align: left;">5. Haz click en el botón de vista <em>Source</em>. Agrega las siguientes líneas de código</p>
<div class="igBar"><span id="lactionscript-53"><a href="#" onclick="javascript:showPlainTxt('actionscript-53'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-53">
<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:WebService id=<span style="color: #ff0000;">"codigoLada"</span> wsdl=<span style="color: #ff0000;">"http://www.webservicex.net/country.asmx?wsdl"</span> fault=<span style="color: #ff0000;">"Alert.show(event.fault.faultString);"</span> showBusyCursor=<span style="color: #ff0000;">"true"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;mx:operation <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">"GetISD"</span> result=<span style="color: #ff0000;">"callResultHandler(event)"</span> fault=<span style="color: #ff0000;">"callFaultHandler(event)"</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; &nbsp; &nbsp; &nbsp; &nbsp; &lt;mx:request&gt;</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; &lt;CountryName&gt;<span style="color: #66cc66;">&#123;</span>pais<span style="color: #66cc66;">&#125;</span>&lt;/CountryName&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; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/mx:request&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/mx:operation&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;">&lt;/mx:WebService&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>En el código anterior primero creamos el tag WebService y establecemos sus propiedades. En este caso, el servicio web que vamos a usar se encuentra en <a href="http://www.webservicex.net/country.asmx?wsdl">http://www.webservicex.net/country.asmx?wsdl</a>.<br />
La propiedad <strong>fault</strong> nos permite especificar qué acciones se llevarán a cabo cuando se presente un error. En este caso estamos  mostraremos un mensaje de alerta con la información del error.<br />
La propiedad <strong>showBusyCursor</strong> cuando está en true mostrará como cursor un reloj mientras se esté ejecutando el servicio. </p>
<p>Dentro del tag de operación (<em>operation</em>) especifícamos el nombre de la función que usaremos como servicio. En este caso la función u operación se llama <strong>GetISD</strong> y el resultado se usará en la función <em>callResultHandler</em>.</p>
<p>El tag de request nos permite especificar el valor de los párametros que se deben enviar al ejecutar el servicio. En el caso de este Web Service, sólo requeremos enviar un párametro cuyo nombre es <strong>CountryName</strong>. Este parámetro va a tomar el valor de la variable <strong>pais</strong>.</p>
<p><img style="float: left;" src="../images/nota.jpg" alt="Nota" /> El nombre de la función (GetISD) y de los parámetros (CountryName) vienen especificados en el <a href="http://www.webservicex.net/country.asmx?wsdl">descriptor</a> del servicio. Dentro de este archivo se pueden observar las siguientes líneas:</p>
<div class="igBar"><span id="lxml-54"><a href="#" onclick="javascript:showPlainTxt('xml-54'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-54">
<div class="xml">
<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: #009900;"><span style="font-weight: bold; color: black;">&lt;s</span>:element <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"GetISD"</span><span style="font-weight: bold; color: black;">&gt;</span></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: #009900;"><span style="font-weight: bold; color: black;">&lt;s</span>:complexType<span style="font-weight: bold; color: black;">&gt;</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: #009900;"><span style="font-weight: bold; color: black;">&lt;s</span>:sequence<span style="font-weight: bold; color: black;">&gt;</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: #009900;"><span style="font-weight: bold; color: black;">&lt;s</span>:element <span style="color: #000066;">minOccurs</span>=<span style="color: #ff0000;">"0"</span> <span style="color: #000066;">maxOccurs</span>=<span style="color: #ff0000;">"1"</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"CountryName"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"s:string"</span><span style="font-weight: bold; color: black;">/&gt;</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: #009900;"><span style="font-weight: bold; color: black;">&lt;/s</span>:sequence<span style="font-weight: bold; color: black;">&gt;</span></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: #009900;"><span style="font-weight: bold; color: black;">&lt;/s</span>:complexType<span style="font-weight: bold; color: black;">&gt;</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;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/s</span>:element<span style="font-weight: bold; color: black;">&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p style="text-align: left;">6. Ahora veremos el código necesario para recibir la respuesta del servicio web y hacer uso de los datos recibidos. Añade el siguiente código a tu aplicación de Flex:</p>
<div class="igBar"><span id="lactionscript-55"><a href="#" onclick="javascript:showPlainTxt('actionscript-55'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-55">
<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&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">/* Importamos las librerías que requerimos */</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: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">Alert</span>; <span style="color: #808080; font-style: italic;">/* Para mostrar el mensaje de Alerta si hubo algún error */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">FaultEvent</span>; <span style="color: #808080; font-style: italic;">/* Necesario para cuando se presente un error en el evento al tratar de ejecutar el servicio */</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: #0066CC;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">ResultEvent</span>; <span style="color: #808080; font-style: italic;">/* Lo utilizamos para manejar los resultados del evento */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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; <span style="color: #66cc66;">&#91;</span>Bindable<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; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> pais:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">""</span>; <span style="color: #808080; font-style: italic;">/* Variable que usaremos como parámetro para la llamada del servicio */</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: #808080; font-style: italic;">/* Esta función es llamada desde el archivo de Flash cuando se hace click en alguno de los botones de los países */</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: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> llamadaServicio<span style="color: #66cc66;">&#40;</span>country:<span style="color: #0066CC;">String</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; &nbsp; &nbsp; &nbsp; &nbsp; pais = country; <span style="color: #808080; font-style: italic;">/* Recibimos como parámetro el nombre del país de acuerdo al botón al que le hizo click el usuario */</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; codigoLada.<span style="color: #006600;">GetISD</span>.<span style="color: #0066CC;">send</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">/* Hacemos la llamada al servicio enviando los datos necesarios. </span></div>
</li>
<li style="font-family: 'Courier 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;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Observa que la variable país ya estaba ligada al servicio (Línea 4 del último código ActionScript que puse) */</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; <span style="color: #808080; font-style: italic;">/* Esta función es llamada cuando hubo un error al tratar de ejecutar el servicio */</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: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> callFaultHandler<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">error</span>:FaultEvent<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; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* Mostramos el error en consola, con un mensaje de alerta y en el campo de texto info_txt */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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: #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;">fault</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-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">error</span>.<span style="color: #006600;">fault</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</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; &nbsp; &nbsp; &nbsp; &nbsp; pais_lb.<span style="color: #0066CC;">text</span> = <span style="color: #0066CC;">error</span>.<span style="color: #006600;">fault</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; &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: #808080; font-style: italic;">/* Esta función es llamada cuando no hubo error y el servicio web nos regresa la respuesta */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">private</span> <span style="color: #000000; font-weight: bold;">function</span> callResultHandler<span style="color: #66cc66;">&#40;</span>event:ResultEvent<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; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Guardamos en una variable de texto el resultado que trae el evento</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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> respuesta:<span style="color: #0066CC;">String</span> = event.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">lastResult</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; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* Debido a que el Servicio Web nos regresa un XML, estos datos se los pasamos a una variable de tipo XML */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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> XMLresult:<span style="color: #0066CC;">XML</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">XML</span><span style="color: #66cc66;">&#40;</span>respuesta<span style="color: #66cc66;">&#41;</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; &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;">/* Mostramos el resultado en las diversas cajas de texto */</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; info_txt.<span style="color: #0066CC;">text</span> = XMLresult.<span style="color: #006600;">Table</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">toXMLString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">/* Mostramos el XML regresado */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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; lada_lb.<span style="color: #0066CC;">text</span> = XMLresult.<span style="color: #006600;">Table</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">code</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">/* Mostramos el valor del nodo code */</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; pais_lb.<span style="color: #0066CC;">text</span> = XMLresult.<span style="color: #006600;">Table</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">name</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">/* Mostramos el valor del nodo name */</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: #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; </div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#93;</span><span style="color: #66cc66;">&#93;</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/mx:Script&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Aquí va de nuevo todo el código junto de la aplicación en Flex (LadaInternacional.mxml):</p>
<div class="igBar"><span id="lactionscript-56"><a href="#" onclick="javascript:showPlainTxt('actionscript-56'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-56">
<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:Application xmlns:mx=<span style="color: #ff0000;">"http://www.adobe.com/2006/mxml"</span> layout=<span style="color: #ff0000;">"absolute"</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:Script&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; &nbsp; &nbsp; &lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</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;">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; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">FaultEvent</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;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">ResultEvent</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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: #66cc66;">&#91;</span>Bindable<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; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> pais:<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; &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: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> llamadaServicio<span style="color: #66cc66;">&#40;</span>country:<span style="color: #0066CC;">String</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; &nbsp; &nbsp; &nbsp; &nbsp; pais = country;</div>
</li>
<li style="font-family: 'Courier New', Courier, 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; codigoLada.<span style="color: #006600;">GetISD</span>.<span style="color: #0066CC;">send</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; &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; &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: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> callFaultHandler<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">error</span>:FaultEvent<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; &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: #006600;">fault</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-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">error</span>.<span style="color: #006600;">fault</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; info_txt.<span style="color: #0066CC;">text</span> = <span style="color: #0066CC;">error</span>.<span style="color: #006600;">fault</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; &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; </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;">private</span> <span style="color: #000000; font-weight: bold;">function</span> callResultHandler<span style="color: #66cc66;">&#40;</span>event:ResultEvent<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> respuesta:<span style="color: #0066CC;">String</span> = event.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">lastResult</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><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;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> XMLresult:<span style="color: #0066CC;">XML</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">XML</span><span style="color: #66cc66;">&#40;</span>respuesta<span style="color: #66cc66;">&#41;</span>;&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; &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; info_txt.<span style="color: #0066CC;">text</span> = XMLresult.<span style="color: #006600;">Table</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">toXMLString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&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; lada_lb.<span style="color: #0066CC;">text</span> = XMLresult.<span style="color: #006600;">Table</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">code</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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pais_lb.<span style="color: #0066CC;">text</span> = XMLresult.<span style="color: #006600;">Table</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">name</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&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: #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; </div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">&#93;</span><span style="color: #66cc66;">&#93;</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:Script&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:WebService id=<span style="color: #ff0000;">"codigoLada"</span> wsdl=<span style="color: #ff0000;">"http://www.webservicex.net/country.asmx?wsdl"</span> fault=<span style="color: #ff0000;">"Alert.show(event.fault.faultString);"</span> showBusyCursor=<span style="color: #ff0000;">"true"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;mx:operation <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">"GetISD"</span> result=<span style="color: #ff0000;">"callResultHandler(event)"</span> fault=<span style="color: #ff0000;">"callFaultHandler(event)"</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; &nbsp; &nbsp; &nbsp; &nbsp; &lt;mx:request&gt;</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; &lt;CountryName&gt;<span style="color: #66cc66;">&#123;</span>pais<span style="color: #66cc66;">&#125;</span>&lt;/CountryName&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; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/mx:request&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/mx:operation&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:WebService&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:SWFLoader y=<span style="color: #ff0000;">"18"</span> horizontalCenter=<span style="color: #ff0000;">"14"</span> source=<span style="color: #ff0000;">"../mapa-en-flash.swf"</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;">"284"</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">"País:"</span> fontWeight=<span style="color: #ff0000;">"bold"</span> <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">"#F3F7F8"</span> fontSize=<span style="color: #ff0000;">"14"</span> horizontalCenter=<span style="color: #ff0000;">"-132"</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;">"315"</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">"Lada:"</span> fontWeight=<span style="color: #ff0000;">"bold"</span> <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">"#F3F7F8"</span> fontSize=<span style="color: #ff0000;">"14"</span> horizontalCenter=<span style="color: #ff0000;">"-129"</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;">"284"</span> fontWeight=<span style="color: #ff0000;">"bold"</span> <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">"#77180E"</span> fontSize=<span style="color: #ff0000;">"14"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"129"</span> id=<span style="color: #ff0000;">"pais_lb"</span> horizontalCenter=<span style="color: #ff0000;">"-24"</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;">"315"</span> fontWeight=<span style="color: #ff0000;">"bold"</span> <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">"#77180E"</span> fontSize=<span style="color: #ff0000;">"14"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"129"</span> id=<span style="color: #ff0000;">"lada_lb"</span> horizontalCenter=<span style="color: #ff0000;">"-24"</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:TextArea y=<span style="color: #ff0000;">"356"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"345"</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">"126"</span> id=<span style="color: #ff0000;">"info_txt"</span> horizontalCenter=<span style="color: #ff0000;">"84"</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;">"356"</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">"Respuesta:"</span> fontWeight=<span style="color: #ff0000;">"bold"</span> <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">"#F3F7F8"</span> fontSize=<span style="color: #ff0000;">"14"</span> horizontalCenter=<span style="color: #ff0000;">"-149"</span> textDecoration=<span style="color: #ff0000;">"underline"</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:LinkButton click=<span style="color: #ff0000;">"navigateToURL(new URLRequest('www.codigometropoli.com'))"</span> label=<span style="color: #ff0000;">"www.codigometropoli.com"</span> horizontalCenter=<span style="color: #ff0000;">"35"</span> bottom=<span style="color: #ff0000;">"50"</span> fontSize=<span style="color: #ff0000;">"12"</span> <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">"#E1E4E4"</span> themeColor=<span style="color: #ff0000;">"#00BAFF"</span>/&gt;</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;">&lt;/mx:Application&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Hemos llegado al final del tutorial, no olvides bajar los archivos y visitar la página de ejemplo.</p>
<div align="center"><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="374">
<tbody>
<tr>
<td valign="top"><a href="http://codigometropoli.com/wp-content/uploads/2008/05/Flex/LadaInternacional.html" target="center"><img title="Ver Ejempo" src="../images/ver_ejemplo.jpg" alt="Ver Ejemplo" /></a></td>
<td valign="top"><a href="http://codigometropoli.com/wp-content/uploads/descarga.php?file=2008/05/LadaInternacional.zip"><img title="Descargar Archivo" src="../images/descargar_archivo.jpg" alt="Descargar Archivo" /></a></td>
</tr>
</tbody>
</table>
</div>
<p style="text-align: left;"><strong>Post Relacionados:</strong></p>
<p style="text-align: left;">» <a href="../cargar-swf-en-flex" target="_blank">Cargar SWF en Flex</a></p>
<p style="text-align: left;"><strong>Enlaces recomendados:</strong></p>
<p style="text-align: left;">» <a href="http://es.wikipedia.org/wiki/Web_Service" target="_blank">Servicio Web en WikiPedia</a><br />
» <a href="http://livedocs.adobe.com/flex/3/langref/mx/rpc/soap/mxml/WebService.html" target="_blank">Clase WebService (Adobe® Flex® 3 Language Reference)</a><br />
» <a href="http://livedocs.adobe.com/flex/3/langref/index.html" target="_blank">Adobe® Flex® 3 Language Reference</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.codigometropoli.com/web-services-en-flex/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Cargar SWF en Flex</title>
		<link>http://www.codigometropoli.com/cargar-swf-en-flex/</link>
		<comments>http://www.codigometropoli.com/cargar-swf-en-flex/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 06:58:14 +0000</pubDate>
		<dc:creator>Carla Macías</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[SWFLoader]]></category>

		<guid isPermaLink="false">http://www.codigometropoli.com/?p=19</guid>
		<description><![CDATA[Flex Builder incluye dentro de su librería de componentes el SWFLoader. Este componente nos permite cargar archivos SWF dentro de nuestras aplicaciones en Flex. En esta entrada además de aprender a usarlo verás cómo llamar una función dentro de Flex desde el SWF.

Para este ejercicio usaremos Flex Builder 3, que puedes bajarlo de aquí.
Tutorial
1. Abre [...]]]></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" />Flex Builder incluye dentro de su librería de componentes el <em>SWFLoader</em>. Este componente nos permite cargar archivos SWF dentro de nuestras aplicaciones en Flex. En esta entrada además de aprender a usarlo verás cómo llamar una función dentro de Flex desde el SWF.</p>
<p><span id="more-19"></span></p>
<p>Para este ejercicio usaremos Flex Builder 3, que puedes bajarlo de <a href="https://www.adobe.com/cfusion/tdrc/index.cfm?product=flex" target="_blank">aquí</a>.</p>
<p><span style="color: #560e00;"><span style="text-decoration: underline;"><strong>Tutorial</strong></span></span></p>
<p>1. Abre Flex Builder 3 y crea un nuevo proyecto (En tipo de aplicación selecciona Aplicación Web). Ponle como nombre de proyecto <strong>FLEXSwfLoader</strong>. Haz click en el botón de Finalizar.</p>
<p>2. Da click en el botón vista de <em>Diseño</em> y arrastra una etiqueta o <em>Label</em> al área de diseño. Asígnale las siguientes propiedades al botón:</p>
<p style="padding-left: 30px;">- Width: 200 pixeles de ancho<br />
- Color de fuente: Blanco #FFFFFF<br />
- Bold / Verdana / 12px<br />
- ID: resultado<br />
- Borra el texto de la etiqueta</p>
<p style="text-align: center;"><a title="Figura 1: Estableciendo las propiedades del Label" href="../images/screens/ps6sc1.png" target="_blank"><img src="../images/previews/ps6sc1.png" alt="Figura 1: Estableciendo las propiedades del Label" /></a></p>
<p style="text-align: left;">2.  Busca el componente <em>SWFLoader</em> dentro de la lista de <em>Controles</em> del panel <em>Componentes</em>. Arrastra el componente al área de Diseño.</p>
<p>3. Baja el siguiente archivo SWF (ActionScript 3.0) y guardalo en la carpeta raíz de tu proyecto (en este caso deberá ir en la carpeta <strong>FLEXSwfLoader</strong>). Este archivo lo cargaremos en nuestra aplicación de Flex:</p>
<div>
<object width="150" height="150">
<param name="movie" value="../wp-content/uploads/2008/05/flash-in-flex.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<embed type="application/x-shockwave-flash" width="150" height="150" src="../wp-content/uploads/2008/05/flash-in-flex.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" ></embed>
</object>
</div>
<div style="margin-top:30px; margin-bottom:20px;" align="center">
<table border="0" cellspacing="0" cellpadding="0" width="374">
<tbody>
<tr>
<td valign="top"><a href="http://www.megaupload.com/?d=IFXJL873" target="_blank"><img title="Descargar Archivo SWF" src="../images/descargar_swf.jpg" alt="Descargar Archivo SWF" /></a></td>
<td valign="top"><a href="http://www.megaupload.com/?d=T55WYGGB" target="_blank"><img title="Descargar Archivo FLA" src="../images/descargar_fla.jpg" alt="Descargar Archivo FLA" /></a></td>
</tr>
</tbody>
</table>
</div>
<p>En el archivo Flash tenemos un campo de introducción de texto cuyo nombre de instancia es <strong>texto_txt</strong>; el texto que introduzcamos aquí se mostrará en la etiqueta (Label) <strong>resultado</strong> en Flex. Debajo de este campo está el botón "<em>Pasar valor a Flex</em>" con nombre de instancia <strong>pasar_txt</strong>; este botón se encargará de modificar el valor de la variable <strong>mensaje</strong>, la cual se mostrará en la etiqueta <strong>resultado</strong>. Por último hay un botón con "<em>Llamar función</em>" como letrero y nombre de instancia <strong>llamar_txt</strong>; este botón mostrará un mensaje de alerta de Flex.</p>
<p>El código del archivo de Flash es el siguiente:</p>
<div class="igBar"><span id="lactionscript-60"><a href="#" onclick="javascript:showPlainTxt('actionscript-60'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-60">
<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;">pasar_btn.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, pasar_valor<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;">llamar_btn.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, llamar_funcion<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;</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> pasar_valor<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-family: 'Courier New', Courier, 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;root.<span style="color: #006600;">parent</span>.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'parentApplication'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'mensaje'</span><span style="color: #66cc66;">&#93;</span> = texto_txt.<span style="color: #0066CC;">text</span>; <span style="color: #808080; font-style: italic;">/* En nuestra aplicación de Flex tendremos definida la variable mensaje. Aquí le estamos modificando su valor de acuerdo al texto introducido por el usuario */</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: #000000; font-weight: bold;">function</span> llamar_funcion<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-family: 'Courier New', Courier, 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;root.<span style="color: #006600;">parent</span>.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'parentApplication'</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">muestraAlert</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">/* En nuestra aplicación de Flex tendremos una función llamada muestraAlert, la cual mostrará un mensaje de Alerta en Flex */</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>4. Selecciona el <em>SWFLoader</em> y en el panel de propiedades haz click en el botón <em>Browse</em> del lado derecho de <em>Source</em> (Fuente). Selecciona el archivo SWF que acabas de bajar (flash-in-flex.swf) y haz click en el botón abrir.</p>
<p>5. Cámbiate a la vista de Código (Source) y agrega las siguientes líneas de código:</p>
<div class="igBar"><span id="lactionscript-61"><a href="#" onclick="javascript:showPlainTxt('actionscript-61'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-61">
<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&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">Alert</span>; <span style="color: #808080; font-style: italic;">/* Importamos la librería para mostrar el mensaje de Alerta */</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: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</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: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> mensaje:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">""</span>; <span style="color: #808080; font-style: italic;">/* Variable que modificaremos por medio del SWF. OJO: La variable debe ser pública */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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> muestraAlert<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">/* Esta función la llamaremos desde el SWF */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, 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; Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Mensaje de Alerta en Flex"</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">/* Muestra el mensaje de Alerta */</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; <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#0B1558;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/mx:Script&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Además, asígnale al tag del Label la siguiente propiedad de texto:</p>
<div class="igBar"><span id="lactionscript-62"><a href="#" onclick="javascript:showPlainTxt('actionscript-62'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-62">
<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:Label <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">"{mensaje}"</span> ... </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Eso es todo lo que tienes que hacer para llamar a la aplicación de Flex desde el SWF embebido.</p>
<div align="center" style="margin-top:20px;"><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="374">
<tbody>
<tr>
<td valign="top"><a href="http://codigometropoli.com/wp-content/uploads/2008/05/Flex/FLEXSwfLoader.html" target="center"><img title="Ver Ejempo" src="../images/ver_ejemplo.jpg" alt="Ver Ejemplo" /></a></td>
<td valign="top"><a href="http://www.megaupload.com/?d=V2RUDOHG" target="_blank"><img title="Descargar Archivo" src="../images/descargar_archivo.jpg" alt="Descargar Archivo" /></a></td>
</tr>
</tbody>
</table>
</div>
<p><strong>Enlaces recomendados:</strong></p>
<p>» <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=controls_15.html" target="_blank">SWFLoader Control<br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.codigometropoli.com/cargar-swf-en-flex/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
