A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: .exe problems, integer number variable?

  1. #1
    Senior Member SirN's Avatar
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    142

    .exe problems, integer number variable?

    Hi,

    I heard about the problem with variables handled as text instead of integer in other post, and maybe that's the case here, but my flash movie works fine and it's the exported .exe that mishandles the variable:

    page number is variable x (page=1 in starting script)

    an movie 640x480 displays an menu, an editbox displays the pagenumber (attach to variable = x) an next page button ( x = x + 1; ) and prev page (x = x - 1; ) button changes the x value and if pagenumber is changed to 2 then the page1 menu is hidden and the page2 menu is shown ( if (x == 2)
    {
    element ("OpeningMeny").hide();
    element ("OpeningMeny2").show();
    }
    )

    Now, it works fine in flash on the webpage, but exported as .exe when I press next page button the number 1 changes into 11 and if I press prev page it goes to 10 9 8 a.s.o. and when I reach pagenumber 2 it does not hide and show like it should...

    It seems like it doesn't treat the variable x as a number initiated with 1 and the addition and subtraction to it - is not working! I will try to use the solution mentioned in other post about making sure an variable is treated as a number... Hope that fixes it!
    Last edited by SirN; 01-12-2007 at 02:01 PM.

  2. #2
    Senior Member SirN's Avatar
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    142
    I changed to ( x = toNumber(x) + 1; ) and got it to start with 1 and go to 2 when I press next page but the hide and show elements does not work...

    On the nextpage button I have script:


    x = toNumber(x) + 1;

    if (x == 2)
    {
    element ("OpeningMeny").hide();
    element ("OpeningMeny2").show();
    }

    and it doesnt work, but in that if statement I must deal with x as an textvariable and I don't think this is correct, maybe if (x = "2") or if (x == "2") is correct.... I will try...

  3. #3
    Senior Member
    Join Date
    Dec 2006
    Posts
    274
    It might be that using same name variables as movies use is not wise.. (x, y, alpha, etc..)
    I tried to declare variable x=1 in starting script and then used you script with a button and found root.x (which should be same variable that I declared in the starting script) was 250
    After renaming x to my_x all went fine and your hide/show code worked ok even when exported as .exe

    instead "my_x = toNumber(my_x) + 1; "
    you could use:
    root.my_x++;
    or
    root.my_x+=1;
    at least then there should be no string to number conversions.. but usually my_x = my_x + 1; should be fine as long my_x is filled with number before first use (my_x = 1; ) and use root. syntax if you use main movie variables outside main movie.
    Last edited by Finjogi; 01-13-2007 at 12:03 PM.

  4. #4
    Senior Member SirN's Avatar
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    142
    Neither of your suggestions work, but it probably is due to the fact that on page1 a menu is displayed and when I press a selection of the menu on page1 then my_x = 1 is coded and the menu button never releases (I have press down colour for the menu and it never dissappears)... Your solutions are probably correct and maybe the problem comes because I have an 4.6 movie that I work in in 4.8.2 ... Soo, I believe I can perhaps get menus to release after beeing pressed, but I don't know!

  5. #5
    Senior Member
    Join Date
    Dec 2006
    Posts
    274
    Could you post a stripped down example for closer look?

  6. #6
    Senior Member SirN's Avatar
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    142
    Yep, done, I attach a .zip, it works great, soo the problems must be related the fact that I used an 4.6 movie in 4.8.2 and went about... This is totally done in 4.8.2 from scratch and it works.

    It might be redundant to continue this thread but anyway here's the .zip!

    You're supposed to click on choice1 and then on page -> button and it works great exported as .exe ...

    Very well, thanks for the support!
    Last edited by SirN; 08-15-2007 at 04:50 PM.

  7. #7
    Senior Member
    Join Date
    Dec 2006
    Posts
    274
    One question, how you did get those weird color icons/buttons (purple & orange) in your movie properties??? (Play in standalone window, run the executable)
    see attached jpg..

    edit: never mind, I got it, settting export type as executable
    Attached Images Attached Images
    Last edited by Finjogi; 01-14-2007 at 11:30 AM.

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