Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
好的,这个解决方案似乎找不到。
我在舞台上有一个边框类型的图像(圆形),我在我的文档类中从 xml 动态加载图像。我在边框内有一个占位符图像。我可以用动态加载的图像替换该图像吗?
还是我必须添加Child,然后通过代码对其进行缩放和转换?
我只需删除占位符图像并将新图像添加到同一个容器中并缩放/定位它。用代码做起来很简单。
container.removeChild(placeHolderImage); container.addChild(newLoadedImage); newLoadedImage.scaleX = newLoadedImage.scaleY = 1.5; newLoadedImage.x = 100; newLoadedImage.y = 100;
您可能已经在屏幕上绘制图像的位图数据,但我看不出仅删除旧图像并添加新图像有任何缺点。