<div dir="ltr"><font>Hi,<br clear="all"><br></font><div>
</div><div><font>I may be duplicating one part of this plea - my previous post didn't seem to come through.</font></div><div><font><br></font></div><div><font>I have to use Actionscript 3 for a particular exercise and the code, which works fine in the SWF, doesn't work in Xerte. Is there a problem with Xerte and AS3?</font></div>
<div><font><br></font></div><div><font>This is the code:</font></div><div><font><br></font></div><div><font>1) To attach sound to a movie clip:</font></div><div><font><br></font></div><div><font><div>/var snd:grey_rod= new grey_rod();</div>
<div><br></div><div>//speaker_grey.addEventListener (MouseEvent.CLICK, soundbutton_Handler);</div><div><br></div><div>//function soundbutton_Handler (e:MouseEvent):void {</div><div>//snd.play();</div><div><br></div><div>2) for a drag and drop game:</div>
<div><br></div><div><div>var objectoriginalX:Number;</div><div>var objectoriginalY:Number; </div><div><br></div><div>triangle_mc.buttonMode = true; </div><div>triangle_mc.addEventListener(MouseEvent.MOUSE_DOWN,pickupObject); </div>
<div>triangle_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);</div><div><br></div><div>function pickupObject(event:MouseEvent):void { </div><div> event.target.startDrag(true); </div><div> event.target.parent.addChild(event.target); </div>
<div> objectoriginalX = event.target.x; </div><div> objectoriginalY = event.target.y; </div><div> response_txt.text = " "</div><div>} </div><div>function dropObject(event:MouseEvent):void { </div><div> event.target.stopDrag(); </div>
<div> var matchingTargetName:String = "target" + <a href="http://event.target.name">event.target.name</a>; </div><div> var matchingTarget:DisplayObject = getChildByName(matchingTargetName); </div><div> if (event.target.dropTarget != null && event.target.dropTarget.parent == matchingTarget){ </div>
<div> event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickupObject); </div><div> event.target.removeEventListener(MouseEvent.MOUSE_UP, dropObject); </div><div> event.target.buttonMode = false; </div><div> event.target.x = matchingTarget.x; </div>
<div> event.target.y = matchingTarget.y;</div><div> response_txt.text = "You did it!"</div><div> }else { </div><div> event.target.x = objectoriginalX; </div><div> event.target.y = objectoriginalY; </div>
<div> response_txt.text = "Try again"</div><div> </div><div> }</div><div>}</div></div><div><br></div><div>Please help - why might Xerte not like this code?</div><div><br></div><div>Deborah</div><div><br></div>
</font></div></div>