[Xerte] Re: AS3 Code doesn't work in Xerte?

Ron Mitchell ronm at mitchellmedia.co.uk
Fri Jul 1 13:33:08 BST 2011


Dave Burnett has already answered your question - you can't use AS3 with
Xerte 2. It's AS2 only. If you're using pageTemplates you could use the New
Window page to load your swf in a new chromeless window or obviously just
link to it normally.

HTH

Ron

 

From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Deborah Delin
Sent: 01 July 2011 13:11
To: xerte at lists.nottingham.ac.uk
Subject: [Xerte] AS3 Code doesn't work in Xerte?

 

Hi,


I may be duplicating one part of this plea - my previous post didn't seem to
come through.

 

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?

 

This is the code:

 

1) To attach sound to a movie clip:

 

/var snd:grey_rod= new grey_rod();

 

//speaker_grey.addEventListener (MouseEvent.CLICK, soundbutton_Handler);

 

//function soundbutton_Handler (e:MouseEvent):void {

//snd.play();

 

2) for a drag and drop game:

 

var objectoriginalX:Number;

var objectoriginalY:Number; 

 

triangle_mc.buttonMode = true; 

triangle_mc.addEventListener(MouseEvent.MOUSE_DOWN,pickupObject); 

triangle_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);

 

function pickupObject(event:MouseEvent):void { 

  event.target.startDrag(true); 

  event.target.parent.addChild(event.target); 

  objectoriginalX = event.target.x; 

  objectoriginalY = event.target.y; 

    response_txt.text = " "

} 

function dropObject(event:MouseEvent):void { 

  event.target.stopDrag(); 

  var matchingTargetName:String = "target" + event.target.name; 

  var matchingTarget:DisplayObject = getChildByName(matchingTargetName); 

  if (event.target.dropTarget != null && event.target.dropTarget.parent ==
matchingTarget){ 

   event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickupObject); 

   event.target.removeEventListener(MouseEvent.MOUSE_UP, dropObject); 

   event.target.buttonMode = false; 

   event.target.x = matchingTarget.x; 

   event.target.y = matchingTarget.y;

    response_txt.text = "You did it!"

  }else { 

   event.target.x = objectoriginalX; 

   event.target.y = objectoriginalY; 

    response_txt.text = "Try again"

   

  }

}

 

Please help - why might Xerte not like this code?

 

Deborah

 

 

This message and any attachment are intended solely for the addressee and
may contain confidential information. If you have received this message in
error, please send it back to me, and immediately delete it. Please do not
use, copy or disclose the information contained in this message or in any
attachment. Any views or opinions expressed by the author of this email do
not necessarily reflect the views of the University of Nottingham. 

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20110701/9ef2e75c/attachment-0001.html>


More information about the Xerte mailing list