PDA

View Full Version : [CLOSED] Draggable Sprite



paulc
May 14, 2012, 12:13 PM
Hi, I'm trying to make a sprite draggable just by setting draggable = 'true', however I get an error:

Uncaught TypeError: Cannot read property 'dom' of undefined

Exception is in this code:


applyZIndex: function(sprite) {
var me = this,
items = me.items,
idx = items.indexOf(sprite),
el = sprite.el,
prevEl;
if (me.el.dom.childNodes[idx + 2] !== el.dom) { Uncaught TypeError: Cannot read property 'dom' of undefined



if (idx > 0) {

do {
prevEl = items.getAt(--idx).el;
} while (!prevEl && idx > 0);
}
el.insertAfter(prevEl || me.bgRect);
}
sprite.zIndexDirty = false;
},



My code:



<ext:DrawComponent ID="DrawComponent2" runat="server" ViewBox="True">
<Items>
<ext:Sprite SpriteID="spriteBubble" Type="Path" Path="m16.70551,10.67212c-4.26343,0 -7.69574,3.16641 -7.69574,7.09454l0,64.69247c0,3.9281 3.43231,7.09454 7.69574,7.09454l4.56934,0c-1.69879,7.48761 -5.36029,14.7037 -8.89819,21.8848c9.09833,-6.26215 15.96082,-13.08273 21.88483,-21.8848l0.36053,0l89.82397,0c4.26343,0 7.69574,-3.16644 7.69574,-7.09454l0,-64.69247c0,-3.92813 -3.43231,-7.09454 -7.69574,-7.09454l-107.74066,0l0.00018,0z"
StrokeWidth="1" Stroke="#3a3801" Fill="#fffdc6" Group="sprite1">
<Translate X="100" Y="10">
</Translate>
<Listeners>
<Click Handler="alert('text')">
</Click>
</Listeners>
</ext:Sprite>
<ext:Sprite Type="Text" Text="Hello" Group="sprite1" Draggable="True">
<Translate X="120" Y="35" />
<Listeners>
<Click Handler="alert('text')">
</Click>
</Listeners>
</ext:Sprite>
</Items>
</ext:DrawComponent>

Vladimir
May 14, 2012, 7:58 PM
Hi,

Thanks for the report. Fixed in SVN. Please update and retest