A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: load variable problem

  1. #1
    Junior Member
    Join Date
    May 2001
    Posts
    19
    hello
    I have a film where I load some variables from a external txt:
    idade=28&fcrepouso=60

    I need to re-use it in the follow variables inside a MC

    fcpessoal = 220-idade-fcrepouso;
    b1_50 = Math.floor ((fcpessoal*50/100)+fcrepouso);
    b1_55 = Math.floor ((fcpessoal*55/100)+fcrepouso);

    but I can't set the "idade" and "fcrepouso" inside the expressions as numbers.

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Posts
    588
    I assume these values are coming up as strings if they are not coming up as numbers. In that case, you could try:

    fcpessoal = 220-Number(idade)- Number(fcrepouso);
    b1_50 = Math.floor ((fcpessoal*50/100)+ Number(fcrepouso));
    b1_55 = Math.floor ((fcpessoal*55/100)+ Number(fcrepouso));

  3. #3
    Junior Member
    Join Date
    May 2001
    Posts
    19

    I already have tried

    I already have tried it, but the variable was indefinable.
    Are there other problems that could affect it?

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Posts
    588
    Are you using the code you gave:

    fcpessoal = 220-idade-fcrepouso;
    b1_50 = Math.floor ((fcpessoal*50/100)+fcrepouso);
    b1_55 = Math.floor ((fcpessoal*55/100)+fcrepouso);

    in the same frame where you are loading your text file from? If so, the variables may not have loaded when you perform these actions. I've found that you have to give a few frames between loading the text file and using the variables from that file. Either that, or use the onClipEvent(data).

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