【发布时间】:2016-05-24 04:43:51
【问题描述】:
我正在尝试将外观用于 createjs https://github.com/scalawarrior/scalajs-createjs 在 createjs 中,显示对象有一个“克隆”方法,用于快速复制精灵和位图。但是当我尝试从 scalajs 调用此方法时出现编译器错误,它说
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]
^
我知道 Object.clone 在 java 中受到保护,但这是在原生 javascript 对象上。
那么 - 如何访问原生 js 对象上的 clone 方法?
【问题讨论】:
标签: scala.js