Link to image from pointer down

Hi is it easy and possibly to link to an image or have an image appear on the screen from a pointer down event?

Can’t quite work it out.

Thanks

1 Like

Like when you click on the button the image appears? If is this is quite simple.

att, Higão.

Yeah a button that opens an image, in a cool way hopefully, in the scene

1 Like

Hi
So how do I do this?

Thanks

1 Like

Hello @technology,

Sorry by the late, it was “holyday” on my country xD.

Well, to do what you want is very simple actually:

1 - Create a controller with two states (you also can do this with a timeline but lets first pratice just the states):

2 - Set your image animations whatever you want, in my case I’ll do just a scale to it, like this:

image

3 - The green button opens it and the red one closes it;

4 - On the code, drag n’ drop your planes in the script creating two buttons. In your buttons code, drag your states to their related buttons (state “on” on open button, state “off” on close button) like this:

image

In this way when you click on green the img scale appearing and in the red one the img scale hidding itself.

I think this is all,

att, Higão.

1 Like

Great will have a look at this later on

1 Like

Ok done this all but something is up with this -

image

1 Like

No, no, again your doin’ wrong with the code blocks. Look:

symbol.nodes.Button_Open.on("pointerup", (e)=>{
symbol.controllers.Button_Controller.elements.On.on("active", ()=>{
//
//

})

Notice that you didn’t close your “active” event block. The right way of this is:

symbol.nodes.Button_Open.on("pointerup", (e)=>{
   symbol.controllers.Button_Controller.elements.On.on("active", ()=>{

   })
})

Also, I can tip u that when you have an event (active, complete, noactive, playing, or whatever other event can be) it don’t have to be into a button or trigger, you can just let it outside like this:

symbol.nodes.Button_Open.on("pointerup", (e)=>{

})

symbol.controllers.Button_Controller.elements.On.on("active", ()=>{

})

Now finally gettin’ into ur problem, what happend:

You are using an event for your controller. You don’t have to call an event, you have to call the function. So the right way of a state calling is:

symbol.controllers.Button_Controller.elements.Off.active();

Take a look into this article, this might help you:

att, Higão.

1 Like

Oh I’m sorry - I actually worked it out before you replied. I feel terrible

1 Like

Hi @technology,

Please take a look at a new thread I have posted. It should help to clear things up. :slight_smile:

1 Like