Question

How do I do this? I have a seekbar which I'm retrofitting to resize with the FLVPlayback. Right now it gets the mouseX when you click the seekbar, and divides that by the length of the seekbar in order to know what percentage it should seek to.

My problem is that now that I'm dynamically setting the width of the seek movieclip the width returns the width I set, while the mouse event returns the position as if it was still the original width it has in the library.

How do I get around this problem?

Was it helpful?

Solution

Just scale against the original width you had. Say that you've got a 100px wide bar, just go:

var seekTo:Number = seekbar.mouseX / 100;

This will give you the percentage clicked at regardless the current width of the seekbar.

Nice and easy and no funky coord space conversions needed.

OTHER TIPS

The MouseEvent object has a stageX and stageY property - you just need to offset those values by the position of the clip and you should be set.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top