Could anyone explain why I am getting an output of “undifined” when I trace a e.currentTarget value in the final callFull function of my AS?
Here is the AS…
import flash.display.MovieClip;
//var outer_mc:MovieClip;
var container_mc:MovieClip;
var myXML:XML;
var myTotal:Number;
var myItem:XMLList;
var myTitle:XMLList;
Font.registerFont(hattoriHanzo);
var textBox:TextField = new TextField();
var textBox1:TextField = new TextField();
var textBox2:TextField = new TextField();
var fullText:TextField = new TextField();
var format:TextFormat = new TextFormat();
format.size = 24;
format.leading = 1;
format.align = TextFormatAlign.LEFT;
format.font = "Hattori Hanzo Light";
format.bold = true;
format.color = 0x333333;
format.letterSpacing = 2;
var format1:TextFormat = new TextFormat();
format1.size = 12;
format1.leading = 1;
format1.align = TextFormatAlign.LEFT;
format1.font = "Hattori Hanzo Light";
format1.bold = true;
format1.color = 0x999999;
format1.letterSpacing = 2;
var myXMLLoader:URLLoader = new URLLoader();
myXMLLoader.load(new URLRequest("http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/front_page/rss.xml"));
myXMLLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void
{
myXML = new XML(e.target.data);
myTotal = myXML.channel.item.length();
myItem = myXML.channel.item;
//outer();
callNews();
}
/*function outer():void
{
outer_mc = new MovieClip;
addChild(outer_mc);
}*/
function callNews():void
{
for (var i:int = 0; i < myTotal; i++)
{
textBox = new TextField();
textBox.defaultTextFormat = format;
textBox.selectable = false;
textBox.mouseEnabled = false;
textBox.antiAliasType = AntiAliasType.ADVANCED;
textBox.multiline = true;
textBox.wordWrap = true;
textBox.width = 100;
textBox1 = new TextField();
textBox1.defaultTextFormat = format;
textBox1.selectable = false;
textBox1.mouseEnabled = false;
textBox1.antiAliasType = AntiAliasType.ADVANCED;
textBox1.multiline = true;
textBox1.wordWrap = true;
textBox1.width = 400;
textBox1.x = 300;
textBox2 = new TextField();
textBox2.defaultTextFormat = format1;
textBox2.selectable = false;
textBox2.mouseEnabled = false;
textBox2.antiAliasType = AntiAliasType.ADVANCED;
textBox2.multiline = true;
textBox2.wordWrap = true;
textBox2.width = 700;
textBox2.y = 40;
myTitle = myItem*.title;
var myDate = myItem*.pubDate;
var myDesc = myItem*.description;
textBox.text = myTitle;
textBox1.text = myDate;
textBox2.text = myDesc;
container_mc = new MovieClip;
container_mc.addChild(textBox);
container_mc.addChild(textBox1);
container_mc.addChild(textBox2);
container_mc.height = 150;
container_mc.width = 700;
container_mc.y = (container_mc.height+10)*i;
addChild(container_mc);
container_mc.addEventListener(MouseEvent.CLICK, callFull);
}
}
function callFull(e:MouseEvent):void
{
trace(e.currentTarget.myTitle);
}