Search code examples
phpactionscript-3flash-cs4flash-cs5

Passing var to php from as3 - My problem is php page is calling twice. I want to call only once


This is my php code to check how many time the page is calling.

if($_SESSION['test']==''){
            $_SESSION['test'] = 1;
            echo " cond 1 ";
        }
        else {
            echo " cond 2 ";
            $_SESSION['test'] = $_SESSION['test']+1;
        }
        echo " test value = ".$_SESSION['test'];    

        exit;

and this is my AS3.0 code to pass the var to php.

phpVar.id = phpvars;
phpVar.selectsize = selectedSize;
phpURLr.method = URLRequestMethod.POST;
phpURLr.data = phpVar;      
phpLoader.dataFormat = URLLoaderDataFormat.TEXT;
phpLoader.load(phpURLr);    
navigateToURL(phpURLr,"_self");

My problem is , I am calling the php page only once, but it is calling the page 2 times.

Pls help me to find out the bug.


Solution

  • phpLoader.load(phpURLr); //first call
    navigateToURL(phpURLr,"_self"); //second call
    

    In the 1st call you're sending request from AS3. In the 2nd request your sending request from your browser.