What is wrong with this code please?


#1

const display_shown = symbol.controllers.display.elements.shown;
const display_hidden = symbol.controllers.display.elements.hidden;

parent.on(“show”, () => {

// Make sure we start from fully hidden
display_hidden.reset();

// Move to the shown state
display_shown.activate();
symbol.controllers.animController.elements.animTimeline.play(1, true);

var display_shown = symbol.controllers.display.elements.shown;
var display_hidden = symbol.controllers.display.elements.hidden;

// The VideoTexture node dragged in
var DeafyoungpeoplesharehowtheylistentomusicandTV_mp4 = symbol.nodes.Deaf_youngpeoplesharehowtheylistentomusicandTV_mp4;

parent.on(“show”, parent_show);
function parent_show() {

// Make sure we start from fully hidden
display_hidden.reset();

// Move to the shown state
display_shown.activate();

// Play the video
DeafyoungpeoplesharehowtheylistentomusicandTV_mp4.start();

}

I keep getting this error message when trying to publish -

show “)” expected

But when I put in the desired ) I end up with a red cross next to that line of code and it still won’t publish!

Argh


#2

Hello @technology,

I’ve copied your code and sat it into Zappar. I just saw that u’ve forget a “});” in the last line of your first parent.on(“show”), because of this, your code was open and the plataform was understanding everything mixed up. Here’s the correct code that actually is working:

const display_shown = symbol.controllers.display.elements.shown;
const display_hidden = symbol.controllers.display.elements.hidden;

parent.on("show", () => {

    // Make sure we start from fully hidden
    display_hidden.reset();
    
    // Move to the shown state
    display_shown.activate();

});

symbol.controllers.animController.elements.animTimeline.play(1, true);

// The VideoTexture node dragged in
var DeafyoungpeoplesharehowtheylistentomusicandTV_mp4 = symbol.nodes.Deaf_youngpeoplesharehowtheylistentomusicandTV_mp4;

parent.on("show", parent_show);
function parent_show() {

    // Make sure we start from fully hidden
    display_hidden.reset();
    
    // Move to the shown state
    display_shown.activate();
    
    // Play the video
        DeafyoungpeoplesharehowtheylistentomusicandTV_mp4.start();
}

If you have any problems with it or has any questions, just let me know. Hope you gotcha!

att, Higão.


#3

Ah that’s perfect, thanks


#4

np @technology :slight_smile: