Flash menú de xml, creación de enlaces

  • Mrc1n4
  • Novice
  • Novice
  • No Avatar
  • Registrado: Abr 04, 2006
  • Mensajes: 26
  • Loc: Slovenia
  • Status: Offline

Nota Octubre 21st, 2006, 4:43 am

Hola! Aquí está mi pregunta...Tengo un archivo XML con este código:


Quote:
<friends>
<friend url="http://www.friend1.com"> George </ amigo>
<friend url="http://www.friend2.com"> John </ amigo>
<friend url="http://www.friend3.com"> Peter </ amigo>
<amigo url = "http://www.friend4. com "> Michael </ amigo>
</ amigos>



Y un código de ActionScript:


Quote:
var myXML: XML = new XML ();
myXML.ignoreWhite = true;
myXML.onLoad = parseXML;
myXML.load ( "friends.xml");

función parseXML ()
(
text1.text = myXML.firstChild.childNodes [0]. firstChild.nodeValue;
text2.text = myXML.firstChild.childNodes [1]. firstChild.nodeValue;
text3.text = myXML.firstChild.childNodes [2]. firstChild.nodeValue;
text4.text = myXML.firstChild.childNodes [3]. firstChild.nodeValue;
)





¿Cómo puedo hacer que los vínculos de trabajo XML en actionscript?

Gracias por respuestas :D
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Octubre 21st, 2006, 4:43 am

  • IceCold
  • Guru
  • Guru
  • Avatar de Usuario
  • Registrado: Nov 05, 2004
  • Mensajes: 1254
  • Loc: Ro
  • Status: Offline

Nota Octubre 23rd, 2006, 4:16 am

en primer lugar la carga dinámicamente desde que usted lo desea, puede agregar o quitar elementos del XML sin cambiar el código en el código ActionScript.
Pero, para este ejemplo, hacer text1 un clip de película (cambiar el nombre de primero a txt, lo selecciona en el escenario, presione F8 y hacer clip de película), y luego dar el nombre de instancia (en el panel de la propiedad): txt1;
entonces solo duplique txt1 hasta U tiene 4 MCS, el nombre de ellos txt2, txt3, txt4.
a continuación:
Código: [ Select ]
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = parseXML;
myXML.load("friends.xml");

function parseXML()
{
text1.txt.text = myXML.firstChild.childNodes[0].firstChild.nodeValue;
text1.strURL = myXML.firstChild.childNodes[0].attributes.url;
text2.txt.text = myXML.firstChild.childNodes[1].firstChild.nodeValue;
text2.strURL = myXML.firstChild.childNodes[1].attributes.url;
text3.txt.text = myXML.firstChild.childNodes[2].firstChild.nodeValue;
text3.strURL = myXML.firstChild.childNodes[2].attributes.url;
text4.txt.text = myXML.firstChild.childNodes[3].firstChild.nodeValue;
text4.strURL = myXML.firstChild.childNodes[3].attributes.url;

text1.onPress = function()
{
  getURL(this.strURL);
}
text2.onPress = function()
{
  getURL(this.strURL);
}

text3.onPress = function()
{
  getURL(this.strURL);
}

text4.onPress = function()
{
  getURL(this.strURL);
}

}
  1. var myXML:XML = new XML();
  2. myXML.ignoreWhite = true;
  3. myXML.onLoad = parseXML;
  4. myXML.load("friends.xml");
  5. function parseXML()
  6. {
  7. text1.txt.text = myXML.firstChild.childNodes[0].firstChild.nodeValue;
  8. text1.strURL = myXML.firstChild.childNodes[0].attributes.url;
  9. text2.txt.text = myXML.firstChild.childNodes[1].firstChild.nodeValue;
  10. text2.strURL = myXML.firstChild.childNodes[1].attributes.url;
  11. text3.txt.text = myXML.firstChild.childNodes[2].firstChild.nodeValue;
  12. text3.strURL = myXML.firstChild.childNodes[2].attributes.url;
  13. text4.txt.text = myXML.firstChild.childNodes[3].firstChild.nodeValue;
  14. text4.strURL = myXML.firstChild.childNodes[3].attributes.url;
  15. text1.onPress = function()
  16. {
  17.   getURL(this.strURL);
  18. }
  19. text2.onPress = function()
  20. {
  21.   getURL(this.strURL);
  22. }
  23. text3.onPress = function()
  24. {
  25.   getURL(this.strURL);
  26. }
  27. text4.onPress = function()
  28. {
  29.   getURL(this.strURL);
  30. }
  31. }
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • Mrc1n4
  • Novice
  • Novice
  • No Avatar
  • Registrado: Abr 04, 2006
  • Mensajes: 26
  • Loc: Slovenia
  • Status: Offline

Nota Octubre 23rd, 2006, 9:11 am

Hola! Gracias por su respuesta.


Ahora mis vínculos de trabajo, pero el texto no se puso de manifiesto en mi campos de texto dinámicos (en txt movieclip). Su solo espacio en blanco, pero puede hacer clic en él. Ha intentado en flash y trabaja para usted?
  • IceCold
  • Guru
  • Guru
  • Avatar de Usuario
  • Registrado: Nov 05, 2004
  • Mensajes: 1254
  • Loc: Ro
  • Status: Offline

Nota Octubre 23rd, 2006, 11:18 pm

incrustar fuente --> Continúa dinámico y la sección de fuente de entrada.
o...dinámica para integrar...u pero no es necesario este momento, de todos modos su para el resto de los usuarios, en caso de que se olvidó dinámica font integrar
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • Mrc1n4
  • Novice
  • Novice
  • No Avatar
  • Registrado: Abr 04, 2006
  • Mensajes: 26
  • Loc: Slovenia
  • Status: Offline

Nota Octubre 24th, 2006, 5:36 am

Hola! I incrustado fuente, pero aún no muestra...Si se me ponga dinámica txt directamente en la escena principal que esto funciona, pero si puse en MC no es así.
Aquí está mi. Fla u si quieren verlo:
descarga. RAR
  • IceCold
  • Guru
  • Guru
  • Avatar de Usuario
  • Registrado: Nov 05, 2004
  • Mensajes: 1254
  • Loc: Ro
  • Status: Offline

Nota Octubre 24th, 2006, 7:08 am

probablemente usted no nombre las instancias de clips de la película. mal echar un vistazo por encima de su fla para ver.
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • Mrc1n4
  • Novice
  • Novice
  • No Avatar
  • Registrado: Abr 04, 2006
  • Mensajes: 26
  • Loc: Slovenia
  • Status: Offline

Nota Octubre 25th, 2006, 1:13 pm

No, ellos llamado derecho creo...¿U comprobar mi. Fla?
  • IceCold
  • Guru
  • Guru
  • Avatar de Usuario
  • Registrado: Nov 05, 2004
  • Mensajes: 1254
  • Loc: Ro
  • Status: Offline

Nota Octubre 25th, 2006, 9:48 pm

lo hará más tarde...i en caso no se olvide, ya que tengo sólo flash 8 @ home.
si puede colocar la versión MX entonces puedo hacerlo antes.
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • Mrc1n4
  • Novice
  • Novice
  • No Avatar
  • Registrado: Abr 04, 2006
  • Mensajes: 26
  • Loc: Slovenia
  • Status: Offline

Nota Octubre 26th, 2006, 6:19 am

Aquí está mx2004, pero creo que su no utilización para u?
clic
  • IceCold
  • Guru
  • Guru
  • Avatar de Usuario
  • Registrado: Nov 05, 2004
  • Mensajes: 1254
  • Loc: Ro
  • Status: Offline

Nota Octubre 27th, 2006, 12:00 am

heh...usted tiene 2 problemas
1) que no haya ejemplo, el campo de texto dentro de text1, text2, text3...
para ello, simplemente haga doble clic en txt movieclip de la biblioteca (o text1 de la escena), seleccione el campo de texto y el nombre de su ejemplo: txt. El cambio se reflejará en todos los demás, porque son los casos del mismo movieclip.
2) usted no integrar correctamente la fuente. Usted hace clic en efecto gamas Especificar...pero la próxima usted tiene que seleccionar un conjunto char -> i sugieren básica Latina.
Puede seleccionar rangos más si mantiene pulsado Ctrl y, a continuación, pulse con el ratón sobre otros temas.
También se pueden incluir otros caracteres (sólo si es necesario), introduciéndolas en los Incluir estos caracteres caja. Usted tendrá que hacer esto si algunos personajes no aparecen en el texto (como $,%, #...etc...depende)
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • Mrc1n4
  • Novice
  • Novice
  • No Avatar
  • Registrado: Abr 04, 2006
  • Mensajes: 26
  • Loc: Slovenia
  • Status: Offline

Nota Octubre 27th, 2006, 7:00 am

Oh gracias M8...Ahora funciona bien :)
  • Craiggiej
  • Born
  • Born
  • No Avatar
  • Registrado: Sep 20, 2007
  • Mensajes: 3
  • Status: Offline

Nota Septiembre 20th, 2007, 7:39 pm

Im sólo pregunto....

IceCold,
En las indicaciones de arriba para avisar a nombre de las instancias de cada imagen en movimiento: txt1, txt2, txt3, y txt4...Sin embargo, no veo donde usted referencia a que el actionscript. ¿Podría decirme su razonamiento que está detrás de eso, o se me acaba de desaparecidos?

Gracias!
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • Avatar de Usuario
  • Registrado: May 28, 2003
  • Mensajes: 23404
  • Loc: Woodbridge VA
  • Status: Offline

Nota Septiembre 20th, 2007, 8:05 pm

Que porque si desplazarse hacia arriba verá el código de secuencia de comandos de acción y no es txt1, txt2, txt3, y txt4...Se text1, text2, text3, y text4...Spelling hace un mundo de diferencia.
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
  • Craiggiej
  • Born
  • Born
  • No Avatar
  • Registrado: Sep 20, 2007
  • Mensajes: 3
  • Status: Offline

Nota Septiembre 21st, 2007, 4:23 am

Para citar lo que me refiero a...tal vez que están mal escritas. Yhou puede confirmar? Gracias!


Pero, para este ejemplo, hacer text1 un clip de película (cambiar el nombre de primero a txt, lo selecciona en el escenario, presione F8 y hacer clip de película), y luego dar el nombre de instancia (en el panel de la propiedad): txt1;
entonces solo duplique txt1 hasta U tiene 4 MCS, el nombre de ellos txt2, txt3, txt4.
a continuación:
Código: [ Select ]
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = parseXML;
myXML.load("friends.xml");

function parseXML()
{
text1.txt.text = myXML.firstChild.childNodes[0].firstChild.nodeValue;
text1.strURL = myXML.firstChild.childNodes[0].attributes.url;
text2.txt.text = myXML.firstChild.childNodes[1].firstChild.nodeValue;
text2.strURL = myXML.firstChild.childNodes[1].attributes.url;
text3.txt.text = myXML.firstChild.childNodes[2].firstChild.nodeValue;
text3.strURL = myXML.firstChild.childNodes[2].attributes.url;
text4.txt.text = myXML.firstChild.childNodes[3].firstChild.nodeValue;
text4.strURL = myXML.firstChild.childNodes[3].attributes.url;

text1.onPress = function()
{
  getURL(this.strURL);
}
text2.onPress = function()
{
  getURL(this.strURL);
}

text3.onPress = function()
{
  getURL(this.strURL);
}

text4.onPress = function()
{
  getURL(this.strURL);
}

}
  1. var myXML:XML = new XML();
  2. myXML.ignoreWhite = true;
  3. myXML.onLoad = parseXML;
  4. myXML.load("friends.xml");
  5. function parseXML()
  6. {
  7. text1.txt.text = myXML.firstChild.childNodes[0].firstChild.nodeValue;
  8. text1.strURL = myXML.firstChild.childNodes[0].attributes.url;
  9. text2.txt.text = myXML.firstChild.childNodes[1].firstChild.nodeValue;
  10. text2.strURL = myXML.firstChild.childNodes[1].attributes.url;
  11. text3.txt.text = myXML.firstChild.childNodes[2].firstChild.nodeValue;
  12. text3.strURL = myXML.firstChild.childNodes[2].attributes.url;
  13. text4.txt.text = myXML.firstChild.childNodes[3].firstChild.nodeValue;
  14. text4.strURL = myXML.firstChild.childNodes[3].attributes.url;
  15. text1.onPress = function()
  16. {
  17.   getURL(this.strURL);
  18. }
  19. text2.onPress = function()
  20. {
  21.   getURL(this.strURL);
  22. }
  23. text3.onPress = function()
  24. {
  25.   getURL(this.strURL);
  26. }
  27. text4.onPress = function()
  28. {
  29.   getURL(this.strURL);
  30. }
  31. }
[/ quote]

Publicar Información

  • Total de mensajes en este tema: 14 mensajes
  • Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 45 invitados
  • No puede abrir nuevos temas en este Foro
  • No puede responder a temas en este Foro
  • No puede editar sus mensajes en este Foro
  • No puede borrar sus mensajes en este Foro
  • No puede enviar adjuntos en este Foro
 
 

© 2011 Unmelted, LLC. Ozzu® es una marca registrada de Unmelted, LLC