Hi all,
I’m loading some text from a xml into flash. Now for each piece of text needs to be a Click event. So if i click on xmlData.location1 i need to go to the info about location1. If I click on xmlData.location2 i need to go to the info about location two. See code blow.
public function HotelLocations(){
LocationsLoader.load(new URLRequest("hotellocations.xml"));
LocationsLoader.addEventListener(Event.COMPLETE, onComplete);
function onComplete(e:Event):void
{
xmlData=new XML(e.target.data);
var LocationFormat:TextFormat = new TextFormat();
LocationFormat.font = myFont.fontName;
LocationFormat.size = 13;
var textArray:Array = new Array();
var text:Array = new Array(xmlData.location1, xmlData.location2, xmlData.location3, xmlData.location4, xmlData.location5, xmlData.location6, xmlData.location7, xmlData.location8, xmlData.location9, xmlData.location10, xmlData.location11, xmlData.location12, xmlData.location13, xmlData.location14, xmlData.location15, xmlData.location16, xmlData.location17, xmlData.location18, xmlData.location19, xmlData.location20/*, xmlData.location21,xmlData.location22, xmlData.location23*/);
for (var i:int; i < 20; i++) {
var LocationText:TextField = new TextField();
//LocationText.autoSize = TextFieldAutoSize.LEFT;
LocationText.selectable = false;
if (i == 0)
LocationText.y = 40;
else
LocationText.y = 40+i*20;
LocationText.x = 50;
LocationText.defaultTextFormat = LocationFormat;
LocationText.textColor = 0x7e7e7e;
LocationText.embedFonts = true;
LocationText.antiAliasType = AntiAliasType.ADVANCED;
LocationText.text = text*;
bg.addChild(LocationText)
textArray.push(LocationText)
LocationText.addEventListener(MouseEvent.CLICK, processLocation);
}//end of for (var i:int; i < 3; i++) {
function processLocation(event:Event):void{
[SIZE=2][SIZE=3] TweenLite.to(xmlData.location1, 2, {x:-320, y:240, onComplete:tweenfinished7}); //HERE IT GOES WRONG BECAUSE I CALL xmlData.Location1 BUT THAT ISN'T POSSIBLE!![/SIZE][/SIZE]
}//end of function processReturn(event:Event):void{
}//end of function onComplete
}//end of public function HotelLocations(){
I don’t know the solution for this but I think it will be pretty easy!
Thanks in advance!