No i dont have a reason. Maybe it is unnecessary, but i am used to prototype's hash functions. Thats why.
On 19 Okt, 23:28, kangax <[EMAIL PROTECTED]> wrote: > On Oct 19, 1:25 pm, morre95 <[EMAIL PROTECTED]> wrote: > > > > > I´m trying to develop a puzzle game. Like the one you find > > herehttp://github.com/madrobby/scriptaculous/wikis/puzzle-demo > > > My problem is that i want to show the user the correct position off > > all images at first. And after 1 second i will reorder them with > > Effect.Move(); This i have solved. But when i make them sortable with > > Sortable.create(). The imges tend to jump around like they want. And > > dont folow the mouse att all when you drop them. > > > The code i have to shuffle the images is: > > shuffleImages: function () { > > var position = [$H({ top: 266, left: 399 }), > > $H({ top: 266, left: 0 }), > > $H({ top: 133, left: -266 }), > > $H({ top: 266, left: -399 }), > > $H({ top: -133, left: 266 }), > > $H({ top: 0, left: 133 }), > > $H({ top: 0, left: -133 }), > > $H({ top: 133, left: -133 }), > > $H({ top: -266, left: 399 }), > > $H({ top: -266, left: 0 }), > > $H({ top: -133, left: 133 }), > > $H({ top: -266, left: -399 })]; > > var makeSortable = this.makeSortable.bind(this); > > this.puzzle.select('img').each(function(e, i) { > > new Effect.Move(e, { x: position[i].get('left'), y: > > position[i].get('top'), mode: 'relative', duration: 1, delay: 1, > > afterFinish: makeSortable }) > > }); > > > } > > > And to make them sortable i have this; > > makeSortable: function () { > > Sortable.create('puzzle_' + this.elementName, { > > tag: 'img', > > overlap: 'horizontal', > > constraint: false, > > onUpdate: this.onUpdate.bind(this) > > }); > > > }, > > > If you dont understand my bad English i have a demo > > here:http://web.telia.com/~u44002360/puzzle/ > > > I hope some one can help me > > Is there a reason you used prototype's Hash instead of a plain object? > It seems a bit too verbose and unnecessary in this case. > > -- > kangax --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
