EVENT: Touch Object ACTION: Run Javascript Code BUT...

I created a text object
when i touch mouse over text object I can make text object disapper(invisible).

Now I want to run some Javascript code to change scence color via the runtimeScene.setBackgroundColor(255,165,0);

So I go to event and click on + other

insert the java script code.

Goto to preview and the screen doesnt wait for me the hover over the text with my mouse.
It automatically changes the scenes background color.

why ? I only want the back ground to change when mouse is over newObject.

help ?

You need to create an event with a condition testing the touch and put the JS event as a sub-event of it.

i did and it did not work using “+ Other”. it let me use the java script but it ran immediately, i wanted to run JS code
when my mouse cursor was on top of Text Object.

I then selected “+ sub Event” and put my JS code in there and it ran correctly(after a refreshed browser screen).

Yes, you can’t directly add another type of event as a sub-event. You need to create an empty sub-event and drag the JS event (or the other event’s type) in it.