dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: how to swap/change stage instances with library MCs

  1. #1
    Senior Member
    Join Date
    Aug 2007
    Posts
    121

    Question how to swap/change stage instances with library MCs

    i am working om a navigation that should change/swap some instances clip to other ones from the library. (all of theem same dimensions...)

    a variable is set by navigation buttons. (var = position)

    Code:
    Position=10
    gotoAndStop(Position)
    i want the script to change/swap the instance "placeholder" which is on stage and in the same frame.

    Code:
    if 
    position = 10
    gotoAndstop(position)
    "placeholder" = MC_libraryitem01
    else if
    position = 11
    gotoAndstop(position)
    "placeholder" = MC_libraryitem02
    ...
    is there any way like that?

  2. #2
    Senior Member Computer Dork's Avatar
    Join Date
    Mar 2001
    Location
    St. Louis
    Posts
    1,026
    If you are working in as2, use attachMovie();

    if you are working in as3, and placeholder is an empty mc that will simply hold all of your loaded library items, use this:

    (assuming you have linkage class names all set up on your library items, and they all extend flash.display.MovieClip)

    import flash.utils.getDefinitionByName;
    var myLibraryItem:Class = getDefinitionByName("MC_libraryitem01") as Class;
    var myNewItem:MovieClip = new myLibraryItem();
    placeHolder.addChild(myNewItem);

  3. #3
    Senior Member
    Join Date
    Aug 2007
    Posts
    121
    i think i need a different method here!

    is there any way to change the instance name of used MCs??


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