homepage Welcome to WebmasterWorld Guest from 54.204.231.253
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

    
Dynamic XML buttons in Flash
bac0417




msg:3976308
 11:19 am on Aug 21, 2009 (gmt 0)

I'm trying to assign buttons to random words that are loaded from an XML document into a flash document. The buttons would open an overlay on the same page. The other catch is, I would only like to pick words that fall on the left side of the page (say between x = 55 to 250). So about 4 buttons on the left, overlay to the right. Does that make sense? I've been searching online and I have no idea how to do this.

The current XML load code in actionscript:

var myXML:XML = new XML();
var XML_URL:String = "myXMLFile.xml";
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);

function xmlLoaded(event:Event):void {

myXML = XML(myLoader.data);
var xmlDoc:XMLDocument = new XMLDocument();
xmlDoc.ignoreWhite = true;
var menuXML:XML = XML(myLoader.data);
xmlDoc.parseXML(menuXML.toXMLString());

for each (var ListItem:XML in myXML..ListItem) {
var listLabel:String = ListItem.itemLabel.toString();
var myFont = new Font1();

var myFormat:TextFormat = new TextFormat();
myFormat.size = 36;
myFormat.align = TextFormatAlign.JUSTIFY;
myFormat.font = myFont.fontName;

var myText1:TextField = new TextField();
myText1.defaultTextFormat = myFormat;
myText1.embedFonts = true;
myText1.antiAliasType = AntiAliasType.ADVANCED;
myText1.text = listLabel;
myText1.textColor = 0xD1D3D4;


myText1.x = 55; //cushion
myText1.y = 50;
myText1.wordWrap = true;
myText1.width = 920;
myText1.height = 660;

var clip_mc = new MovieClip();
clip_mc.addChild(myText1);
addChild(clip_mc);

}

}

And, not sure if this is necessary, but here is the xml doc:

<?xml version="1.0" encoding="utf-8"?>
<XML>

<myXMLList>

<ListItem>
<itemLabel>I really enjoy his talks on life and lorem ipsum etc. Lots more text.</itemLabel>
</ListItem>

</myXMLList>

</XML>

Thanks so much for your help!
Brandi

 

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved