Res. Button

Ok…here we go again. I always seem to asks these kinda questions that start a 2 page thread. Anyway, here we go again. I need to make a button that on release would goto the right page either for a person running 800x600 or lower or a person on 1024x768 or higher. Thats just the beggining, I also need to have it open a centered popup window that is the correct size for the person. So if there resolution is 800x600 the window is 800x600…only other thing is if there res is 1024x768 or higher the window only needs to be 1024x768. So now I will let this thread grow and hope for the best. Thanks all in advance!


myButton.onRelease = function() {
	var res = System.capabilities.screenResolutionX
	if (res == 800) {
		// do this
	} else if (res == 1024) {
		// do that
	} // and so on
}

untested but it should work :beam: [size=1][I hope][/size]

My final product came to this and it seems to work:


on (release) {
	myButton.onRelease = function() {
		var res = System.capabilities.screenResolutionX;
		if (res == 800) {
	address = "http://www.apocalypseclan.net/wonder/index.htm";
	target_winName = "smallres";
	width = 800;
	height = 600;
	toolbar = 0;
	location = 0;
	directories = 0;
	status = 0;
	menubar = 0;
	scrollbars = 1;
	resizable = 0;
	openWinCentre(address, target_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable);
		} else if (res == 1024) {
	address = "http://www.apocalypseclan.net/wonder/index.htm";
	target_winName = "highres";
	width = 1024;
	height = 768;
	toolbar = 0;
	location = 0;
	directories = 0;
	status = 0;
	menubar = 0;
	scrollbars = 0;
	resizable = 0;
	openWinCentre(address, target_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable);
		}
	};
}


on (release) {
	var res = System.capabilities.screenResolutionX
	if (res <= 800) {
		address = "http://www.apocalypseclan.net/wonder/index.htm"
		target_winName = "smallres"
		width = 800
		height = 600
	} else if (res >= 1024) {
		address = "http://www.apocalypseclan.net/wonder/index.htm"
		target_winName = "highres"
		width = 1024
		height = 768
	}
	toolbar = 0
	location = 0
	directories = 0
	status = 0
	menubar = 0
	scrollbars = 1
	resizable = 0
	openWinCentre (address, target_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable)
}

I’d use something like this …

[size=1][EDIT]
I change the script again to do exactly what you want it to do [I think so][/size]

I would use yours but I need scrollbars on the smaller window. So I did this.


on (release) {
	var res = System.capabilities.screenResolutionX
	if (res <= 800) {
		address = "index3.htm"
		target_winName = "smallres"
		width = 798
		height = 600
		scrollbars = 1
	} else if (res >= 1024) {
		address = "index2.htm"
		target_winName = "highres"
		width = 900
		height = 618
		scrollbars = 0
	}
	toolbar = 0
	location = 0
	directories = 0
	status = 0
	menubar = 0
	resizable = 0
	openWinCentre (address, target_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable)
}

on (release) {
	var res = System.capabilities.screenResolutionX
	if (res <= 800) {
		address = "http://www.apocalypseclan.net/wonder/index.htm"
		target_winName = "smallres"
		width = 800
		height = 600
		scrollbars = 1
	} else if (res >= 1024) {
		address = "http://www.apocalypseclan.net/wonder/index.htm"
		target_winName = "highres"
		width = 1024
		height = 768
		scrollbars = 0
	}
	toolbar = 0
	location = 0
	directories = 0
	status = 0
	menubar = 0
	resizable = 0
	openWinCentre (address, target_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable)
}

that’s it … now you have scrollbars in the smaller window

since you’re calling the same document in both resolutions …
you can remove one more line of code:

on (release) {
	var res = System.capabilities.screenResolutionX
	if (res <= 800) {
		target_winName = "smallres"
		width = 800
		height = 600
		scrollbars = 1
	} else if (res >= 1024) {
		target_winName = "highres"
		width = 1024
		height = 768
		scrollbars = 0
	}
	address = "http://www.apocalypseclan.net/wonder/index.htm"
	toolbar = 0
	location = 0
	directories = 0
	status = 0
	menubar = 0
	resizable = 0
	openWinCentre (address, target_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable)
}

oops … that’s funny

you’ve edited your last post when I was posting … :sigh:

lol and no they point to different locations. I was just reading that like hmm we have teh smae thing.

http://www.apocalypseclan.net/wonder/index.htm

Take a look at the final project.