@Override
protected void onFirstFrame() {
super.onFirstFrame();
GSMovie m = getMovie();
if (m != null){
this.setNoFill(false);
this.setNoStroke(false);
//Resize MTMovieClip
MTMovieClip.this.setSizeLocal(movieClip.getWidthXY(TransformSpace.RELATIVE_TO_PARENT) + 2*sideBarWidth, movieClip.getHeightXY(TransformSpace.RELATIVE_TO_PARENT) + topBarHeight + bottomBarHeight);
//Reposition movie
PositionAnchor oldAnchor = MTMovieClip.this.getAnchor();
MTMovieClip.this.setAnchor(PositionAnchor.LOWER_LEFT);
Vector3D lowerLeft = MTMovieClip.this.getPosition(TransformSpace.LOCAL);
MTMovieClip.this.setAnchor(oldAnchor);
//Reposition close button
MTMovieClip.this.setAnchor(PositionAnchor.UPPER_LEFT);
Vector3D upperLeft = MTMovieClip.this.getPosition(TransformSpace.LOCAL);
this.setAnchor(PositionAnchor.UPPER_LEFT);
Vector3D upperRight = new Vector3D(upperLeft.x + MTMovieClip.this.getWidthXY(TransformSpace.LOCAL), upperLeft.y);
Vector3D closeButtonPos = new Vector3D(upperRight.x - closeButton.getWidthXY(TransformSpace.RELATIVE_TO_PARENT) - sideBarWidth, upperRight.y);
closeButton.setPositionRelativeToParent(closeButtonPos);
//Reposition play symbol
if (playSymbol != null){
// playSymbol.setSizeXYRelativeToParent(this.getHeightXY(TransformSpace.LOCAL), this.getHeightXY(TransformSpace.LOCAL));
playSymbol.setPositionRelativeToParent(this.getCenterPointRelativeToParent());
}
//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()) {