A Flash Developer Resource Site

Results 1 to 16 of 16

Thread: Need help with little form... please

  1. #1
    I'm learning... Thankful's Avatar
    Join Date
    Jun 2005
    Location
    e.v.e.r.y.w.h.e.r.e
    Posts
    487

    Need help with little form... please (SOLVED)

    Hello my forum friends !

    I am attaching this screenshot because I am not sure if I can explain it properly... I need to create a simple form with 3 INPUT text fields (only numbers will go inside, not letters nor any other symbols... web site visitors needs to enter these values) and 6 DYNAMIC text fields that needs to update when CALCULATE button is pressed.

    Formulas for each field are inside this screenshot.

    Since I am not good with ActionScript, I would greatly appreciate if someone can help me with this. Please, do not waste your precious time if you don't have any free time, but only if you really have nothing else to do right now.

    I don't think this should be too difficult for someone who is already AS savy, but for me doing it in Flash, it's like rocket science... I was always more of a graphic designer, lol...

    Thanks in advance to everyone who can help !
    Best Regards

    Screenshot:

    Last edited by Thankful; 11-07-2006 at 05:00 PM.
    :: ONLINE PORTFOLIO :: web site (Flash version 7 required, recommended screen resolution: at least 1024x768 pixels)

    :: SASHA-Z-CREATIONS :: web site

  2. #2

  3. #3
    I'm learning... Thankful's Avatar
    Join Date
    Jun 2005
    Location
    e.v.e.r.y.w.h.e.r.e
    Posts
    487
    This is amazing my friend ! Simply amazing !!! I can't believe you guys, there is no better place to ask for help than this FlashKit. This community rules !!!

    I didn't even expect to get an answer this quick and there it is... amazing!

    Also, besides you my friend (wattsup), I want to thank to my friend Launchpad67 for his effort and quick response ! Thanks guys I really appreciate all your help!

    Oh my God, still can't believe this is solved...

    Best Regards,
    Sasha
    :: ONLINE PORTFOLIO :: web site (Flash version 7 required, recommended screen resolution: at least 1024x768 pixels)

    :: SASHA-Z-CREATIONS :: web site

  4. #4
    I'm learning... Thankful's Avatar
    Join Date
    Jun 2005
    Location
    e.v.e.r.y.w.h.e.r.e
    Posts
    487
    Quote Originally Posted by wattsup
    I hope this will help you.
    Just one more little question if I may... hope I'm not bugging you...

    Where do I go if I want to change that NaN part. I can't find it anywhere inside the code...

    Cheers and thanks again !
    :: ONLINE PORTFOLIO :: web site (Flash version 7 required, recommended screen resolution: at least 1024x768 pixels)

    :: SASHA-Z-CREATIONS :: web site

  5. #5
    Senior Member
    Join Date
    Oct 2004
    Posts
    2,049
    are you talking about if there is nothing entered in the imput boxes?

  6. #6
    I'm learning... Thankful's Avatar
    Join Date
    Jun 2005
    Location
    e.v.e.r.y.w.h.e.r.e
    Posts
    487
    Quote Originally Posted by wattsup
    are you talking about if there is nothing entered in the imput boxes?
    Yes, yes... sorry for not explaining it better...
    :: ONLINE PORTFOLIO :: web site (Flash version 7 required, recommended screen resolution: at least 1024x768 pixels)

    :: SASHA-Z-CREATIONS :: web site

  7. #7
    Senior Member
    Join Date
    Oct 2004
    Posts
    2,049
    Hold on bro - and I will fix that.

    you can just add this code in

    Code:
    btn.onPress = function(){
    	if(A.text == ""){
    		// you can put a message here
    	}else if(B.text == ""){
    		// you can put a message here
    	}else if(F.text == ""){
    		// you can put a message here
    	}else{
    		C.text = A.text * B.text;
    		D.text = C.text * 50;
    		E.text = A.text * .20;
    		G.text = E.text * F.text;
    		H.text = G.text * 50;
    		I.text = H.text * D.text;
    	}
    }

  8. #8
    I'm learning... Thankful's Avatar
    Join Date
    Jun 2005
    Location
    e.v.e.r.y.w.h.e.r.e
    Posts
    487
    Is this a proper way to add some text ?

    Code:
    btn.onPress = function(){
    	if(A.text == ""){
    		C.text = "Field A is empty"
    		E.text = "Field A is empty"
    	}else if(B.text == ""){
    		C.text = "Field B is empty"
    	}else if(F.text == ""){
    		G.text = "Field F is empty"
    	}else{
    		C.text = A.text * B.text;
    		D.text = C.text * 50;
    		E.text = A.text * .20;
    		G.text = E.text * F.text;
    		H.text = G.text * 50;
    		I.text = H.text * D.text;
    	}
    }
    I'm having some problems when I add those lines... not sure I did it properly... It looks like it doesn't properly update those fields in some situations...
    :: ONLINE PORTFOLIO :: web site (Flash version 7 required, recommended screen resolution: at least 1024x768 pixels)

    :: SASHA-Z-CREATIONS :: web site

  9. #9
    Senior Member
    Join Date
    Oct 2004
    Posts
    2,049
    Yes its the proper way (put ; afterwards) - but the I put all the fields to receive just numbers. Just embed the letters if you want text to show up.

  10. #10
    I'm learning... Thankful's Avatar
    Join Date
    Jun 2005
    Location
    e.v.e.r.y.w.h.e.r.e
    Posts
    487
    Quote Originally Posted by wattsup
    Yes its the proper way (put ; afterwards) - but the I put all the fields to receive just numbers. Just embed the letters if you want text to show up.
    Yes I did it. All dynamic text fields have embedded both letters and numbers, but Input fields have to have just numbers... also, just added those ";" symbols at the end.

    Still when I start this SWF this is one situation I get... Enter value 1 in field A, and value 1 in field B. Click Calculate button... nothing comes up inside the field C. Then I tried to erase field B and I get a message that Field B is empty... now, I return to field B, enter some number in and still Field C is saying that Field B is empty...
    :: ONLINE PORTFOLIO :: web site (Flash version 7 required, recommended screen resolution: at least 1024x768 pixels)

    :: SASHA-Z-CREATIONS :: web site

  11. #11
    I'm learning... Thankful's Avatar
    Join Date
    Jun 2005
    Location
    e.v.e.r.y.w.h.e.r.e
    Posts
    487
    If I can't have some text inside those dynamic fields, I mean if it's too complicated then we'll leave it like it is... Example from the first reply of yours works perfect...

    Another little thing...

    Code:
    btn.onPress = function(){
    	if(A.text == ""){
    		C.text = "Field A is empty";
    		E.text = "Field A is empty";
    	}else if(B.text == ""){
    		C.text = "Field B is empty";
    	}else if(F.text == ""){
    		G.text = "Field F is empty";
    	}else{
    		C.text = A.text * B.text;
    		D.text = C.text * 50;
    		E.text = A.text * .20;
    		G.text = E.text * F.text;
    		H.text = G.text * 50;
    		I.text = H.text * D.text;
    	}
    }
    Last line I.text = H.text * D.text;

    That is when formula is I = H * (times) D... right ?

    What if I need it to be I = H + (plus) D ? I tried replacing "*" sign with "+" and it doesn't work... how do I do that ?

    This is what I did: I.text = H.text + D.text;

    I am sure I did a stupid thing, right ?
    :: ONLINE PORTFOLIO :: web site (Flash version 7 required, recommended screen resolution: at least 1024x768 pixels)

    :: SASHA-Z-CREATIONS :: web site

  12. #12
    Senior Member
    Join Date
    Oct 2004
    Posts
    2,049
    btn.onPress = function(){
    if(A.text == ""){
    A.text = "Blank";
    }else if(B.text == ""){
    B.text = "Blank";
    }else if(F.text == ""){
    F.text = "Blank";
    }else{
    if(A.value != "Blank" and B.text != "Blank" and F.text != "Blank"){
    C.text = A.text * B.text;
    D.text = C.text * 50;
    E.text = A.text * .20;
    G.text = E.text * F.text;
    H.text = G.text * 50;
    I.text = H.text * D.text;
    }
    }
    }

  13. #13
    I'm learning... Thankful's Avatar
    Join Date
    Jun 2005
    Location
    e.v.e.r.y.w.h.e.r.e
    Posts
    487
    I just used this model and still problems... when I enter those first two fields (A and B) and press Calculate button, still no results...

    EDIT: I found what caused those problems... this line:

    Code:
    ...
    ...
    if(A.value != "Blank" and B.text != "Blank" and F.text != "Blank"){
    ...
    ...
    It supposed to be like this:

    Code:
    ...
    ...
    if(A.text != "Blank" and B.text != "Blank" and F.text != "Blank"){
    ...
    ...
    Anyway, we can leave it at the example from your first reply. It really works perfect, I was just wondering if I could maybe change that NaN to something else, but if not, no big deal really...


    The biggest problem right now is that "+" instead of "*" inside this line:

    I.text = H.text * D.text;

    How do I proceed it if I want to add up those two ? I tried with "+" and it wouldn't work... it just puts those two values one after another... for example, Field H =3000 and Field D= 5000... all I get with this line I.text = H.text + D.text; is this:

    Inside the field I it says 50003000 (5000 and 3000, it just puts those two numbers one after another)

    But the total result should be 8000.

    How do I add up those two numbers ?
    Last edited by Thankful; 11-07-2006 at 07:49 AM.
    :: ONLINE PORTFOLIO :: web site (Flash version 7 required, recommended screen resolution: at least 1024x768 pixels)

    :: SASHA-Z-CREATIONS :: web site

  14. #14
    I'm learning... Thankful's Avatar
    Join Date
    Jun 2005
    Location
    e.v.e.r.y.w.h.e.r.e
    Posts
    487
    Can someone please assist me with this "+" and "*" issue ?

    Thanks in advance to everyone who helps!
    :: ONLINE PORTFOLIO :: web site (Flash version 7 required, recommended screen resolution: at least 1024x768 pixels)

    :: SASHA-Z-CREATIONS :: web site

  15. #15
    Senior Member
    Join Date
    Oct 2004
    Posts
    2,049
    to add the two text fields you can use the following

    I.text = Number(H.text) + Number(D.text);

  16. #16
    I'm learning... Thankful's Avatar
    Join Date
    Jun 2005
    Location
    e.v.e.r.y.w.h.e.r.e
    Posts
    487
    Thank you soooo much for your help wattsup ! You saved my day my friend ! Thanks a bunch for all your effort !

    Have a good one !
    :: ONLINE PORTFOLIO :: web site (Flash version 7 required, recommended screen resolution: at least 1024x768 pixels)

    :: SASHA-Z-CREATIONS :: web site

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