【问题标题】:Starling scaffold project showing blank texture显示空白纹理的 Starling 脚手架项目
【发布时间】:2013-05-30 09:25:54
【问题描述】:

我正在使用 Starling 构建应用程序并导入了脚手架项目,但是每当我调用 getTextureAtlas() 时,它都不会显示图像

this.mLogo = new Image(Assets.getAtlasTexture("powered_by_starling"));
this.mLogo.x = 0;
this.mLogo.y = 0;
this.addChild(this.mLogo);

没有错误,所以我猜它可以找到纹理。如果我将名称更改为不存在的名称,则会引发错误“纹理不能为空”。我也在用

Assets.contentScaleFactor = Starling.current.contentScaleFactor;

一切几乎都是脚手架的标准导入,但我使用的是 Feathers UI 屏幕导航器,但我在其他项目中没有出现空白图像问题。

编辑:我似乎无法让精灵在扩展了 feathers.controls.Screen 的类中工作

【问题讨论】:

    标签: actionscript-3 starling-framework


    【解决方案1】:

    getAtlasTexture 是您编写的函数吗?您在使用八哥资产管理器吗?如果是这种情况,您将需要该类的实例,而不是静态方法调用。

    无论如何,尝试使用 Texture 类和它提供的静态方法。图像不需要图集(精灵表) - 但是 MovieClip 需要它。

    Texture.fromBitmap
    Texture.fromBitmapData
    

    ....和其他人,检查文档

    如果你的图形是嵌入的,那​​么使用这个:

    var _img:Image = new Image(Texture.fromBitmap(new Assets.EmbeddedGraphic()));
    

    【讨论】:

    • 没有 getAtlasTexture 是 Starling 脚手架示例项目的一部分,但是当类扩展 Starling Sprite 而不是 Feathers Screen Navigator 时,使用该函数有效。
    • @Kere Puki 啊,所以你正在扩展屏幕导航器,好的,抱歉。没有使用,但快速查看类本身告诉您需要使用 this.addScreen("theImage", new Image(Assets.getAtlasTexture("powered_by_starling")));添加要显示的屏幕,然后 this.showScreen("theImage");展示它。希望对你有帮助
    【解决方案2】:

    你在使用 atf 吗?因为同样的事情发生在我身上,直到我使用 png 然后它起作用了

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-15
      • 2015-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多