Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Actionscript3+XML help


  • Please log in to reply

#1
Fighterlegend

Fighterlegend

    New Member

  • Member
  • Pip
  • 1 posts
Hello! This is my first post on this wonderful website. I really find it useful.

I have a problem with AS3.

Check for your self in the SWF (located below).


It wont load only one report form a user. It loads it from both users.

I need help to stop this, and only load it on the selected user.


How could I go about doing this?


Test it out and tell me what's wrong:


IF YOU WANT TO SEE THE XML FILE:
http://teamwhatsthei...lp/userTest.xml

Please, tell me!

Here's the script:

import flash.display.Sprite;import flash.events.Event;import fl.events.ListEvent;import fl.controls.List;import flash.net.*;var myXML:XML;var myLoader:URLLoader = new URLLoader();var req:URLRequest;var txt:String = "! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ";var myXML2:XML;var item:Object;req = new URLRequest("userTest.xml");myLoader.load(req);myLoader.addEventListener(Event.COMPLETE, processXML);myLoader.addEventListener(ProgressEvent.PROGRESS, progXML);myLoader.addEventListener(IOErrorEvent.IO_ERROR, failXML);function progXML(event:Event):void {	feedBack.text = "Loading, please wait";}function processXML(e:Event):void {	myXML = new XML(e.target.data);	feedBack.text = "Loaded!";	scrollBar.update();	selectUser(myXML);}function failXML(e:Event):void {	feedBack.text = "Failed Loading.";	reasonBox.text = "Event happened: "+e;	scrollBar.update();}function selectUser(userXML:XML):void {	my_lst.removeAll();	feedBack.text = "Finding Users";	var userList:XMLList = userXML.user;	for each (var userUser:XML in userList) {		my_lst.addItem({label:userUser.userName, data:userUser.userName});		feedBack.text = "Found Users";	}	my_lst.addEventListener(ListEvent.ITEM_CLICK, sendUserData);}function sendUserData(e:ListEvent):void {	my_lst.removeAll();	Parseuser(myXML);	feedBack.text = "Sending User Data";}function Parseuser(userXML:XML):void {	var userList2:XMLList = userXML.user;	for each (var userTitle:XML in userList2) {		my_lst.addItem({label:userTitle.report.item.title, data:userTitle.report.item.reason});		feedBack.text = "Found Reports";	}	my_lst.addEventListener(ListEvent.ITEM_CLICK, announceLabel);	feedBack.text = "Finding Reports";}function announceLabel(e:ListEvent):void {	titleBox.text = "";	reasonBox.text = "";	item= e.item;	trace("Label: " + item.label);	trace("Data: " + item.data);	titleBox.text = item.label;	reasonBox.appendText(item.data);}function xmlLoadError(e:IOErrorEvent) {	trace("Unable to connect to Data source. \n" + e.text);	reasonBox.htmlText = "<b>Unable to connect to Data source. /n"+e.text;}function handleSecurityError(e:SecurityErrorEvent ) {	trace("SecurityErrorEvent: " + e.text);	reasonBox.htmlText = "<b>SecurityErrorEvent:</b> "+e.text;}

Plus, I haven't gotten down to the reload button, or most of the clear button ><

Just busy fixing the bugs.

Please help!

-Fighterlegend
  • 0

Advertisements







Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP