A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: navigate with loaded movie

  1. #1
    Junior Member
    Join Date
    Nov 2001
    Posts
    24

    navigate with loaded movie

    Hi,
    I am trying to load an external movie (say movie B) into a movieclip object in movie A. Is it possible to navigate (ie loading and unloading movies) in movie A from the buttons created in movie B?
    Thanks in advance.
    Joe

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Yes, just reerence the _root in your actions.

    _root.MyOtherLoadedMC.gotoAndPlay(2);

    You can get from any movie to any movie, be it in another _level or 20 movieclips down in another movieclip.

    You can do it with absolute paths (_root) or relative.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Pellepiano...

    _root wont work from a movie loaded on another level! In that case you have to use _level0, otherwise you'll target the root level of the loaded movie itself on that other level.
    _root will only work from within container clips, but _level0 will work in both situations, so you should recommend using _level0 rather than _root, unless you're actually targeting the root level of a loaded movie on another level!

  4. #4
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    When different levels are involved you are correct,they are referenced with, _level. My last statement in the post was clearly misleading. Sorry.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  5. #5
    Member
    Join Date
    Dec 2001
    Location
    Netherlands
    Posts
    43

    Using _root or _level0 ????

    if you make a reference to a clip in movie A you can nest movie B in it and make a ref to its controller.

    example:

    movie A is loaded
    command in A to load movie B
    ref to movie A in movie B

    // create depth
    (this.level == undefined)? this.level = 1 : this.level;
    //create clipholder
    this.createEmptyMovieClip("clipholderA",level++);
    //loadmovie
    loadMovie("test.swf", this.clipholderA);
    this.clipholderA._x = this.clipholderA._y = 100


    //Or if clip is in Library (easier)
    this.attachMovie("testSymbol","clipholderB",level+ +,{controller:this})
    //now you can acces clipholderB bij its controller who is his parent
    trace(this.clipholderB.controller._name)
    Attached Files Attached Files

  6. #6
    Member
    Join Date
    Dec 2001
    Location
    Netherlands
    Posts
    43

    and this file

    put in the same dir/map as the fla
    Attached Files Attached Files

  7. #7
    Junior Member
    Join Date
    Nov 2001
    Posts
    24
    Thanks for the input people.

    Just one more thing I need to make sure, when I use attachmovie to load a menu (a movie clip from the library) into a empty movieclip. How do I use the newly loaded menu to navigate at _level0?

    Eg. Menu in the library = MovProductsMenu and the movie clip that the menu is loaded into = contents,

    To attach the menu when a button (Products) is pressed, I wrote:
    Products.onPress = function() {
    attachMovie( MovProductsMenu, "MovProductsMenu", 2 );
    contents.attachMovie("MovProductsMenu", "ProductsMenu",2);
    };

    Then when a button (Button1) inside the loaded menu is pressed:
    _level0.contents.MovProductsMenu.Button1.onPress = function() {
    loadMovie("swf/pic1.swf", "_level0.contents");
    };
    This doesn't seem to work. Please help.

  8. #8
    Member
    Join Date
    Dec 2001
    Location
    Netherlands
    Posts
    43
    try to get rid of those solid navigations...
    and work more with small functions in the movieclips itself it makes the code alot easier. in the library only a square and a clip called button2

    make sure that youve got the '' and "" right

    see the fla.

    // button on stage named button and a dynamic textfield named textfield

    this.level = (this.level==undefined) ? 1 : this.level;

    this.button.onRelease = function () {
    this._parent.callClip("Square", "square_mc");
    };
    //
    this.callClip = function(idname,newname){
    this.attachMovie (idname,newname,this.level++, {controller:this});
    }
    //
    this.doAction = function (text) {
    this.textfield.text = text
    };

    // in the library clip a button named button2:
    this.button2.onRelease = function(){
    this._parent.controller.doAction("hello")
    }

  9. #9
    Member
    Join Date
    Dec 2001
    Location
    Netherlands
    Posts
    43

    and the fla

    i keep forgetting this.
    Attached Files Attached Files

  10. #10
    Junior Member
    Join Date
    Nov 2001
    Posts
    24
    thanks alot

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