Opened 7 years ago

Closed 4 years ago

#16305 closed enhancement (duplicate)

Fx: allowing connection to animation end through on with combine()

Reported by: gorgoroth Owned by: Bryan Forbes
Priority: undecided Milestone: 1.11
Component: fx Version: 1.8.1
Keywords: Cc: Alpha
Blocked By: Blocking:

Description

Using fx.combine and wanting to attach to the onEnd event, now it's only possible through the deprecated dojo.connect method:

dojo.connect(anim, 'onEnd', function() {});

Using on() does not work and raise an error ("Target must be an event emitter")

on(anim, 'End', function() {});

fx.chain, on the other hand, works with on().

Change History (5)

comment:1 Changed 6 years ago by simpo

Is it worth putting a note somewhere in the current v1.8 documentation about this as it will confuse new users (see http://stackoverflow.com/questions/14737490/how-to-execute-an-action-when-a-combined-animation-ended).

comment:2 Changed 6 years ago by simpo

A quick fix would be to add:

_combine.prototype = new Evented();

just before line: 193 (sorry no patch file as unsure which part of your SVN is latest/nightly; although just one line, so ought to be easy to find). The same methodology has been used on line 51 for chaining.

I've tested adding this and it seems to work well, if anyone needs a quick fix. However, I can't say, I've given it a thorough test.

comment:3 Changed 6 years ago by bill

Cc: Alpha added

comment:4 Changed 6 years ago by dmidz

there still a problem in version 1.9.1 :

...
var anim = fx.combine([
  baseFx.animateProperty({..., duration:200, onEnd:function(){
    // should be called FIRST
  }),
  baseFx.animateProperty({..., duration:1000, onEnd:function(){
    // should be called SECOND
  })
]);
//____ 3 attempts for catching the whole combine onEnd event
//_1. new dojo/aspect way
aspect.after(anim, 'onEnd', function(){
  // should be called LAST but called FIRST
});
//_2. dojo/on way
on(anim, 'End', function(){
  // should be called LAST but throws an error
});
//_3. deprecated dojo/_base/connect way
connect.connect(anim, 'onEnd', function(){
  // should be called LAST but called FIRST
});
anim.play();
...

is it expected behaviour that combine onEnd is called before sub animation onEnd ?

Last edited 6 years ago by dmidz (previous) (diff)

comment:5 Changed 4 years ago by dylan

Milestone: tbd1.11
Resolution: duplicate
Status: newclosed

Duplicate of #15034.
I think this is a duplicate of #15034, which we will consider for 1.12.

Note: See TracTickets for help on using tickets.