A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: going to frames/scenes in different movies?

Hybrid View

  1. #1
    Junior Member
    Join Date
    Aug 2002
    Posts
    12

    going to frames/scenes in different movies?

    Does anyone know how to go to a frame or scene of one movie from another movie? Like if you click a button in movie#2 it will go to scene 2 of movie 1, or frame 5 of movie 1, etc. ?
    thanks
    J

  2. #2
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    where are the movies in relation to each other? are they all loaded into the same instance of flash player (using loadMovie/loadMovieNum) or are they separate movies on a webpage?

    if that is the case you can use a local connection object

    http://www.macromedia.com/support/fl...connection.htm

    if they are in the same flash player you can target using actionscript, eg from a movie loaded into a movie clip in another movie you can target the main timeline (of the movie that did the loading) using

    _root.gotoAndPlay("framelabel");

    you'll have to add frame labels to the frames within your movie you want to be able to go to. you can't use scene names if the goto action has to target a different timeline.

    with movie in levels it is similar,

    _level1.gotoAndPlay(5);

    the movie in level1 to frame 5

  3. #3
    Junior Member
    Join Date
    Aug 2002
    Posts
    12
    The movies are currently all in the same folder and I was going to load each of them into the one browser window. Im using Flash 5 though, so is it still possible?

  4. #4
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    with flash 5 it can be done with the help of some javascript in the page the contains the movies,

    something like this,

    Code:
    <script type="text/javascript">
    function controlMovie(id, embedid, frame) {
        if (document.all || !document.getElementById) {
            window.document.id.GotoFrame(frame);
        } else {
            var obj = document.getElementById(embedid);
            obj.GotoFrame(frame);
        }
    }
    </script>
    then make sure you have an id attribute in the object tag

    id="something"

    in where the width and height attributes are, and also add

    name="something" swLiveConnect=true id="a_different_id"

    in the embed tag.
    (note the id in the embed tag is for Mozilla and it's variants, I don't have a copy of any of those browsers on this machine to test. but i think with that you can get the GotoFrame method by creating an object using document.getElementById on the embed tag, that is the "else" part of the function)

    then from flash this can be called by

    getURL("javascript:controlMovie('id_of_movie_to_co ntrol', 'embed_id_of_movie_to_control', 0);");

    where 0 is the frame number, note that GotoFrame(0) is the same as gotoAndPlay/Stop(1); from within flash.

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