actionscript 3 - Flash AS3 - 1046: Type was not found or was not a compile-time constant: -


i asked question other day , taught me fair bit display objects , stuff. have problem though.

this document class :

package  {      import flash.display.movieclip;     import flash.display.stage;      public class engine extends movieclip     {          public function engine()         {             var calling:callitems = new callitems(cat, bluknife)              stage.addchild(calling);          }      }  } 

cat , bluknife movieclips in library as3 linkage names.

now here callitems class

package  {      import flash.display.movieclip;     import flash.display.stage;     import flash.display.interactiveobject;       public class callitems extends movieclip{       public function callitems(enemy1, enemy2)     {         var knife:enemy1 = new enemy1();          this.addchild(knife);         knife.x = 200;           var ct:enemy2 = new enemy2();          this.addchild(ct);       }  }  } 

now problem when wasn't giving callitems arguments , instead making enemy1, cat , making enemy2, bluknife both of movieclips added stage expected. i'm trying make callitems take arguments can place different clips @ times i'm getting following error:

1046: type not found or not compile-time constant: enemy1. 1046: type not found or not compile-time constant: enemy2.

thanks everyone, appreciated

edit: did search site same error, don't understand problem in context, sorry!

the problem enemy1 not recognized compiler type (since variable name) when define var knife:enemy1. try casting more general type:

var knife:movieclip = new enemy1() movieclip; 

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -