[Flashcoders] how to access mcs dinamically

2005-10-28 Thread Jorge Rego

Hi list,

I have some MCs named mc1, mc2, mc3 ...
I'm trying to access them like this: 


mc[number].someProperty ... but no luck!

How can this be done!?

Jorge Rego
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] how to access mcs dinamically

2005-10-28 Thread Roman Blöth
Jorge Rego wrote:

 Hi list,

 I have some MCs named mc1, mc2, mc3 ...
 I'm trying to access them like this:
 mc[number].someProperty ... but no luck!

 How can this be done!?

just do it like this:

[mc_+number].someProperty - when referencing mc's by name you have to
put it in square brackets...


regards,
roman.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] how to access mcs dinamically

2005-10-28 Thread Ian Thomas
this[mc+number].someProperty

(assuming 'this' is the current timeline)

On 10/28/05, Jorge Rego [EMAIL PROTECTED] wrote:

 Hi list,

 I have some MCs named mc1, mc2, mc3 ...
 I'm trying to access them like this:

 mc[number].someProperty ... but no luck!

 How can this be done!?

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] how to access mcs dinamically

2005-10-28 Thread Kent Humphrey


On 28 Oct 2005, at 11:08, Jorge Rego wrote:


Hi list,

I have some MCs named mc1, mc2, mc3 ...
I'm trying to access them like this:
mc[number].someProperty ... but no luck!

How can this be done!?


I use eval()

eval(mc+i).someProperty

where i is some number

perhaps a more correct way would be to generate the mc name into a  
variable, and then use the variable?


tempVariable = eval(mc+i);
tempVariable.someProperty
tempVariable.someOtherProperty
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] how to access mcs dinamically

2005-10-28 Thread Cedric Muller

[mc+number].someProperty

Cedric


Hi list,

I have some MCs named mc1, mc2, mc3 ...
I'm trying to access them like this:
mc[number].someProperty ... but no luck!

How can this be done!?

Jorge Rego
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] how to access mcs dinamically

2005-10-28 Thread Kent Humphrey


On 28 Oct 2005, at 11:08, Roman Blöth wrote:

[mc_+number].someProperty - when referencing mc's by name you  
have to

put it in square brackets...



Cool, you learn something everyday on here :

Goodbye eval()...

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] how to access mcs dinamically

2005-10-28 Thread Jorge Rego

Thanks all! :-)

Just curious about this,

if i want to access nested MCs normally i do it like this


theParentOfYourMCs.mc1.someProperty (with dots in between)


but in the descrived situation i must ommit the dot to get it to work, why's 
that!??



theParentOfYourMCs[ mc + number ].someProperty


Jorge Rego



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] how to access mcs dinamically

2005-10-28 Thread Mark Winterhalder
 but in the descrived situation i must ommit the dot to get it to work, why's
 that!??

because there are two ways of accessing a property (the parent has a
property named mc1 that references a movieclip). one way is to use a
dot, the other to use a string (i.e. a variable of type String or a
literal string foo) inside []s.

so, those three are the same thing:

- myObject.myProperty;

- myObject[ myProperty ];

- var prop:String = myPro + perty;
  myObject[ prop ];

you can even call methods:

trace( Math[ random ]() );

hth,
mark


On 10/28/05, Jorge Rego [EMAIL PROTECTED] wrote:
 Thanks all! :-)

 Just curious about this,

 if i want to access nested MCs normally i do it like this

  theParentOfYourMCs.mc1.someProperty (with dots in between)

 but in the descrived situation i must ommit the dot to get it to work, why's
 that!??

  theParentOfYourMCs[ mc + number ].someProperty

 Jorge Rego



 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



--
http://snafoo.org/
jabber: [EMAIL PROTECTED]
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders