What's the simplest, quickest way to achieve a fluid border layout in pure AS3 / Flash? I'm using Flex SDK + FlashDevelop to develop a video player and I want to put some controls on the left, some controls on the right, but leave the scrubber in the middle. I want the scrubber to resize horizontally depending on the size of the player. A border layout with an expanding center would be perfect for this. I've tried the Yahoo Astra utils package, but it doesn't seem to work (at all, nothing appears on screen). I'm currently using the following code:
package com.example.test
{
import com.yahoo.astra.layout.LayoutContainer;
import com.yahoo.astra.layout.modes.BorderLayout;
import com.yahoo.astra.layout.modes.BorderConstraints;
import flash.display.Sprite;
import flash.events.Event;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.text.TextField;
public class Main extends Sprite
{
private var controlLayout:BorderLayout;
private var controlContainer:LayoutContainer;
private var video:Video;
private var connection:NetConnection;
private var stream:NetStream;
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
connection = new NetConnection();
connection.connect(null);
stream = new NetStream(connection);
stream.client = this;
stream.play('vidoeurlhere');
video = new Video();
video.width = stage.stageWidth;
video.height = stage.stageHeight;
video.attachNetStream(stream);
controlLayout = new BorderLayout();
controlLayout.horizontalGap = 5;
controlLayout.addClient(video, { constraint: BorderConstraints.TOP } );
var tf:TextField = new TextField();
tf.text = 'hello world!';
controlContainer = new LayoutContainer(controlLayout);
controlContainer.width = stage.stageWidth;
controlContainer.height = stage.stageHeight;
controlContainer.x = 0;
controlContainer.y = 0;
this.addChild(tf);
this.addChild(controlContainer);
}
public function onMetaData(e:Object):void {
}
}
}