create object without instance name
hi
here problem , have hero shoot bullets , because of cant give objects instance names , wanna check if object on stage or not , easy when
i do var bullet:bullet = new bullet
if (bullet.stage){
addchild(bullet)
...
}
but problem when
addchild(new bullet())
i know , flash give them names how can check names??
if(???.stage)
thank you
there old joke along lines of... patient twists wrist around , tells doctor "it hurts when this"... doctor says "then don't that"
if need able target object, don't create in way makes difficult. if issue have alot of bullets, add instances array add them can target them thru array.
as far question goes, while can use following, not helping because object needs child in order able use it, , if child, has non-null stage property...
addchild(new bullet());
if(getchildat(numchildren-1).stage){
trace("yes child , has non-null stage property");
}
if want name property of object, right after create can use...
getchildat(numchildren-1).name;
but name property of object, string value.
More discussions in ActionScript 3
adobe
Comments
Post a Comment