A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Getting UI on embedded movie to work

  1. #1
    Junior Member
    Join Date
    Oct 2004
    Posts
    2

    Getting UI on embedded movie to work

    I'm trying to make a photo website for myself. I have a main movie that launches a picture-viewer movie. Both movies work by themselves, but when I use the code below to load the picture viewer SWF into the main movie, the controls don't work.

    The non-working version is at:
    http://www.graysonschaffer.com/Grays...affer_new.html
    (click "portfolio" then "portraits")

    The working picture viewer is at:
    http://www.graysonschaffer.com/1.html

    I think this may have something to do with only the main timeline getting loaded, but I have no idea how to fix it.


    _root.container1.createEmptyMovieClip("container", 1);
    loadMovie("/"+_global.movieToPlay+".swf","container");
    container._x = -485 ;
    container._y = -345 ;

  2. #2
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    Look for any actionscript in the loaded movie (the one being loaded by the other movie) that uses _root, and change _root to this.

    A lot of scripts use _root to refer to the main timeline of the movie which contains the script, but when the movie is loaded by another movie, _root refers to the movie doing the loading, and this can cause scripts to break.

    For example, in this script:

    _root.blah = x;
    trace(blah);

    You will get different results if the movie is loaded, because _root.blah and blah are not the same thing, as they are when the movie is run standalone.

    In the sample you listed, something similar is happening with _root.container1 (it is referring to a non-existing movieclip which is attached to the loader movie, rather than the loadee movie). If you simply use

    container1 or this.container1 instead of _root.container1, it will probably work.

  3. #3
    Junior Member
    Join Date
    Oct 2004
    Posts
    2

    You are a god among mortals

    Thanks.

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