Listening to events in light DOM - polymer

The Polymer guide on events is very straightforward. What it doesn't explain, is this: is it at all possible to listen to events in the element's light DOM? (That is, elements distributed in <content></content>)

Yes, as I found it, the way I did it is how you do it!

Related

Is there a way to capture the end of the event of Element.scrollIntoView()?

I'd like to flash the targeted element for three times after it being scrolled into view. I've looked up in the documentation however didn't find anything about capturing events. Is there a way to achieve this? Thanks.

Issue with transitions between scenes using effects

I've ran into a (hard to catch) issue using transitions between scenes in Cocos2d-x.
Basically I normally do a fade in-fade out like this:
Director::getInstance()->replaceScene(TransitionFade::create(0.5, scene, Color3B(0, 0, 0)));
It looks visually good and proper and all but I realized that it can be dangerous. If I have a button to go from Scene A to Scene B this way, the transition will run for 0.5 seconds as per the above implementation. When tapping ONCE and waiting, everything will be fine but if you tap very fast, it IS possible to have the event of the button called another time, even though the first transition call is already under way. This can, and I think in my case, lead to all sorts of strange and dangerous things. Especially for me who often use a protocol/delegate pattern for fetch data callbacks etc.
Want we want to do is to disable any UI (at least, possibly more?) on scene A as soon as the transition starts just to be sure that no other pushes are possible to the same or any other button, causing more transitions to be launched which could cause harmful things. Or there should be some kind of feature within cocos2d-x to always refuse transitions if one transition is already under way... To me that sounds like the most sane thing at first thought.
Is there anything I missed or are transitions in cocos2d-x really this dangerous? Anyone tackled this? Maybe a way to check if a transition is already under way would be one way for me to get around this problem without hacking around on cocos2d-x itself?
The virtual cocos2d::Node function onEnterTransitionDidFinish() could be used to unregister your callbacks for web requests etc.
Assuming you don't use the cocos2d-x event system for any app logic during a transition you might also consider disabling the EventDispatcher to block the propagation of touch events.
You could simply disable the button after it triggers.
Or you could be super lazy and create a Layer/TouchListener to intercept touch when a transition begins (onEnterTransitionDidStart()), and destroy it along with your scene :)

Polymer Custom Animations

I've got a question regarding animations with polymer. I want to make a custom element in polymer and have some default animations on it. In the past I would have used jQuery, but I would like to test the possibilities of the Material Design Library.
I have an element containing a date, whenever I click on it, it should transform and show details.
Here is a link to the animation I would like to get.
https://vid.me/yyFN
I'm sorry for the watermark, it was the first thing I fount to capture the screen.
What would be the best way to get this animation in a custom element on the Polymer Library?
Bart
Ps: This is my first question, please help me if this question is incorrect or not the way it should.
There is an element for that! it is called neon-animation, you can find it in the Polymer's Catalog :
neon-animations
neon animations provide pre-defined animations you can use in your web app, but first you need to understand the concept of web animation in the Polymer world.
There is no better tutorial than these three videos on animations done by Rob Dodson:
Behaviours
Slick Web Animations
neon-Animated Pages
Its recommended, no its vital you watch them in order

Mixing canvas and CSS3 elements

I'm implementing a HTML5 game using canvas. Now I'm thinking about making all text overlays like tooltips, speechbubbles, infowindows and so on using HTML elements with position absolute over the canvas. So I can use many effects and transitions CSS3 offers.
But I'm not sure about performance. These overlays have to be added and removed frecuently (is something MMORPG like, so there will be a lot of speechbubbles and so on).
There are probably 2 questions regarding performance:
DOM traversal to add/remove. Maybe a cache can help?
HTML and CSS3 itself.
The other option is to manage these elements in the canvas itself, drawing them each frame. But maybe I have then again a performance penalty, because of the extra code, timeouts and stuff I would have to add, to achieve similar effects like in CSS3. And traversal of some data structure would be needed anyways.
Any advices, opinions, experiences?
Thanks in advance.
Consider using only one of the mentioned two technology. May be you can release that application in mobile or tablet. I think on these devices would be issues with handling both the same time. And another thing: if you stay in canvas there would be no worries about compatibility. Its not a techy but a thought-provoking answer.
The single best reason for using the DOM for UI elements in HTML5 games is event handling.
If you draw everything on canvas you will need to write your own logic to handle clicks and decide what has been clicked on, which can soon become very complex, expecialy if you have multiple layers of interface.
With DOM elements (especially when using a library like jQuery) this is trivial, and you can create a rich and interactive UI with minimal effort.
The only downside I can think of is that you may encounter browser inconsistencies, especially if using CSS3, but again jQuery will help with this.
I suppose another downside is that once you go down the DOM route, your game is always going to be a browser game, whereas if it was 100% canvas, there would always be the possibility of porting the code to another language and making it native, but I guess that would only be a downside for some people.
One way to approach this is to use a "dynamic" image map behind your canvas object. Then you can use the dom as required. Note you will need to pass the clicks on the canvas through to the image map.

Script a button to its rollover state?

Anyone know if it is possible via AS3 to change a button to its rollover state when it is not, in reality, rolled over?
Client decided way late in process to ask for some other elements to affect button states. If I had known I would have used movie clips instead of buttons.
Thanks for any advice.
Have you tried manually calling gotoAndStop(2) ?
If none of the above solutions work, you'll either have to subclass SimpleButton and link it to your symbols or rebuild in MovieClips
Dispatch the rollover event manually? Apart from that, I don't see any other way. I am curious though, what sort of requirement(s) would mandate such an oddity.
You can open the properties of any library display object and change it to a button, graphic, or movieclip type. this should allow you to then change the instance type to button and retain rollover abilities while allowing "gotoAndStop" actions on the instance. I'm not totally sure this works, and this thread is old, but if anyone has this same issue it would be worth a shot. This is assuming you aren't creating SimpleButtons dynamically.