Hello,
I have a file in which I use this stage resize function. However if I resize really fast (like maximize button) it doesn't resize the Timeline.
Code:
stage.addEventListener(Event.RESIZE,resizeStage);
private function resizeStage(e:Event):void
{
resetVideo();
_controlbar.resetControlBar(stage.stageWidth);
_barlength = _clickbar.width;
_levelstart = _level.x;
_Controls.y = stage.stageHeight-BAR_HEIGHT;
}
public function resetControlBar(_width:int):void
{
// get all properties
_basics = Shape(mcControlBar.getChildByName("_basics"));
_controls = MovieClip(mcControlBar.getChildByName("_controls"));
_volumebar = MovieClip(mcControlBar.getChildByName("_volume"));
_timebar = MovieClip(mcControlBar.getChildByName("_timeline"));
// resize the basic shape
_basics.width = _width;
resetControls(_width);
resetTimeline(_width);
}
private function resetControls(_width:int)
{
// resize the controls
_volumebar.getChildByName("_base").x = _width-(_volumebar.getChildByName("_base").width+PADDING);
_volumebar.getChildByName("_level").x = _volumebar.getChildByName("_base").x+1;
_volumebar.getChildByName("_clickbar").x = _volumebar.getChildByName("_base").x+1;
_volumebar.getChildByName("_scrub").x = _volumebar.getChildByName("_base").x;
_volumebar.getChildByName("_mute").x = _volumebar.getChildByName("_base").x-_volumebar.getChildByName("_mute").width-PADDING;
_volumebar.getChildByName("_unmute").x = _volumebar.getChildByName("_base").x-_volumebar.getChildByName("_unmute").width-PADDING;
_volumebar.getChildByName("_line").x = (_volumebar.getChildByName("_mute").x-PADDING);
_volumebar.getChildByName("_line2").x = (_volumebar.getChildByName("_mute").x-PADDING)-1;
// resize the timeline
_volumestart = (_volumebar.getChildByName("_mute").x-PADDING);
}
private function resetTimeline(_width:int)
{
var _shapewidth:int = _width-(_play.x+_play.width+PADDING);
_shapewidth-= _width-_timedisplay.x+PADDING;
// dynamic bars
var _bwidth:int = _shapewidth-2;
_timebar.getChildByName("_timedisplay").x = _volumestart-_timebar.getChildByName("_timedisplay").width-PADDING;
_timebar.getChildByName("_base").width = _shapewidth;
var _click:MovieClip = MovieClip(_timebar.getChildByName("_clickbar"));
var _child:Shape = Shape(_click.getChildAt(0));
_click.removeChild(_child);
// the shape
var _clickshape:Shape = new Shape();
_clickshape.graphics.beginFill(SEC_COLOR);
_clickshape.graphics.drawRect(0,0,_bwidth,_timebar.getChildByName("_progress").height);
_clickshape.graphics.endFill();
_click.addChild(_clickshape);
}
So to be exactly this part stays behind (oddly enough it does set the _timedisplay on the right spot):
Code:
_timebar.getChildByName("_base").width = _shapewidth;
var _click:MovieClip = MovieClip(_timebar.getChildByName("_clickbar"));
var _child:Shape = Shape(_click.getChildAt(0));
_click.removeChild(_child);
// the shape
var _clickshape:Shape = new Shape();
_clickshape.graphics.beginFill(SEC_COLOR);
_clickshape.graphics.drawRect(0,0,_bwidth,_timebar.getChildByName("_progress").height);
_clickshape.graphics.endFill();
_click.addChild(_clickshape);
Is there a way to solve this (without using a timer)?
Thank you