A Flash Developer Resource Site

Results 1 to 20 of 27

Thread: Instance creation problem

Threaded View

  1. #21
    Junior Member
    Join Date
    Feb 2012
    Posts
    17
    army is declared in the class
    Code:
    public var army:Array;
    When I try to declare the newEnemy, the code doesn't work, here is what I done:
    Code:
    			for (var i:int = army.length-1; i>=0; i--)
    			{	
    				var newEnemy=new Enemy(x,y);
    			  	var nme:Enemy = army[i];
     			 	if (newEnemy.hitTestObject(nme))
    			 	{
     			  		 nme.y+=120;
    				}
    			}
    P.S. I don't know how to declare newEnemy in such a way so it doesn't interfere with other code and i also get a warning:
    Code:
    Warning: 3596: Duplicate variable definition.
    Last edited by szymek.k3; 03-07-2012 at 05:19 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center