I wish to create new Sprite Node with picture load from distant URL, however It doesn’t work.
That is my code:
// distant load picture
assetManager.loadRemote<ImageAsset>(photo_url, (err, imageAsset) => {
const spriteFrame = SpriteFrame.createWithImage(imageAsset);
const newNode = new Node()
// add new Sprite element
newNode.addComponent(Sprite)
const sprite = newNode.getComponent(Sprite)
// assign sprite body to the brand new Sprite Node
sprite.spriteFrame = spriteFrame
// set node content material measurement
const newNodeTransform = newNode.getComponent(UITransform)
newNodeTransform.setContentSize(200, 200)
// add to different node
this.photoBorder.node.mother or father.addChild(newNode)
});
Please assist me resolve this downside
Thanks very a lot!