A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: time for 3.52

  1. #1
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    time for 3.52?

    Well major problem with javascript. Cannot get variable except as string from an edit box.

    lets say you have edit_1 with varible a and input 1
    and then in javascript you

    a=a+1

    well instead of 2 you get 11 as if working with a string. So far I cannot find a way around this.

    This has been reported to support.

    Want to see what I'm working on?
    http://deadyeti.com/blanius/breakout.html

    Project now on hold until javascript oddities are address either with work arounds or new version. Seems like I do that alot.

    [Edited by blanius on 02-23-2002 at 10:37 PM]

  2. #2
    Senior Member
    Join Date
    Sep 2001
    Posts
    161

    resolved Option

    Hi! Bret Lanius

    tries this To create an editBox and assign to Variable -> a and its initial value to 1, it creates a Javascript i.e.

    f=abs(a);
    a=f;
    a=a+1;

    the real value of the variable will update in edit box which must be 2 and not 11.

    Joseph

  3. #3
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    Re: Option

    Originally posted by MrJoseph
    Hi! Bret Lanius

    tries this To create an editBox and assign to Variable -> a and its initial value to 1, it creates a Javascript i.e.

    f=abs(a);
    a=f;
    a=a+1;

    the real value of the variable will update in edit box which must be 2 and not 11.

    Joseph
    Hi Joseph, tried that, didn't work. However this did

    Score=INT(Score)+1


  4. #4
    Senior Member
    Join Date
    Sep 2001
    Posts
    161

    Interchange Ideas

    Hi! Bret

    Score=int(Score)+1 takes the value from a variable and it approximates it to the following unit.


    i.e. Score=1.3 and Score=Int(Score)+1 equal to 2, and not equal to 2.3, works well for integer numbers but it does not for decimals.

    The use of abs(var) works to me well, for decimal and integer numbers; here it is a small example.

    http://www.josephbrowndesigns.com/3dflash/movie_11.html

    Reviews if you wish to interchange concepts.

    Joseph

  5. #5
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    Re: Interchange Ideas

    Originally posted by MrJoseph
    Hi! Bret

    Score=int(Score)+1 takes the value from a variable and it approximates it to the following unit.


    i.e. Score=1.3 and Score=Int(Score)+1 equal to 2, and not equal to 2.3, works well for integer numbers but it does not for decimals.

    The use of abs(var) works to me well, for decimal and integer numbers; here it is a small example.

    http://www.josephbrowndesigns.com/3dflash/movie_11.html

    Reviews if you wish to interchange concepts.

    Joseph
    Yes I realize it works only with integers, this is fine for my use. Keep in mind that abs has the limitation of no negative numbers.

  6. #6
    Senior Member kusco's Avatar
    Join Date
    Nov 2001
    Posts
    681
    Hi Blanius,

    I'm hoping that this is not too late for an answer.

    You're quite correct about the abs() function not being able to work with negative numbers. Your INT() idea will prevent the use of decimal numbers.

    How about using something like this...

    a = (a * 1) + 1;

    This takes the contents of 'a' and uses it in an equation which simply converts the result to a number. Multiplying it by 1 leaves the result as you would expect and then you can do whatever you please.

    The advantage here is that you can have the best of both worlds. ie. negative and decimal numbers.

    HTH,
    Kusco

  7. #7
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    try it

    Originally posted by kusco
    Hi Blanius,

    I'm hoping that this is not too late for an answer.

    You're quite correct about the abs() function not being able to work with negative numbers. Your INT() idea will prevent the use of decimal numbers.

    How about using something like this...

    a = (a * 1) + 1;

    This takes the contents of 'a' and uses it in an equation which simply converts the result to a number. Multiplying it by 1 leaves the result as you would expect and then you can do whatever you please.

    The advantage here is that you can have the best of both worlds. ie. negative and decimal numbers.

    HTH,
    Kusco
    Might have to try that.

    Ideally Insane will fix this in the next release anyway. And for my current purpose the INT idea will suffice. That same little project has many other javascript issuse that will need to be resolved as well anyway.

    My hidden objects are still triggering collision events.

    You can see this at the example listed above

  8. #8
    Senior Member
    Join Date
    Jan 2002
    Posts
    118

    Hmmm.... Hidden Or Removed

    Do you actually hide the objects, or remove them? I might suggest trying the other one that you aren't (unless you already have). You could also try 'moving' it offscreen. Just a few suggestions.

  9. #9
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    Re: Hmmm.... Hidden Or Removed

    Originally posted by ajcompany
    Do you actually hide the objects, or remove them? I might suggest trying the other one that you aren't (unless you already have). You could also try 'moving' it offscreen. Just a few suggestions.

    hidden only, If this were a paid project or had some sort of deadline I might try to work around the problems but it was mostly a test of what I could do with javascript, I attempted an invaders type game a while back but soon realize that creating and tracking that many seperate animations was too hard and too slow, javascript was the answer using cloned objects and loops to track them.

    Kusco privately has fixed a couple of bugs in my code already and I will update the files at the example soon, but I can't spend too much time with it right now.

    Thank you for the suggestion and everyone should feel free to dl the code and play with it. That's why it's there.

    You can learn from my ideas and mistakes.


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