mmdguru
10-21-2009, 01:16 PM
Hi flashers,
I have an XML response that goes like this:
<vervelst>
> <vervet>
> <id>10456</id>
> <fornavn></fornavn>
> <etternavn></etternavn>
> <epost>[email protected]</epost>
> <mobil>[email protected]</mobil>
> <samtykkeepost>0</samtykkeepost>
> <samtykkekonkurranse>0</samtykkekonkurranse>
> <status>2</status>
> </vervet>
> <vervet>
> <id>10464</id>
> <fornavn>Rune</fornavn>
> <etternavn>Helge</etternavn>
> <epost>[email protected]</epost>
> <mobil>[email protected]</mobil>
> <samtykkeepost>0</samtykkeepost>
> <samtykkekonkurranse>1</samtykkekonkurranse>
> <status>1</status>
> </vervet>
> </vervelst>
With my code I can trace out what is important to me, that's the status and epost nodes!
I want to load this data into a movieclip with two textfields(status and epost) in flash. The problem is that I need to add movieclips dynamically equal to the length of my XML file. The XML can contain hundreds of <vervet> nodes! This is being added from a database through asp=)
Any ideas guys?? All help is greatly appreciated!
My Code so far:
package {
import flash.display.Sprite;
import flash.events.*;
import flash.net.*;
public class Status extends Sprite {
public var qs:QueryString = new QueryString();
public var id:int=10007;//qs.parameters.id;
public function Status() {
var scriptURL:URLRequest=new URLRequest("http://connectorretail.com/dn/fame/hentstatus.asp");
scriptURL.method=URLRequestMethod.POST;
var postVars:URLVariables = new URLVariables();
postVars.id=id;
scriptURL.data=postVars;
var scriptLoader:URLLoader = new URLLoader();
scriptLoader.addEventListener(Event.COMPLETE, scriptDoneLoading);
scriptLoader.load(scriptURL);
}
function scriptDoneLoading(evt:Event):void {
var responseXML:XML=new XML(evt.target.data);
parseData(responseXML);
}
function parseData(xmlOutput:XML):void {
trace("XML Output");
trace("------------------------");
trace(xmlOutput.vervet.epost);
trace(xmlOutput.vervet.status)
}
}
}
As you can see, I can trace the "epost" and "status"! I just need to represent this data into flash=)
I have an XML response that goes like this:
<vervelst>
> <vervet>
> <id>10456</id>
> <fornavn></fornavn>
> <etternavn></etternavn>
> <epost>[email protected]</epost>
> <mobil>[email protected]</mobil>
> <samtykkeepost>0</samtykkeepost>
> <samtykkekonkurranse>0</samtykkekonkurranse>
> <status>2</status>
> </vervet>
> <vervet>
> <id>10464</id>
> <fornavn>Rune</fornavn>
> <etternavn>Helge</etternavn>
> <epost>[email protected]</epost>
> <mobil>[email protected]</mobil>
> <samtykkeepost>0</samtykkeepost>
> <samtykkekonkurranse>1</samtykkekonkurranse>
> <status>1</status>
> </vervet>
> </vervelst>
With my code I can trace out what is important to me, that's the status and epost nodes!
I want to load this data into a movieclip with two textfields(status and epost) in flash. The problem is that I need to add movieclips dynamically equal to the length of my XML file. The XML can contain hundreds of <vervet> nodes! This is being added from a database through asp=)
Any ideas guys?? All help is greatly appreciated!
My Code so far:
package {
import flash.display.Sprite;
import flash.events.*;
import flash.net.*;
public class Status extends Sprite {
public var qs:QueryString = new QueryString();
public var id:int=10007;//qs.parameters.id;
public function Status() {
var scriptURL:URLRequest=new URLRequest("http://connectorretail.com/dn/fame/hentstatus.asp");
scriptURL.method=URLRequestMethod.POST;
var postVars:URLVariables = new URLVariables();
postVars.id=id;
scriptURL.data=postVars;
var scriptLoader:URLLoader = new URLLoader();
scriptLoader.addEventListener(Event.COMPLETE, scriptDoneLoading);
scriptLoader.load(scriptURL);
}
function scriptDoneLoading(evt:Event):void {
var responseXML:XML=new XML(evt.target.data);
parseData(responseXML);
}
function parseData(xmlOutput:XML):void {
trace("XML Output");
trace("------------------------");
trace(xmlOutput.vervet.epost);
trace(xmlOutput.vervet.status)
}
}
}
As you can see, I can trace the "epost" and "status"! I just need to represent this data into flash=)