×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    23

    LoadVars - communication with a server

    Hi All,
    I'm really newbie of Flash Lite, but i did something with Flash in the past. So If I said something completely wrong, be patient...
    I would like to exchange data with a server. My mobile should take the path of an image. It sends some data (var1, var2) to a php server and the server answers with a string that is a path.
    I implemented this with the following code:

    Code:
    on(release){
    	var envelope:LoadVars = new LoadVars();
    	var envelope_rcv:LoadVars = new LoadVars();
    	envelope.val1 = '41.5';
    	envelope.val2 = '12.3';
    	envelope.sendAndLoad("http://www.mywebsite.com/try.php",envelope_rcv,"GET");
    	_root.text1 = envelope_rcv.path;
    }
    _root.text1 is undefined after I press the button.
    Is there any error according to you?
    How would you deliver that issue?
    Thank you

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2006
    Location
    Mumbai, India
    Posts
    48

    Re: LoadVars - communication with a server

    Hi,

    The written code does not give sufficient time for sending the data across the network and receiving the result.

    Code:
    envelope.sendAndLoad("http://www.mywebsite.com/try.php",envelope_rcv,"GET");
    _root.text1 = envelope_rcv.path;
    You can rewrite this piece of code using the "onLoad" event handler. This handler is invoked after the implementation of sendAndLoad. Moreover, it is not necessary to have 2 LoadVars instances.

    Code:
    url = "http://www.mywebsite.com/try.php";
    var envelope:LoadVars = new LoadVars();
    envelope.val1 = '41.5';
    envelope.val2 = '12.3';
    envelope.sendAndLoad(url,envelope,"POST");
    
    envelope.onLoad = function(success){
        //assuming path is the result returned from php
       _root.text1 = this.path;
    }
    Mariam Dholkawala
    http://www.igamestudio.com

    Blog - http://www.mariamdholkawala.com/mobile
    MaD UG - http://www.indimadgroup.com

Similar Threads

  1. Replies: 23
    Last Post: 2009-05-11, 16:47
  2. Nokia Presence Server
    By laurapacini in forum Smart Messaging
    Replies: 0
    Last Post: 2003-05-26, 16:47
  3. Nokia Presence Server
    By laurapacini in forum General Messaging
    Replies: 0
    Last Post: 2003-05-26, 16:46
  4. Nokia Presence Server
    By laurapacini in forum General Messaging
    Replies: 1
    Last Post: 2003-05-26, 13:42

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×