Naming Dynamic Movie Clip Instances

How to Name Movie Clip Dynamically at run time

Page 1 of 1

3 Replies - 8049 Views - Last Post: 01 September 2006 - 12:25 AM

#1 tonyb48  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 27-August 06

Naming Dynamic Movie Clip Instances

Posted 27 August 2006 - 07:57 PM

Hello,
I must load photos from a database at runtime. I thought to create empty movie clips then load them with the photos. I create the empty movie clips in a loop with:
var maxSize:Number = 50;
var indexPhotoArray:Array;
for (var i:Number = 0; i<maxSize; i++) {
var photoMC = this.createEmptyMovieClip("plane_index_photo_"+i+"_mc", i);
indexPhotoArray.push(photoMC);



When I look in the debugger, all 50 empty movie clips show up fine.
When I try to populate them in a second loop, it does not seem to work
The second loop goes:

_root.business_mc.business_ds.first();
for (var i:Number = 0; i < indexPhotoArray.length; i++) {
var z:String =_root.business_mc.business_ds.currentItem.Picture;
indexPhotoArray.loadMovie("http://www.tonybarre.com/directory/images/" + z);
_root.business_mc.business_ds.next();
}



If I replace this second loop with:
_root.business_mc.business_ds.first();
var z:String =_root.business_mc.business_ds.currentItem.Picture;
plane_index_photo_1_mc.loadMovie("http://www.tonybarre.com/directory/images/" + z);


I get the one photo. But, of course, I need the whole array.

I have tried to replace what I believe is the problem line with the following, but none work:
this[indexPhotoArray.pop()].loadMovie("http://www.tonybarre.com/directory/images/" + z);


indexPhotoArray[i].loadMovie("http://www.tonybarre.com/directory/images/" + z);


this["plane_index_photo_"+i+"_mc"].loadMovie("http://www.tonybarre.com/directory/images/" + z);



Thanks for any help you can provide.

Tony Barre

Is This A Good Question/Topic? 0
  • +

Replies To: Naming Dynamic Movie Clip Instances

#2 pioSko  Icon User is offline

  • still.dreaming
  • member icon

Reputation: 23
  • View blog
  • Posts: 1,888
  • Joined: 06-June 03

Re: Naming Dynamic Movie Clip Instances

Posted 29 August 2006 - 01:33 AM

indexPhotoArray.loadMovie("http://www.tonybarre.com/directory/images/" + z);


it seems like you are trying to load the picture into the Array, not the movieClip...
Was This Post Helpful? 0
  • +
  • -

#3 tonyb48  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 27-August 06

Re: Naming Dynamic Movie Clip Instances

Posted 29 August 2006 - 04:19 PM

Thank you. Now it works!
Was This Post Helpful? 0
  • +
  • -

#4 pioSko  Icon User is offline

  • still.dreaming
  • member icon

Reputation: 23
  • View blog
  • Posts: 1,888
  • Joined: 06-June 03

Re: Naming Dynamic Movie Clip Instances

Posted 01 September 2006 - 12:25 AM

No problemo.. see you around :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1