Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

array of class

Status
Not open for further replies.

2much4u

Technical User
Jul 4, 2005
8
SK
hello. i'm just an actionscript beginner so sorry for a dumb question...

i'm trying to use an array of my own classes. the class is called hostitel and works well - i have tested it. the array is called hostitelia

the definition is this:

var hostitelia:Array;
hostitelia[1] = new hostitel(hostitel1,10);
hostitelia[2] = new hostitel(hostitel2,10);
hostitelia[3] = new hostitel(hostitel3,10);
.
.
.


so far everything works well - the initial function runs.

problem comes here:

hostitelia[10].posun();

there's no error message, however, the function posun() won't run

if this is a wrong way of defining an array of class, what would be the right way than?

thanks!
 
so i found the solution - push

crazy
 
ok, back again with a new problem...

i'm using more object of the same class. like this:
pris = new prisavka(prisavka1,10);
pris2 = new prisavka(prisavka2,10);


it has instances like this:
public var meno:String;
public var poziadavky : Array = new Array();


i can set different names for pris and pris2 but change in the array poziadavky affects both, pris and pris2!

why?

thx
 
don't bother, solved... tricky though

class prisavka extends MovieClip{
public var poziadavky : Array;

public function prisavka() {
poziadavky = new Array();
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top