A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: loading variables from ASP file

  1. #1
    Senior Member
    Join Date
    Dec 2001
    Posts
    151

    loading variables from ASP file

    hi all

    I am having some problem loading the variables from the ASP file in my flash movie. the problem is with the recordcount variable, i am getting the recordcount into a variable, but its returning a character value, means i cannot compare it with a number, cannot add or subtract a number from it, i need to do that to change the records.

    i am loading the variables with this line.
    loadVariablesNum("read.asp", "", "POST");

    i get a "trec" value from the ASP page, when i display that value in the textbox in the flash movie, its given correct value, but i cant perform mathematical operation on it.

    i have given a condition
    if (recno < trec){
    statements....
    }

    this condition is working properly, i have checked the variables with isNaN function, and it returns me true for trec and false for recno, which means trec is string and recno is interger.

    how can i convert it to number and perform the operation.

    plz help regarding this problem as this is urgent.
    The One Who Would Never Die

  2. #2
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    It is likely that the value is being interpreted as text, in which case you could type cast it to a number,

    if (Number(recno) < Number(trec)){
    statements....
    }

  3. #3
    Senior Member
    Join Date
    Dec 2001
    Posts
    151
    thanks for the post, but it didnt work, its really confusing why its not working.
    i also tried subtracting the variable by an interger and then displaying it in a text box, but the result in the text box was "NaN".
    what i did was
    aa=number(trec)-7
    but aa got the value as "NaN" in the text box, this is confusing me.

    i havent done much in flash actionscript, is anything wrong with the script. i can mail the script if you wish to have a look at it.

    by the way thanks in advance.
    The One Who Would Never Die

  4. #4
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Hi,

    The only other thing I could think would cause that is if there is some extra whitespace (spaces, newlines etc) in the trec variable. this would prevent flash being able to type cast it to a number.

    to make sure there is no whitespace in the variable make sure when you write it using ASP you have an & symbol immediatly after the variable value. so the output would look like,

    &trec=7&

  5. #5
    Senior Member
    Join Date
    Dec 2001
    Posts
    151
    hi and thanks for the help,
    i was really confused what was happening, i tried changing the variable name, then removed the variable and then again inserted it with different name, nothing was working, then i just inserted that variable at the start of the response.write statement in the ASP page which also passess other variables, and it just worked, wonder why?

    but thanks for the help.
    The One Who Would Never Die

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center