kytschBASIC

Put down that phone!
Please view me on real computer.

AFUNCTION
NAME, ARGUMENTS (optional)
Requires arcade library

This will allow you to create an arcade function which is a javascript function with jquery support.

Note: when a function is created the first argument is always the event parameter. So when you call the function from javascript remember to supply the event parameter as the first argument. Using the GOTO command from say ANIMATION you don't have to supply the event.

Example

INCLUDE arcade

AFUNCTION "updateText", "text='Arcade support'"

	$("#arcade-text").html(text);

END AFUNCTION

LINE BREAK

JAVASCRIPT

	updateText(event, "Arcade support enabled");

END JAVASCRIPT

LINE BREAK

SCREEN "arcade"

	PRINT "Arcade support",,"arcade-text"

END SCREEN

Output

<script type="text/javascript">function updateText(event,  text='Arcade support') {
$("#arcade-text").html(text);
}</script><br/>
<script type='text/javascript'>
$(document).ready(function() {
updateText(event, "Arcade support enabled");

});
</script><br/>
<div id="arcade">
<span id="arcade-text">Arcade support</span>
</div>

Demo



Arcade support

See also