Unexpected token: { while try to deploy on android device

edited August 2014 in JavaScript Mode

I am new with processing. I found this Simultaneous Localisation and Mapping (SLAM) using processing from http://blogofrog.com/2011/02/21/slam-html5/. there is two .pde files, here the code: http://blogofrog.com/files/js/ekfslam.pde and http://blogofrog.com/files/js/matrix.pde i try to run that using cordova phonegap with processing.js library on android just work fine. but when i try to run it using processing IDE wont run because of unexpected token: { on line 46. whats happen here? do i miss something?..

thanks in advanced.

Answers

  • Things like 'rgba(0, 48, 160, 1)' aren't Java compatible.
    And class Matrix was declared static. Therefore it can't directly access Processing's canvas-related members!

  • @gotoloop, so how to fix that? i'm moved matrix class on the same file and remove static but doesn't make diference. for color syntax it cleared using this "rgba(0, 48, 160, 1)"

  • edited August 2014

    Usually, a program is developed in "Java Mode" 1st, and only then converted to "JavaScript Mode"!

    Seems like this 1 used "JavaScript Mode" only, disobeying various Java syntaxes.
    Turning into a hybrid Java/JS chimera! Being neither Java nor JS!

    For example, in Java all variables need to have their type declared.
    However, I've just spotted a variable declared as just a general var:
    var grad = externals.context.createRadialGradient(300, 166, 0, 300, 166, 550);

    That's not valid in Java! [..] Either stick w/ "JavaScript Mode" or do a witch syntax hunt! :P

Sign In or Register to comment.