0

I'm trying to use the facade for createjs https://github.com/scalawarrior/scalajs-createjs In createjs, display objects have a 'clone' method that is used for making quick duplicates of sprites and bitmaps. But I get a compiler error when I try to call this method from scalajs, it says

Error:(30, 42) method clone in class Object cannot be accessed in 
 com.darkoverlordofdata.entitas.Entity
 Access to protected method clone not permitted because
prefix type com.darkoverlordofdata.entitas.Entity does not conform to
class CreateAliensSystem in package systems where the access take place
                val sprite = invader.clone()//.asInstanceOf[Sprite]
                                     ^

I understand that Object.clone is protected in java, but this is on a native javascript object.

So - How can I access the clone method on a native js object?

gurghet
  • 7,591
  • 4
  • 36
  • 63
user2241515
  • 121
  • 2
  • 8

1 Answers1

0

You have to redefine it in your facade type.

override def clone(): SomeType = js.native
sjrd
  • 21,805
  • 2
  • 61
  • 91