Hey,
so I’m working on a program that calls a php script and then loads an xml. The program works exactly how I want in the IDE but unfortunately when it is on the server it doesn’t work correctly (of course :puzzled: ). Anyways so i’ve been trouble shooting for quite some time and my guess is that the problem arises somewhere before the php call (when i make it, the variable is shown as undefined by the script). I use navigateToURL in order to test this and the script received the variable when in IDE but not from browser.
Anyways here is the code, plz take a looksy:
AS3 code:[
//this method is called everytime user scrolls.
function scroll(e:MouseEvent):void
{
StatusBar.text = “”+randArray[0];
//checks interested orientation of rand1,2,3
var myURLRequest:URLRequest = new URLRequest(“http://www.myDomain.com/generateRand.php”);
sendToURL(myURLRequest);
var randXML:URLLoader = new URLLoader();
randXML.load(new URLRequest("http://www.myDomain.com/blackList.xml"));
randXML.addEventListener(Event.COMPLETE, getRandNumbers);
}
function displayRandos(random1:String,random2:String,random3:String):void
{
profile1.unload();
profile1.source = “http://myDomain”+random1+".jpg";
addChild(profile1);
profile2.unload();
profile2.source = “http://myDomain”+random2+".jpg";
addChild(profile2);
profile3.unload();
profile3.source = “http://myDomain”+random3+".jpg";
addChild(profile3);
}
function getRandNumbers(e:Event):void{
var myXML = new XML(e.target.data);
randArray[0] = myXML.user[0].attributes()[1];
randArray[1] = myXML.user[1].attributes()[1];
randArray[2] = myXML.user[2].attributes()[1];
trace(randArray[0]);
trace(randArray[1]);
trace(randArray[2]);
StatusBar.text = randArray[0];
userid = myXML.user[0].attributes()[0];
displayRandos(randArray[0],randArray[1],randArray[2]);
}
]
I believe the issue lies somewhere in there. BTW the .swf also runs fine when ran on local machine
Also this is the xml that I use
<?xml version=“1.0”?>
<rands>
<user userid="" id=“48” link=“http://myDomain/48.jpg”>1</user>
<user userid="" id=“38” link=“http://myDomain/38.jpg”>2</user>
<user userid="" id=“16” link=“http://myDomain/16.jpg”>3</user>
</rands>
thanks guys for the potential help.
I’m about to go crrrrrrazy:deranged: