Skip navigation
paprmakr213
Currently Being Moderated

Basic help with Flash v10 (creating a simple calculator)

May 18, 2010 10:11 PM

I have Adobe CS4 Pro with Flash v10.  I'm trying to create a simple, basic calculator that adds 2 numbers.  I followed the tutorial at http://layersmagazine.com/flash-design-calculator.html.  At first, I was unable to assign variables to any objects, but got that cleared up by selecting ActionScript 2.0 (was set to 3.0).  At this point, the calculator accepts the two numbers, but when I select the "add" button with the associated code as shown in the tutorial, nothing happens.  Does anyone have a suggestion as to what I might be doing wrong?  Thanks.

 
Replies
  • kglad
    72,166 posts
    Jul 21, 2002
    Currently Being Moderated
    May 18, 2010 11:05 PM   in reply to paprmakr213

    use the trace() function to debug your code.

     

    you can start by checking if your listeners are called when your button is clicked.

     
    |
    Mark as:
  • kglad
    72,166 posts
    Jul 21, 2002
    Currently Being Moderated
    May 19, 2010 1:26 PM   in reply to paprmakr213

    copy and paste a short snippet of your code that's causing an error.

     
    |
    Mark as:
  • kglad
    72,166 posts
    Jul 21, 2002
    Currently Being Moderated
    May 19, 2010 2:39 PM   in reply to paprmakr213

    remove all those textfield variables from the properties panel.  if you also did the same thing for the total textfield and it has instance name total, use:

     

    on(release){

    total.text =Number(firstnumber.text)+Number(secondnumber.text);

    }

     
    |
    Mark as:
  • kglad
    72,166 posts
    Jul 21, 2002
    Currently Being Moderated
    May 19, 2010 5:17 PM   in reply to paprmakr213

    you're welcome.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 29, 2013 8:49 AM   in reply to kglad

    This works fine for text.  I am having the same difficulty creating a dynamic score box.

     

    For example,

    onClipEvent (enterFrame)  {

     

            if(this.hitTest(MC2)) {

                score++;

     

    }

     

         

    }

     

    Message was edited by: RSchenck302@Hotmail.com

     
    |
    Mark as:
  • kglad
    72,166 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 29, 2013 9:30 AM   in reply to RSchenck302@Hotmail.com

    start a new thread on the as1/as2 forum:  http://forums.adobe.com/thread/1141486?tstart=0

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points