Need Some Help with Some code :/

Discussion in 'Off-Topic Lounge' started by iphoneprogrammer, Jul 8, 2010.

  1. iphoneprogrammer

    iphoneprogrammer Well-Known Member

    Mar 26, 2009
    2,280
    18
    38
    Financial Analyst for Baines and Ernst
    London, UK
    Below is some code I am writing to make a simple tech demo of what Flash CS5 can make for the iphone. Its a simple little accelerometer based app, that uses the accelerometer to move a green ball around the screen. I've been up for 29 hours straight (not working on this, but other things) and now I am getting errors. I need someone with experience to help me out here, and tell me what needs a fixin'.

    These are the errors I get:

    Scene 1, Layer 'action', Frame 1, Line 7 1086: Syntax error: expecting semicolon before colon.

    Scene 1, Layer 'action', Frame 1, Line 7 1086: Syntax error: expecting semicolon before colon.

    Scene 1, Layer 'action', Frame 1, Line 7 1086: Syntax error: expecting semicolon before colon.


    The numbers in front are line numbers f.y.i.


    1. import flash.sensors.Accelerometer;
    2. import flash.events.AccelerometerEvent;
    3.
    4. var acc:Accelerometer = new Accelerometer();
    5. acc.addEventListener(AccelerometerEvent.UPDATE, update);
    6.
    7. var tx:int = 0:
    8. var ty:int = 0:
    9.
    10. function update(e:AccelerometerEvent):void
    11. {
    12. tx = e.accelerationX * 100;
    13. ty = e.accelerationY * 100;
    14. }
    15.
    16. this.addEventListener(Event.ENTER_FRAME, loop);
    17.
    18. function loop (e.Event):void
    19. {
    20. ball.x += ((ball.x + tx) - ball.x) * 0.3;
    21. ball.y += ((ball.y - ty) - ball.y) * 0.3;
    22.
    23. }


    I figure it's a easy mistake to fix, but frankly I am too tired to understand what is going on, any help is greatly appreciated.
     
  2. Brazilian Rider

    Brazilian Rider Well-Known Member

    Mar 6, 2009
    3,276
    1
    0
    #2 Brazilian Rider, Jul 8, 2010
    Last edited: Jul 8, 2010
    [​IMG]

    It appears you are missing a "semicolon" ( ; ) before a "colon" ( : ).
     
  3. iphoneprogrammer

    iphoneprogrammer Well-Known Member

    Mar 26, 2009
    2,280
    18
    38
    Financial Analyst for Baines and Ernst
    London, UK
    fixed the two colons to semicolons but im still getting the second error, in line 18...GAHHHH!!!
     
  4. RttaM

    RttaM Well-Known Member

    Jan 12, 2010
    3,559
    8
    0
    I would help but your horrible at explaining the problem. Be more specific.
     
  5. Mondae

    Mondae Well-Known Member

    Feb 26, 2010
    1,807
    2
    0
    Perv, why do you care?
    Try rewriting it so it works. :D
     
  6. iphoneprogrammer

    iphoneprogrammer Well-Known Member

    Mar 26, 2009
    2,280
    18
    38
    Financial Analyst for Baines and Ernst
    London, UK
    #6 iphoneprogrammer, Jul 9, 2010
    Last edited: Jul 9, 2010
    no shit....


    @Rttam Read the second error code I recieved, thats the problem I am having. I do not understand wtf it's saying to alter. I followed a quick video explaining and showing some of the code, and my code matches the person in the video's code exactly....i just cannot seem to fix the error, without creating more syntax errors.

    And I did not explain the problem horribly, it was as clear as night and day. Here it is a again in case you missed it.

    I am getting these error codes each error code pertains to a specific line. The line in question at this point is line 18. It says this:

    "Scene 1, Layer 'action', Frame 1, Line 18 1084: Syntax error: expecting rightparen before dot."

    If you look in line 18 everything is just fine, the syntax of the code is the way it is supposed to be....I still cannot figure out the problem.
     
  7. Mondae

    Mondae Well-Known Member

    Feb 26, 2010
    1,807
    2
    0
    Perv, why do you care?
    That's good to hear my advice helped.
     
  8. iphoneprogrammer

    iphoneprogrammer Well-Known Member

    Mar 26, 2009
    2,280
    18
    38
    Financial Analyst for Baines and Ernst
    London, UK
    hahaha made my day, thank you!

    have any remarks for this picture?

    [​IMG]
     
  9. Mondae

    Mondae Well-Known Member

    Feb 26, 2010
    1,807
    2
    0
    Perv, why do you care?
    I don't know. What do I look like Josh Sardisky?
     
  10. RttaM

    RttaM Well-Known Member

    Jan 12, 2010
    3,559
    8
    0
    Firefox sucks ass. SAFARI FTW.
     
  11. MidianGTX

    MidianGTX Well-Known Member

    Jun 16, 2009
    3,738
    10
    38
    First good joke you've made all day.
     
  12. Random_Guy

    Random_Guy Well-Known Member

    Apr 6, 2009
    8,419
    0
    0
    Australia, mate!
    I'm too good looking to know these stuff.
     
  13. Kamazar

    Kamazar Well-Known Member

    Dec 13, 2008
    6,509
    18
    0
    Exactly, Midian. Everyone knows Chrome trumps both.
     
  14. RttaM

    RttaM Well-Known Member

    Jan 12, 2010
    3,559
    8
    0
    Chrome is ok, if your an Google Fanboy. :rolleyes: - Otherwise it's nothing special.
     
  15. Kamazar

    Kamazar Well-Known Member

    Dec 13, 2008
    6,509
    18
    0
    Yeah, a Google fanboy cuz I use their browser. What do you use when you're searching for the location of your nearest Chipotle, Yahoo! maps?
     
  16. SJP99

    SJP99 Well-Known Member

    Mar 16, 2010
    1,265
    17
    0
    Ipod Touch game player person like thing????
    11th dimension
    chrome pwns all!!!!!!
     
  17. MidianGTX

    MidianGTX Well-Known Member

    Jun 16, 2009
    3,738
    10
    38
    Firefox runs Google Maps like a beauty :)
     
  18. SJP99

    SJP99 Well-Known Member

    Mar 16, 2010
    1,265
    17
    0
    Ipod Touch game player person like thing????
    11th dimension
    firefox is too dang slow
     
  19. Kamazar

    Kamazar Well-Known Member

    Dec 13, 2008
    6,509
    18
    0
    Not the point I'm trying to make you damn Brit!

    Edit: :)
     
  20. Mondae

    Mondae Well-Known Member

    Feb 26, 2010
    1,807
    2
    0
    Perv, why do you care?
    Chrome is easiest to use.
     

Share This Page