I am working on a random number generator in PHP and I want to send the result to the AS3 (it is much complicated but this is the main purpose)
PHP:
<?php
function random() {
calculating it...sql query ...blabla
return $randomNumber;
}
print "randomNumber=".random();
?>
AS3:
var loader:URLLoader = new URLLoader();
var myRequest:URLRequest=new URLRequest("mylink");
function randomPhp():void {
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, completeRandom);
loader.load( myRequest );
}
function completeRandom(e:Event):void {
winner=e.target.data.randomNumber;
loader.removeEventListener( Event.COMPLETE, completeRandom );
}
The first time it generates a random Number but after that it's not changing if I call it multiple times. It's like if it creates an instance in the cache.I don't know how to fix this or reset it. And if I run my project and in the time I delete the whole PHP , the AS3 is running like nothing happened. Please HELP!!!