Forum Discussion

KevinJardine's avatar
KevinJardine
Start Partner
22 days ago
Solved

Change image in Noesis?

I've finally been making progress with NoesisGUI - I can load text from the dataContext object in TypeScript and handle button clicks.

But has anyone been able to load an image in response to a button click? The image Source tag does not seem to accept a string value.

  • You have to make an Image Source binding in Noesis and set it to an Image Source in typescript. Something like this:

        private dataContext = {
            Image: ImageSource.fromTextureAsset(new TextureAsset(BigInt("AssetID"))),
        };
    
        start() {
            this.entity.as(NoesisGizmo).dataContext = this.dataContext;
            this.dataContext.Image = ImageSource.fromTextureAsset(new TextureAsset(BigInt("AssetID")));
        }

     

9 Replies

  • You have to make an Image Source binding in Noesis and set it to an Image Source in typescript. Something like this:

        private dataContext = {
            Image: ImageSource.fromTextureAsset(new TextureAsset(BigInt("AssetID"))),
        };
    
        start() {
            this.entity.as(NoesisGizmo).dataContext = this.dataContext;
            this.dataContext.Image = ImageSource.fromTextureAsset(new TextureAsset(BigInt("AssetID")));
        }

     

  • Fantastic. Yes that works for me. And it is a better solution than I was expecting as I can load any of my existing asset textures without needing to have them in the noesis zip.

     

    • gausroth's avatar
      gausroth
      Mentor

      During my testing of the feature there seems to be a bug with the image source bindings only appearing for the asset owner. Hopefully this gets fixed. If you encounter this issue please report a bug report.

      • KevinJardine's avatar
        KevinJardine
        Start Partner

        Unfortunately, I can confirm this bug. I can see the image, but no one else can. I have reported it via the desktop editor issue system. I guess for now I am going to have to work on my world without images, which is a major limitation.😞

  • Thanks for your YouTube videos as well. They made all the difference in connecting the dots to see how to set things up in NoesisGUI Studio, hook it up in Horizon Worlds and then populate the content in TypeScript.

  • There are other ways to swap images in Noesis. I have not tried it yet, but you can use data triggers.