Ver Mensaje Individual
  #5 (permalink)  
Antiguo 21/06/2011, 14:35
millyway343
 
Fecha de Ingreso: junio-2011
Mensajes: 5
Antigüedad: 12 años, 10 meses
Puntos: 0
Respuesta: Problema accediendo a texto desde funcion

Este es el código:

package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.net.*;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;

public class MenuDinamico extends Sprite
{

public var datos:XML;

public function MenuDinamico()
{
cargarDatos();
}

private function cargarDatos():void {

var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, cargado);
loader.addEventListener(IOErrorEvent.IO_ERROR, error);
loader.load(new URLRequest("datos.xml"));

}

private function error(e:IOErrorEvent):void {

trace("error al cargar el XML: " + e);

}

private function cargado(e:Event):void {

datos = new XML(e.target.data);

var logo:logoSena;
logo = new logoSena();
logo.x = 415.9;
logo.y = -94.4;
addChild(logo);

var back:backBlue;
back = new backBlue();
back.x = 909.8;
back.y = -18.4;
addChild(back);

var myTween = new Tween(logo, "y", Strong.easeInOut, -94.4,87.1, 10, false);

myTween.addEventListener(TweenEvent.MOTION_FINISH, onFinish);
function onFinish(e:TweenEvent):void {
var myTween = new Tween(logo, "x", Bounce.easeOut, 415.9,64.5, 10, false);
myTween.addEventListener(TweenEvent.MOTION_FINISH, onFinish2);
}

function onFinish2(e:TweenEvent):void {
var myTween = new Tween(back, "x", Strong.easeOut, 909.8,258.8, 5, false);
myTween.addEventListener(TweenEvent.MOTION_FINISH, onFinish3);
}

function onFinish3(e:TweenEvent):void {
montar();
}
}

private function montar():void {

var xx = 152.8;
var yy = 250;
var boton:ElementoMenu;
for (var i:uint = 0; i < datos.temas.tema.length(); i++) {
boton = new ElementoMenu();
boton.img.Texto_txt.text = datos.temas.tema[i].titulo;
boton.enlace = datos.temas.tema[i].tipo;
boton.x = xx;
boton.y = yy;

yy = yy + 50;
boton.buttonMode = true;
boton.mouseChildren = false;
boton.addEventListener(MouseEvent.CLICK, navegar);
addChildAt(boton,1);
}
}

private function navegar(e:MouseEvent):void {
trace(TextField(stage["campo"]).text);
//setDisplay(ppalTexto);
//MovieClip(root).texto.mainText.text = "hola";
//trace(e.currentTarget.enlace);
}



}

}

Como pueden ver la funcion navegar es la crucial. Allí van todos mis intentos comentados sin éxitos con ninguno. Gracias por al ayuda.