helloworld Posted May 29, 2017 Share Posted May 29, 2017 Hi all I'm trying to make an animation play when i hit a button so far I've tried using an onclick attribute on the button tag but it didn't work and nothing on the forums looks like it would help. I'm trying to make it a bit like jigspace if that helps. }); project.js Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 30, 2017 Share Posted May 30, 2017 Hello without a repro of your issue in the PG it will be tough to help you Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 30, 2017 Share Posted May 30, 2017 Hi guys. I found this playground. It doesn't have animation, but it shows how to create an HTML button using scene-code JS. It uses onclick, but has eventListener examples, too. You could change "span" to "button" in line 33, if you wish. *shrug* Might be handy for you, HW. You could put animation-start command... at line 49. Creating absolutely-positioned HTML buttons... within scene JS code... takes many lines of JS... but it is fun/powerful. Hope this helps. helloworld 1 Quote Link to comment Share on other sites More sharing options...
helloworld Posted May 30, 2017 Author Share Posted May 30, 2017 Thanks Wingnut it works perfectly Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 30, 2017 Share Posted May 30, 2017 Good to hear! Yeah, sometimes there is a "scope" problem with HTML onclick="somefunc". Sometimes it can be fixed by using onclick = "window.somefunc". I'm no professional. Your animation is working - I'm glad. Nice to know there is no problem with animation part. Only HTML part. Also, welcome to the forum - good to have you with us. helloworld 1 Quote Link to comment Share on other sites More sharing options...
helloworld Posted May 31, 2017 Author Share Posted May 31, 2017 also it would be great if you could help me out somemore after this animation plays i want to then play the next animation how would i do that (with the same button)? edit: ive played around with this function addItem() { var newItem = document.createElement("span"); newItem.innerHTML = document.getElementById("ms123").value; newItem.onclick = removeItem; document.getElementById("list").appendChild(newItem); } function removeItem() { document.getElementById("ms123").removeChild(this); } but so far it hasnt worked (ms123 is the previous span) if you want me to send you the whole file just say Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.