making a progress bar in javascript

the bar is not filling up and also one number is displayed in textblock and level loads…
code:

#pragma strict
var levelname:String;
var loadingscreen:GameObject;
var emptybar:GameObject;
var bar:GameObject;
var percentage:GameObject;
var oldscreen:GameObject;
private var loadprogress:int=0;

function Start () {
loadingscreen.active=false;
emptybar.active=false;
bar.active=false;
percentage.active=false;
}

function Update () {
if(Input.GetKey(KeyCode.Space))
press();
 if(Input.touchCount > 0)
 {

var touch: Touch = Input.touches[0]; 
	if(touch.phase == TouchPhase.Began && guiTexture.HitTest(touch.position)){
		press();
	
	}
	
}
}

function press()
{
	this.guiTexture.pixelInset.width=-8;
	this.guiTexture.pixelInset.height=-8;
	yield WaitForSeconds(.2);
	this.guiTexture.pixelInset.width=0;
	this.guiTexture.pixelInset.height=0;
	yield StartCoroutine("load");	
}
function load()
{
oldscreen.active=false;
loadingscreen.active=true;
emptybar.active=true;
bar.active=true;
percentage.active=true;
var async:AsyncOperation=Application.LoadLevelAsync("level 1");
while(async.progress<=1)
{
Debug.Log(async.progress*100);
loadprogress=async.progress*10;
bar.transform.localScale=Vector3((loadprogress/3),bar.transform.localScale.y,bar.transform.localScale.z);
percentage.guiText.text="Loading "+loadprogress+" %";
yield null;
}
}`enter code here`

You are using yield in your press method. That makes it a co routine, and co-routines always have to be called with StartCoroutine, or they will do nothing.
Try this:

  StartCoroutine(press());

Also if I look at your mobile version of your input it seems you will want to use Input.GetKeyDown(KeyCode.Space), this way your press method will only be executed once every time you push the space bar, unless it is meant to be continuous update as long as the user holds the space bar down.

k thanx…solved it