actionscript 3 - Action Script 3 Health Bar Issues -


i new as3 , trying add dynamic health code. here code have based on dynamic health.

var currenthealth:int = 5000; var totalhealth:int = 10000; //dynamic health var healthpack:medipack = new medipack(); healthpack.width = 30; healthpack.height = 30; healthpack.x = math.random() * stage.stagewidth; healthpack.y = math.random() * stage.stageheight; stage.addchild(healthpack); 

and:

//display current health health.bar.width = 300 * (currenthealth / totalhealth); currenthealth -= 1;  //detecting collision health if (stage.contains(healthpack)) {     if (player_mc.hittestobject(healthpack))         {             currenthealth += 5000;             healthpack.parent.removechild(healthpack);         } }    

my current symbols have in library associated health are:

healthbarbg (has instance name of bar) , instance of healthbar healthbar , medipack

whenever run code error of:

scene 1, layer 'actions', frame 2, line 91, column 2    1120: access of undefined property healthbar. 

im not sure i've done wrong, appriciated, thanks.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -