naming and using variables via loop

  • sara.s
  • Newbie
  • Newbie
  • sara.s
  • Posts: 13

Post 3+ Months Ago

hi every body
I have a problem in naming movieClips, I want to make some movieClips via a number.
but when I create it, I can not call them.
take a look on the loadMovie line, where I write name+i. I don't know how it can understand in the loop, name1, name2 and so on...

for (i=1; i<= number; i++) {
this.createEmptyMovieClip("name"+i, this.getNextHighestDepth());
loadMovie(name+i , mc_place);
}
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • krismeister
  • Graduate
  • Graduate
  • krismeister
  • Posts: 202

Post 3+ Months Ago

Your forgot the apostrophes around 'name' in loadMovie().

I suppose mc_place is a URL?

Kris
  • sara.s
  • Newbie
  • Newbie
  • sara.s
  • Posts: 13

Post 3+ Months Ago

mc_place is a movieClip, but what if I want to create a new movieClip inside of "name"+i ?
I know it doesn't work :
"name"+i . createEmptyMovieClip("mc_inside"+i , this.getNextHighestDepth());

what should I do :-?
  • krismeister
  • Graduate
  • Graduate
  • krismeister
  • Posts: 202

Post 3+ Months Ago

movieParent["string of movie name"];

Code: [ Select ]
this.createEmptyMovieClip("name"+i, this.getNextHighestDepth());

//this is the piece you want
var movieICreated:MovieClip = this["name"+i];

movieICreated.loadMovie('aURL.swf');
  1. this.createEmptyMovieClip("name"+i, this.getNextHighestDepth());
  2. //this is the piece you want
  3. var movieICreated:MovieClip = this["name"+i];
  4. movieICreated.loadMovie('aURL.swf');


Does that answer your question?
  • sara.s
  • Newbie
  • Newbie
  • sara.s
  • Posts: 13

Post 3+ Months Ago

horaaaaaaa \:D/
thank you so much for your help :)

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 6 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.