#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Location
    France
    Posts
    198
    Rep Power
    14

    passing frame numbers between pages


    Hi,

    I have a movie menu in index.html:

    a.
    b.

    when a user clicks a. we goto a frame which contains the following:

    a.
    1
    2
    3
    b.

    so the menu opens up.

    However if at the same time we load in a new page (a.html) which contains this movie the command to goto that frame is lost and so I only see

    a.
    b.

    How do I pass the goto frame x to the movie in the next page?

    I t sounds simple enough but it has me stumped. In php I would simply append a variable to the end of the url

    a.php?myvariable='frame_x'

    Any help would be appreciated. I'm using Flash 5

    Thanks

    Bob
  2. #2
  3. No Profile Picture
    flash junkie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    CO, USA
    Posts
    172
    Rep Power
    12
    hello,

    you can append the .swf embedding just like a .php file.

    mymovie.swf?x=5

    x will be assigned 5 in the timeline of mymovie.swf

    hope that helps,

    bret
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Location
    France
    Posts
    198
    Rep Power
    14

    Further explanation


    Hi,

    Ok that's promising but I have a question or 2

    1. The movie is in an html doc so the getURL is foo.html not foo.swf so how does this work with and html doc that has the movie embedded?

    2. The frames are named so how would the appending work here. If I have a Frame called menu_a_open and want to go to this part of the movie when I click on a. how would I append the URL?

    Thanks for your help.

    Bob
  6. #4
  7. No Profile Picture
    flash junkie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    CO, USA
    Posts
    172
    Rep Power
    12
    you would have to edit your embed tag. It has an embed tag and an object tag by default (for netscape and IE). look at your source and where the src attribute is, something.swf just append it there. if you need to pass in different variables, then you might consider writing the page dynamically with those variables or using javascript nad getURL/FSCommands to communicate with the browser. Frames are tricky to deal with whilst passing variables in, but if you specify a different .html file, you can embed different variables into the .swf in the embed tag.

    hope that makes sense,

    bret
  8. #5
  9. No Profile Picture
    flash junkie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    CO, USA
    Posts
    172
    Rep Power
    12
    and i think i mistook frames in flash for frames in html .. if you have frames in html, you can just use the same method. In the first frame of your movie:

    movie.swf:
    if(frameVariable){
    gotoAndStop(frameVariable);
    } else {
    stop();
    //this code would stop


    movie.swf?frameVariable=navigation1
    if(frameVariable){
    gotoAndStop(frameVariable);
    } else {
    stop();
    //this code would go to the frame "navigation1"

    make more sense?

    bret
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Location
    France
    Posts
    198
    Rep Power
    14

    Makes Sense


    Hi,

    Thanks for your help. It all makes sense but the solution looks complex.

    If I construct my site using 2 (html) frames and have the movie/menu in (say) the left frame and I use

    on (release) {
    gotoAndStop ("frame_name");
    }
    on (release) {
    getURL (apage.html, _content);
    }

    in the movie.

    When the user clicks on the button to which this action is attached then the movie goes to (frame_name) and apage.html loads into the content window. All works fine.

    What I want is the same result but I want to eliminate (html) frames. So I need the movie loaded in the first page to tell the movie in the second page to go to (frame_name) when it loads.

    In just the same way as I would using a bookmark in html:

    <A href="apage.html#bookmark5">user click this link</A>

    This would load apage.html and take me to bookmark5 on the page.

    Flash cannot it seems even duplicate this simple function (ie pass a bookmark to an html page). Also it cannot pass a variable from one movie to another without utilising Javascript or php.

    Seems pretty limited. Say I wanted to have someone pick a color and then load in a movie with text displayed in that colour?

    I'd simply do

    <?php

    echo "<A href='apage.php?color=red'>click here for red text</A>";

    ?>

    and then in apage.php I'd write

    <?php

    if (color =='red')

    {
    echo "<FONT COLOR='Red'>This text in red</FONT>";
    }

    else

    {
    echo "Normal text";
    }
    ?>

    Flash doesn't seem to able to pass the variable color=red from a movie embedded in one page to another movie embedded in a second page.

    Is this for real?

    Thanks for your thoughts anyway.
  12. #7
  13. No Profile Picture
    flash junkie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    CO, USA
    Posts
    172
    Rep Power
    12
    okay, you would probably want to use FlashVars. FlashVars are parameters in the Object/Embed Tag... they are created prior to the first frame of the flash movie but can be utilised in the movie. But if you are trying to pass variables between movies on the same html page (or another frame) it's impossible without javascript. Even with javascript, you have to use the SetVariable method, which is not cross platform... it is a very large weakness in Flash though, you're correct...

    here's what macromedia has to say about FlashVars

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

    a possible solution is to make your whole page flash.. then you could control everything... (and on a side note, with your code, you can just use one on(release function)

    on (release) {
    gotoAndStop ("frame_name");
    getURL (apage.html, _content);
    }

    bret

IMN logo majestic logo threadwatch logo seochat tools logo