//Create movie seek Slider
float sliderXPadding = 10;
float sliderYPadding = 3;
float sliderHeight = bottomBarHeight - 2*sliderYPadding;
slider = new MTSlider(lowerLeft.x + sliderXPadding, lowerLeft.y - sliderHeight - sliderYPadding, MTMovieClip.this.getWidthXY(TransformSpace.LOCAL) - sliderXPadding*2, sliderHeight, 0, 10, app);
slider.getOuterShape().setFillColor(new MTColor(0, 0, 0, 80));
slider.getOuterShape().setStrokeColor(new MTColor(0, 0, 0, 80));
slider.getKnob().setFillColor(new MTColor(100, 100, 100, 80));
slider.getOuterShape().setStrokeColor(new MTColor(100, 100, 100, 80));
slider.getKnob().addGestureListener(DragProcessor.class, new IGestureEventListener() {
public boolean processGestureEvent(MTGestureEvent ge) {
DragEvent de = (DragEvent)ge;
switch (de.getId()) {
case MTGestureEvent.GESTURE_DETECTED:
stopSliderAdvance = true;
break;
case MTGestureEvent.GESTURE_UPDATED:
break;
case MTGestureEvent.GESTURE_ENDED:
if (movieClip != null && movieClip.getMovie() != null /*&& movieClip.getMovie().isPlaying()*/){
float currValue = slider.getValue();
movieClip.jump(currValue);
}
stopSliderAdvance = false;
break;
default:
break;
}
return false;
}
});
//Dont do every frame! Duration is only valid if playing..
slider.setValueRange(0, m.duration());
slider.getOuterShape().addGestureListener(TapProcessor.class, new IGestureEventListener() {
public boolean processGestureEvent(MTGestureEvent ge) {
TapEvent te = (TapEvent)ge;
switch (te.getTapID()) {
case TapEvent.BUTTON_DOWN:
stopSliderAdvance = true;
break;
case TapEvent.BUTTON_UP:
stopSliderAdvance = false;
break;
case TapEvent.BUTTON_CLICKED:
if (movieClip != null && movieClip.getMovie() != null /*&& movieClip.getMovie().isPlaying()*/){
float currValue = slider.getValue();
movieClip.jump(currValue);
}
stopSliderAdvance = false;
break;
default:
break;
}
return false;
}
});
if (app instanceof MTApplication) {
MTApplication mtApp = (MTApplication) app;
mtApp.invokeLater(new Runnable() {
public void run() {
MTMovieClip.this.addChild(slider);
}
});
}else{
this.addChild(slider);
}
slider.setVisible(true);
//Create volume slider
float volSliderWidth = this.getWidthXY(TransformSpace.LOCAL)/7f;
float volSliderHeight = topBarHeight - 2*sliderYPadding;
this.setAnchor(PositionAnchor.UPPER_LEFT);
Vector3D movieUpperLeft = this.getPosition(TransformSpace.RELATIVE_TO_PARENT);
volumeSlider = new MTSlider(movieUpperLeft.x + 1.5f, movieUpperLeft.y - volSliderHeight - 1.5f, volSliderWidth, volSliderHeight, 0, 1, app);
volumeSlider.getOuterShape().setFillColor(new MTColor(0, 0, 0, 80));
volumeSlider.getOuterShape().setStrokeColor(new MTColor(0, 0, 0, 80));
volumeSlider.getKnob().setFillColor(new MTColor(100, 100, 100, 80));
volumeSlider.getOuterShape().setStrokeColor(new MTColor(100, 100, 100, 80));
if (app instanceof MTApplication) {
MTApplication mtApp = (MTApplication) app;
mtApp.invokeLater(new Runnable() {
public void run() {
MTMovieClip.this.addChild(volumeSlider);