You need to wrap your Javascript code into a JS function, within a separate .js file:
// test.js
function testing(message)
{
alert(message);
}
Import your .js file and declare a Monkey function within an Extern section, with the same parameters/return type as the Javascript function -- don't forget Public after the Extern section:
Import mojo
Import "test.js"
Extern
Function Alert (msg:String) = "testing"
Public
Class Game Extends App
Method OnCreate ()
SetUpdateRate 60
Alert "Hello!"
End
End
Function Main ()
New Game
End
Not sure how your code would work (not that hot on CSS/JS!), but presumably you could wrap that in a JS function that also applies the style.
You might want to do some #If TARGET=html5 wraparound stuff if going cross-platform.
|