Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
bdeen #1
Title Window Resizable
I have the code that allows you to create a ResizableTitleWindow. If anyone would be interested in this please let me know and I'll share the basic code that I wrote to do the job.
bdeen Guest
-
How to get the browser window title or the http url?
I have a web application which opens a selected/given PDF file in a web browser. Example Url:... -
Auto resizable popup window
Hi everybody... Here is my problem. I have a TileList which contain pictures loaded from the www. As I select one of the pictures, a pop up... -
How to turn off the title bar on a MIAW window?
In my projector the end-user can click on a button to open a MIAW window. I want the MIAW window to open up without its titlebar but, unfortunatelly... -
Setting Window Title On New Window
Why will the following code not change the window title of the new window? window.open "Default.htm" ,"YO" -
Application Window Title
Does anyone know how to change the Window title for a standalone flash player .exe? I am publishing this app as an exe and would like to specify a... -
ntsiii #2
Re: Title Window Resizable
Yeah, man!
We need more extended components available, post that bad boy!
Tracy
ntsiii Guest
-
bdeen #3
Re: Title Window Resizable
Here it is. Now be nice, this was my first time using the MovieComponent as a
drawing area. I hope I got all the measurements and what not correct. Here
are a few nice things about it. 1) if you have a footer colors set, it will
do it's best to match those colors. 2) it uses an empty movie component for
the icon. 3) when you roll over the movie component is should turn the color
of the theme color (like the buttons, it also seems to get set with style
sheets). 4) it calculates a minimum width and minimum height. 5) This
component is built to be used just like the TitleWindow. Let me know if anyone
improves upon this.
<!-- Author: Bruce Deen (bdeen@copera.org) -->
<mx:TitleWindow xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*"
backgroundColor="#FFFFFF" creationComplete="getSmallest()">
<mx:Script>
<![CDATA[
import mx.containers.Panel;
import mx.utils.Delegate;
// used for the resizable Area.
var resizeBox:MovieClip;
var currentBoxColor:Number;
private var __smallestWidth: Number; // gives the smallestwidth including
title bar.
private var __state: Number=1; // 0=Minimized 1=Maximized
private var originalBackgroundColor: Number;
function layoutChildren():Void
{
super.layoutChildren();
drawResizeBox();
}
/**
* Calculates the smallest width the title bar can be sized down to,
without crossing the title and the buttons together.
**/
function getSmallest()
{
var gap=4;
var vm = border_mc.borderMetrics;
var buttonWidth=10;
back_mc.title_mc.measure();
__smallestWidth=back_mc.title_mc.width+vm.right+bu ttonWidth+gap;
}
function createChildren(): Void
{
super.createChildren();
if(controlBar_mc != undefined && controlBar_mc.visible != false)
resizeBox = controlBar_mc.createEmptyMovieClip("resizeBox", 20201);
else resizeBox = this.createEmptyMovieClip("resizeBox", 20201);
resizeBox.height=10;
resizeBox.width=10;
resizeBox.onPress = Delegate.create(this, beginDrag);
resizeBox.onMouseUp = Delegate.create(this, endDrag);
resizeBox.onMouseMove =Delegate.create(this, updateMouse);
resizeBox.onRollOver=Delegate.create(this,resizeHi ghlight);
resizeBox.onRollOut=Delegate.create(this,resizeUnH ighlight);
currentBoxColor = resizeBox._parent.getStyle("borderColor");
}
function resizeUnHighlight()
{
currentBoxColor=resizeBox._parent.getStyle("border Color");
drawResizeBox();
}
function resizeHighlight()
{
currentBoxColor = resizeBox._parent.getStyle("themeColor")
drawResizeBox();
}
function drawResizeBox(color)
{
var buttonWidth=14;
var buttonHeight=14;
var gap=4;
var vm = border_mc.borderMetrics;
var x = resizeBox._parent.layoutWidth - vm.right- (resizeBox.width);
var y = resizeBox._parent.layoutHeight -vm.bottom
-(resizeBox.height);//Math.round((resizeBox._parent.height -
resizeBox._parent.getStyle("marginBottom")))-vm.bottom-gap;
resizeBox.clear();
resizeBox.lineStyle(1,currentBoxColor, 100);
if(controlBar_mc != undefined && controlBar_mc.visible != false)
{
var alphas = [Math.round((resizeBox.height/controlBar_mc.height)*100), 100];
var ratios = [0,0xFF];
var matrix = {matrixType:"box", x:x, y:y, w:resizeBox.width,
h:resizeBox.height, r:(90/180)*Math.PI};
resizeBox.beginGradientFill("linear",
resizeBox._parent.getStyle("footerColors"), alphas, ratios, matrix);
}else
{
x -=resizeBox._parent.getStyle("marginRight") ;
y -= resizeBox._parent.getStyle("marginBottom") ;
resizeBox.beginFill(resizeBox._parent.getStyle("ba ckgroundColor"));
}
resizeBox.onPress = Delegate.create(this, beginDrag);
resizeBox.onMouseUp = Delegate.create(this, endDrag);
resizeBox.onMouseMove =Delegate.create(this, updateMouse);
resizeBox.moveTo(x+resizeBox.width, y);
resizeBox.lineTo(x+resizeBox.width, y+resizeBox.height);
resizeBox.lineTo(x, y+resizeBox.height);
resizeBox.lineTo(x+resizeBox.width, y);
}
var doDrag:Boolean=false;
var mXBegin;
var mYBegin;
function beginDrag()
{
mXBegin=this.width - this.mouseX;
mYBegin = this.height - this.mouseY;
doDrag = true;
}
function endDrag()
{
if(doDrag)
{
var resize:mx.effects.Resize = new mx.effects.Resize(this);
resize.widthBy=_root.mouseX-this.width-this.x+mXBegin;
resize.heightBy=_root.mouseY-this.height-this.y+mYBegin;
var newWidth = this.width+resize.widthBy;
var newHeight = this.height+resize.heightBy;
var smallestHeight =
getStyle("headerHeight")+10+(resizeBox.height);
if(newHeight<smallestHeight)
{
currentBoxColor=resizeBox._parent.getStyle("border Color");
resize.heightBy=smallestHeight-this.height;
}
if(newWidth<__smallestWidth)
{
currentBoxColor=resizeBox._parent.getStyle("border Color");
resize.widthBy=__smallestWidth-this.width;
}
resize.duration=1;
resize.playEffect();
doDrag=false;
this.redraw(true);
drawResizeBox();
}
}
function updateMouse(event)
{
if(!doDrag) return;
var resize:mx.effects.Resize = new mx.effects.Resize(this);
resize.widthBy=_root.mouseX-this.width-this.x+mXBegin;
resize.heightBy=_root.mouseY-this.height-this.y+mYBegin;
var newWidth = this.width+resize.widthBy;
var newHeight = this.height+resize.heightBy;
var smallestHeight = getStyle("headerHeight")+10+(resizeBox.height);
if(newHeight<smallestHeight)
{
resize.heightBy=smallestHeight-this.height;
}
if(newWidth<__smallestWidth)
{
resize.widthBy=__smallestWidth-this.width;
}
resize.duration=1;
resize.playEffect();
}
]]>
</mx:Script>
</mx:TitleWindow>
bdeen Guest
-
bdeen #4
Re: Title Window Resizable
For my next component I'll be doing a multi window management piece that
extends the resizable window. the features (hopefully) 1) max (given a
container area). 2) minimize (with an effect down to the widget that controls
the window) 3) restore 4) tile windows functionality (this is the last one I
need to do).
bdeen Guest
-
-



Reply With Quote


