URLLoader trouble

Hi there !

I’ve a little trouble with a functionality of a game.
It’s a drawing game, you can color or draw and then, send to your friends.
For doing that, I convert the vector container to a BitMap, create a jpg, save on the server and send it. It works fine but sometimes the php script is loaded 2,3,4 times… so I receive all these mail… and its bad.

here is part of my class :


    public function php_send_data(to_send_data,header_option:String,header_content_type:String,file:String):void
    {
        var header:URLRequestHeader = new URLRequestHeader(header_option,header_content_type);
        var script:URLRequest = new URLRequest(file);
        var execute_request:URLLoader = new URLLoader();
        
        script.requestHeaders.push(header);
        script.method = URLRequestMethod.POST;
        script.data = to_send_data;
        execute_request.addEventListener(Event.COMPLETE,execute_complete);
        execute_request.load(script);        
    }
     protected function execute_complete(evt:Event)
    {
        dispatchEvent(evt);
    }
    

and here it’s how I call the method :


var send_mail = new php_communicate();
send_mail.php_send_data(jpgStream,'Content-type','application/octet-stream','save_to_remote.php?to='+send_mail_form.mail_to.text+'&message='+send_mail_form.message_box.text+'&from='+send_mail_form.from.text);
        
        send_mail.addEventListener(Event.COMPLETE,mail_sent);
        
        function mail_sent(evt:Event):void
        {
            send_mail_form.visible=false;
            send_mail_form.x = -100;
            send_mail_form.y = -100;
        }        


I’ve no idea whats wrong…