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

Game development with Board Game Arena Studio
Post Reply
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

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

Post 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?
Last edited by Rudolf on 04 May 2013, 22:45, edited 1 time in total.
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: Same Problem... Synchro...

Post 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,
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

Re: Same Problem... Synchro...

Post 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
Post Reply

Return to “Developers”