简体   繁体   English

八哥羽毛屏幕导航器

[英]Starling Feathers Screen Navigator

I am wondering if there is a way to use this.owner.showScreen(screen_id) from within a class that doesn't inherit Screen? 我想知道是否有一种方法可以在不继承Screen的类中使用this.owner.showScreen(screen_id)?

I am building a footer class (similar to header but with custom controls) that I will include in multiple screens but the class needs to extend Starling Sprite. 我正在构建一个页脚类(类似于页眉,但具有自定义控件),该页脚类将包含在多个屏幕中,但是该类需要扩展Starling Sprite。 So basically it is an include file/class. 因此,基本上它是一个包含文件/类。

Thanks 谢谢

As the getter method this.owner returns a reference to the screen navigator by which the classes that extend Screen are navigated, it's not possible to do so. 作为getter方法,this.owner返回对屏幕导航器的引用,通过该引用来导航扩展Screen的类,因此不可能这样做。

Why not simply create a class say, Footer, that extends feathers.controls.Header and have it have its y property as stage.height - this.height so that it'll be placed at bottom ? 为什么不简单地创建一个类,例如Footer,它扩展了feathers.controls.Header并将其y属性作为stage.height-this.height以便放置在底部? Or place the header on every class at bottom 或将标题放在每个班级的底部

// in initialize method of Screen classes
_header.y = stage.height - _header.height;

感觉空白是正确的,但是您不应该在初始化时这样做(舞台大小在某些移动设备上可能尚未准备好),我也不会使用舞台高度,而应该使用组件的实际高度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM