Page 1 of 1

[SOLVED]Same Problem... Synchro...

Posted: 04 May 2013, 19:16
by Rudolf
Hello,
well my pb is not solved, I use the trick to get pointer of anim and use onEnd
but the callback is not called at End, it's done simultaneously...
you can check this in commenting "dojo.style(zenode, "display", "none");" in the following code.

Code: Select all

                                               afterSlideMoveTileToPlayerBoard:function(idiv,zenode,index)
						{	
							dojo.style(idiv, "backgroundPosition", -(index *80) + "px");
							dojo.style(zenode, "display", "none");
							dojo.disconnect(m_connect[zenode]);
							//m_connect[idiv]=dojo.connect( $(idiv) , 'onclick',this, 'OnClickManagement');
						},

						SlideMoveTileToPlayerBoard:function (zeplayer_id,zenode,index)
						{
							var idiv="pb_move_"+zeplayer_id;	
							dojo.fadeIn({node:idiv}).play();	
							this.attachToNewParent( zenode, idiv ); // To keep position bahaviour in case of reduce/enhance			
							var anim= this.slideToObject(zenode,idiv,1000).play();
							dojo.connect(anim, 'onEnd', this.afterSlideMoveTileToPlayerBoard(idiv,zenode,index));
						},
with 'this' inside ( dojo.connect(anim, 'onEnd', this, this.afterSlideMoveTileToPlayerBoard(idiv,zenode,index)); it's same behaviour...
I've tried also

Code: Select all

var anim= this.slideToObject(zenode,idiv,1000);
anim.play();
;
any idea?

Re: Same Problem... Synchro...

Posted: 04 May 2013, 20:22
by sourisdudesert
Hello,

You should do this:

var anim= this.slideToObject(zenode,idiv,1000);
dojo.connect(anim, 'onEnd', this, 'afterSlideMoveTileToPlayerBoard' );
anim.play();

... and of course find another method to pass the argument to your callback function, or defines it as an inline function. You can use examples from this page:

http://dojotoolkit.org/reference-guide/ ... ation.html

Cheers,

Re: Same Problem... Synchro...

Posted: 04 May 2013, 22:44
by Rudolf
Thanks Greg. It's solved : I use an array to transmit parameters.

Code: Select all

                                                afterSlideMoveTileToPlayerBoard:function(evt)
						{	
							idiv= this.param[1];
							zenode = this.param[2];
							index = this.param[3];
							dojo.style(idiv, "backgroundPosition", -(index *80) + "px");
							dojo.style(zenode, "display", "none");
							dojo.disconnect(m_connect[zenode]);
							//m_connect[idiv]=dojo.connect( $(idiv) , 'onclick',this, 'OnClickManagement');
						},
						SlideMoveTileToPlayerBoard:function (zeplayer_id,zenode,index)
						{
							var idiv="pb_move_"+zeplayer_id;	
							dojo.fadeIn({node:idiv}).play();	
							this.attachToNewParent( zenode, idiv ); // To keep position behaviour in case of reduce/enhance
							this.param[1]=idiv;
							this.param[2]=zenode;
							this.param[3]=index;			
							var anim=this.slideToObject(zenode,idiv,1000);
							dojo.connect(anim, 'onEnd', this,'afterSlideMoveTileToPlayerBoard' );
							anim.play();
						},
And in case of multi-call I use the other solution with function inside