Importar datos de Microsoft Access a Flash

El turno para Flash

En este momento, disponemos del contenido de nuestra base de datos en un formato que flash entiende. A partir de aquí, adaptarás flash a tus necesidades. A continuación dejo un sencillo ejemplo que carga productos.xml y visualiza los datos en la pantalla.

Abre un nuevo documento de flash y en el primer fotograma clave copia el siguiente código.

Actionscript:
  1. // -- formato para mostrar el texto
  2. var my_format:TextFormat = new TextFormat ();
  3. my_format.font = "Verdana";
  4. my_format.size = 10;
  5. my_format.color = 0x000000;
  6. // -- textfield para mostrar los datos en formarto HTML en columnas
  7. var table_txt:TextField = this.createTextField ("table_txt", 1, 20, 20, 500, 200);
  8. table_txt.html = true;
  9. table_txt.multiline = true;
  10. table_txt.wordWrap = true;
  11. table_txt.htmlText = "<textformat tabstops='[50,250]'>";
  12. // -- variables que conforman las columnas
  13. var _rowHeaders:String;
  14. var _row1:String;
  15. var _row2:String;
  16. var _row3:String;
  17. // -- leer XML
  18. var my_xml:XML = new XML ();
  19. my_xml.ignoreWhite = true;
  20. my_xml.load ("productos.xml");
  21. my_xml.onLoad = parse;
  22. // --
  23. function parse (succes):Void {
  24. if (succes) {
  25. printScreen (this);
  26. } else {
  27. trace ("Error");
  28. }
  29. }
  30. // -- mostrar los datos en la pantalla
  31. function printScreen (xmlObj):Void {
  32. var xmlNode:XMLNode = xmlObj.firstChild;
  33. // -- cabeceras
  34. _row1 = xmlNode.firstChild.childNodes[0].nodeName;
  35. _row2 = xmlNode.firstChild.childNodes[1].nodeName;
  36. _row3 = xmlNode.firstChild.childNodes[2].nodeName;
  37. _rowHeaders = "<b>" + _row1 + "t" + _row2 + "t" + _row3 + "</b>";
  38. table_txt.htmlText += _rowHeaders;
  39. // -- registros
  40. for (var i:Number = 0; i < xmlNode.childNodes.length; i++) {
  41. _row1 = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
  42. _row2 = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
  43. _row3 = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
  44. table_txt.htmlText += _row1 + "t" + _row2 + "t" + _row3;
  45. }
  46. // -- eof
  47. table_txt.htmlText += "</textformat>";
  48. table_txt.setTextFormat (my_format);
  49. }

Archivos de ejemplo

Descarga Accestoflash

Accestoflash se ha descargado 1,360 veces.

Páginas: 1 2 3 4

5 Votes | Average: 4.6 out of 55 Votes | Average: 4.6 out of 55 Votes | Average: 4.6 out of 55 Votes | Average: 4.6 out of 55 Votes | Average: 4.6 out of 5 (5 votos, promedio: 4.6 sobre 5)
Loading ... Loading ...

1 Response to “Importar datos de Microsoft Access a Flash”


  1. 1 DavidMy Apr 11th, 2007 at 3:17 pm

    Oye esto esta genial!!! recien he comenzado a entrar a investigar la manera de comunicar a Access con Flash, me he matado buscando la manera y esta es la más rapida y sencilla q han proporcionado... gracias!!!

Leave a Reply




Subscribe

Subscribe to my RSS Feeds