.addEventListener(Event.ENTER_FRAME vs .onenterframe ?

38 views
Skip to first unread message

vmars316

unread,
Apr 28, 2013, 7:21:49 PM4/28/13
to enchantjs-...@googlegroups.com
Hello & Thanks , 

In my code I use :
        sprite1.addEventListener(Event.ENTER_FRAME, function() 
          { 
              my code here.......
          }

with no  sprite1.onenterframe = function() { "
            
So , It appears that " .onenterframe " is unnecessary . 
Are there any complications doing it this way ?
Thanks..vm



sidestepism

unread,
Apr 30, 2013, 4:05:13 AM4/30/13
to enchantjs-...@googlegroups.com
A. 
sprite.onenterframe = function() {...}

This has the same meaning in semantics as:

B.
sprite1.addEventListener(Event.ENTER_FRAME, 

You can multiple event listener with B, but A is a quick way to set a single listener.
enchant.js refer to DOM Event, and it support both ways.
Reply all
Reply to author
Forward
0 new messages