3

I'm trying to add a button to an app that uses Crafty, but, unlike the other buttons, I want this one to redirect the user to a different URL.

Notice that no-one ever taught me how to use Coffee or JavaScript, so I'm really new.

I'm trying to use the redirection here:

cfg.onClickTeacher = -> 
      preloadScene(CFG.ASSETS_MAIN, -> "www.my-site/teacher")

But it's not working, so, what do I have to do?

Ry-
  • 218,210
  • 55
  • 464
  • 476
Sascuash
  • 3,661
  • 10
  • 46
  • 65

1 Answers1

6

That doesn’t involve Crafty, and is the same as in JavaScript.

cfg.onClickTeacher = ->
    window.location.href = 'http://example.com/'

(Relative URLs work too.)

Ry-
  • 218,210
  • 55
  • 464
  • 476