Hi,
I'm trying to create a playing table mc, which would
act as a button (you click it in order to sit down and
play cards at that table), with 3 player mc's attached to it.
The player mc works fine for me - I call something like:
user_mc.update('3,Alex,avatar3.jpg');
and it will turn _visible and display my id, name and avatar.
For the table mc I'd like to call a public method with
the same name and that one should split the info_str
argument at newlines and call the above method on
each of the attached userX_mc's:
table_mc.update(1234, '3,Alex,avatar3.jpg' +
newline + '2,Lisa,avatar100.gif' + newline);
So here is my class for the table mc:
class Table extends MovieClip {
private var table_id:Number;
private var user0_mc:MovieClip;
private var user1_mc:MovieClip;
private var user2_mc:MovieClip;
function Table() {
stop();
// make this movie clip behave as a button
onRelease = function() { }
}
public function update(table_id:Number, info_str:String) {
this.table_id = id;
var info_array:Array = info_str.split(newline);
for (var i:Number = 0; i < 3; i++) {
if (info_str[i])
this['user' + i + '_mc'].update(info_str[i]);
}
}
}
Having 3 members called user0_mc, user1_mc and user2_mc
feels so awkward and additionally the this['user' + i + '_mc']
just doesn't work for some reason. So is there maybe a nicer way?
Thank you
I've looked through the archive, but "array" is a bad
keyword for a search...
Regards
Alex
--
http://preferans.de
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com