I'm not very familiar with Actionscript, but I used the trace(event)
function to see what's inside the event:
[MouseEvent type="click" bubbles=true cancelable=false eventPhase=2 localX=202 localY=5 stageX=296 stageY=88 relatedObject=null ctrlKey=false altKey=false shiftKey=false buttonDown=false delta=0]
As you can see, the MouseEvent
object has a property called localX
, which is the one you need. So, the actual class for the movieclip is:
package
{
import flash.display.MovieClip;
import flash.events.*;
public class progressBa extends MovieClip
{
public function progressBa()
{
// Add a mouse event to this, the movieclip called progressBa
this.addEventListener(MouseEvent.CLICK, clickBar);
}
private function clickBar(e:MouseEvent):void
{
// Get click location's x-coordinate in percentages
var percent = 100 * e.localX / this.width;
trace(percent);
}
}
}
To my surprise I was able to click on 100.018...%, maybe because of anti-alias.