PDA

View Full Version : fas.Win.GetWH and fas.Shell.GetScreenWH


wiseganesha
09-24-2002, 12:37 AM
I need help with using these two
fas.Win.GetWH
fas.Shell.GetScreenWH

I'm trying to set my window at the absolute bottom of the screen in the middle. I tried just using fscommand("fas.win.pos","middle,bottom"); but that puts it too high on the bottom.
So I'm trying to get the total width then find half then get total movie width ang get half of that. then find the position along x by subtracting the two results. The Y would be found by taking the total height less the movie height.

however, I cannot get access to the vars returned from win.getwh and getscreenwh. Here's what i'm trying to do exactly :
//get and set window position
fscommand("fas.Shell.GetScreenWH","totalwidth,totalheight");
fscommand ("fas.Win.GetWH", "winwidth,winheight");
dockX = (totalwidth / 2)- (winwidth / 2);
dockY = totalheight - winheight;
//dockX = 500; //used to test that win.setxy works
//dockY = 500; //same as above
dockXY = dockX add "," add dockY;
fscommand("fas.Win.SetXY",dockXY);

So it works when i put in valuse for dockX and dockY, but not when I work off the numbers returned from getscreenwh or getwh.

Thanks :)

Flashants
09-24-2002, 10:45 AM
Whenever to retrieve system information to variable, pls wait a few frames untill the information to be successfully retrieved.
Example:

Frame N:
//get and set window position
fscommand("fas.Shell.GetScreenWH","totalwidth,totalheight");
fscommand ("fas.Win.GetWH", "winwidth,winheight");

Frame N+4:
dockX = (totalwidth / 2)- (winwidth / 2);
dockY = totalheight - winheight;
//dockX = 500; //used to test that win.setxy works
//dockY = 500; //same as above
dockXY = dockX add "," add dockY;
fscommand("fas.Win.SetXY",dockXY);

Or you should make a loop to check if the variables are retrieved.

wiseganesha
09-25-2002, 04:32 AM
I tried this, but it just runs forever and hogs the cpu.

totalwidth=0;
totalheight=0;
winwidth=0;
winheight=0;
while(totalwidth==0||totalheight==0||winwidth==0|| winheight==0){
fscommand("fas.Shell.GetScreenWH","totalwidth,totalheight");
fscommand ("fas.Win.GetWH", "winwidth,winheight");
}
dockX = (totalwidth - winwidth)/2;
dockY = totalheight-winheight;
//dockX = 327; //used to test that win.setxy works
//dockY = 849; //same as above
dockXY = dockX add "," add dockY;
fscommand("fas.Win.SetXY",dockXY);
//end window pos

Flashants
10-07-2002, 08:22 AM
Don't use WHILE or FOR loop in a single frame to pause or wait:
http://www.macromedia.com/support/flash/ts/documents/f5_pauser.htm