dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [RESOLVED] attaching movies to array & target mc

Hybrid View

  1. #1
    Junior Member
    Join Date
    May 2003
    Posts
    24

    resolved [RESOLVED] attaching movies to array & target mc

    Hi

    I have my code in the root first frame.
    I would like to know is it posible to attach movie from the library to array, but tu have that array created in some movie clip so the path to the newly created instance would be _root.some_movie_clip.array[i].

    the code goes like this:
    Code:
    for (i=0; i<11; i++){
    	displayed_icons[i] = attachMovie("my_library_mc"+i, "new_mc_"+i, this.getNextHighestDepth());
    }
    and it works but it creates movie clips with paths like _root.new_mc_1...
    and I need them to be in one movie clip that I've created on the stage (_root.some_movie_clip.new_mc_1, _root.some_movie_clip.new_mc_2...)

    I've tried things like:
    Code:
    _root.some_movie_clip.displayed_icons[i] = attachMovie("my_library_mc"+i, "new_mc_"+i, this.getNextHighestDepth());
    but this doesn't work, it is not putting new movieclips in some_movie_clip

    any toughts?

  2. #2
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    maybe Im not understanding,
    but I think it would be more along the lines like:

    var newClip = _root.some_movie_clip.displayed_icons[i].attachMovie();

    =)

  3. #3
    Junior Member
    Join Date
    May 2003
    Posts
    24
    ok I've solved it like this:
    Code:
    displayed_icons[i] = some_movie_clip.attachMovie("my_library_mc"+i, "new_mc_"+i, some_movie_clip.getNextHighestDepth());
    it works fine now... the item_array now has movie clips in that looks like this:
    _root.some_movie_clip.new_mc_1
    and that was what I need. The problem was in the getNexHighestDepth part. Every clip has to have diferent depth, or my array will consist of only one from last loop iteration.

    bye

  4. #4
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    same thing I posted really...

    and yes you always have to have the same scope for the depth.


    glad it all worked out for ya.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center