Skip to main content
Known Participant
June 21, 2017
Answered

Need help understanding an HTML5 error

  • June 21, 2017
  • 1 reply
  • 2752 views

So I'm putting together a website with Animate CC and I'm using an HTML5 canvas....which I'm reasonably new at.  I'm putting together a gallery section with multiple categories, which are all contained inside a master "Gallery" movieclip.  The gallery sections each have thumbnail images, which are clicked on to reveal a larger version of the image and then when the large version is clicked on it disappears. 

The first section worked perfectly.  Here's how I did it.  I used this code to make the larger image invisible to start:

this.DinoZombies.visible = false;

Then attached this code to the corresponding thumbnail to reveal it:

this.DinoZombiesBTN.addEventListener("click", fl_MouseClickHandler.bind(this));

function fl_MouseClickHandler()

{

  this.DinoZombies.visible = true;

}

Then attached this code to the fullsized image so it could be turned back off:

this.DinoZombies.addEventListener("click", fl_ClickToHide_3.bind(this));

function fl_ClickToHide_3()

{

  this.DinoZombies.visible = false;

}

Everything worked fine but when I moved onto the next section of the gallery and used the exact same approach for the new images, it wouldn't export properly and I got these errors:

Failed to load resource: the server responded with a status of 404 (Not Found)

New-Websitev4.js?1498061590809:10881 Uncaught TypeError: Cannot set property 'visible' of undefined

    at lib.GallerySection.frame_0 (New-Websitev4.js?1498061590809:10881)

    at a.b._runActions (createjs-2015.11.26.min.js:17)

    at a.b.setPosition (createjs-2015.11.26.min.js:17)

    at a.b.setPosition (createjs-2015.11.26.min.js:17)

    at lib.GallerySection.c._updateTimeline (createjs-2015.11.26.min.js:14)

    at lib.GallerySection.c.advance (createjs-2015.11.26.min.js:14)

    at lib.GallerySection.c._tick (createjs-2015.11.26.min.js:14)

    at lib.NewWebsitev7.b._tick (createjs-2015.11.26.min.js:13)

    at lib.NewWebsitev7.c._tick (createjs-2015.11.26.min.js:14)

    at a.b._tick (createjs-2015.11.26.min.js:13)

New-Websitev4.js?1498061590809:13135 Uncaught TypeError: Cannot read property 'addEventListener' of undefined

    at lib.NewWebsitev7.frame_99 (New-Websitev4.js?1498061590809:13135)

    at a.b._runActions (createjs-2015.11.26.min.js:17)

    at a.b.setPosition (createjs-2015.11.26.min.js:17)

    at a.b.setPosition (createjs-2015.11.26.min.js:17)

    at lib.NewWebsitev7.c._updateTimeline (createjs-2015.11.26.min.js:14)

    at lib.NewWebsitev7.c.advance (createjs-2015.11.26.min.js:14)

    at lib.NewWebsitev7.c._tick (createjs-2015.11.26.min.js:14)

    at a.b._tick (createjs-2015.11.26.min.js:13)

    at a.b.tick (createjs-2015.11.26.min.js:13)

    at a.b.update (createjs-2015.11.26.min.js:13)

My primary field is animation so coding and deciphering errors like this isn't really my strong suit anyway but it doesn't make sense to me that it's having issues with this code that I've already succesfully used before.  It actually sites "event listeners" and "visible" as being issues but they've been used without issue already in the website.

Please help!

Thanks

This topic has been closed for replies.
Correct answer ClayUUID

Okay....I THINK I'm starting to see some issues.  Still not entirely clear on what's wrong with some of the code...but this is helping me narrow it down so I can figure it out.

I've noticed another issue though that I hadn't noticed before.

So I have buttons that take me to different points on the timeline.  And at those points are movieclips with stuff and code inside.  But I also have a back button appearing at these points on the main timeline, to move back to the front page of the site.  The back button works fine on sections where I haven't added the movieclip content yet...but doesn't work on the sections with added content.  It's almost as if the code inside the movieclip is canceling out the code on the main timeline.

Any thoughts as to why this could be?


"Cannot set property 'visible' of undefined"

You can't set a property on something that doesn't exist yet, or ever.

Try sticking a console.log(this); before where you're getting the error.

1 reply

kglad
Community Expert
Community Expert
June 21, 2017

you failed to use the correct reference to one or more objects.

the easiest way to find that object is to object your published html in a browser and use the developers console to see the line of code in New-Websitev4.js that's triggering the problem.

Known Participant
June 21, 2017

The console's actually how I found those errors that I pasted.  But I can't tell to look at them what the problem line of code is.  If it's explained there, I'm not understanding it.

kglad
Community Expert
Community Expert
June 21, 2017

check your network tab then to see if that tells you what's 'not found'.