A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: menu that knows what html page its on

  1. #1
    Junior Member
    Join Date
    Aug 2004
    Posts
    27

    menu that knows what html page its on

    i have a menu in an html website, is there any actionscript i can add to the menu, so that it knows what page it is loaded on and does something depending on which page it is on
    for example, to make it sound more clear i will set it out like this:

    if webpage=page1 play MC5
    if webpage=page2 play MC4

    somthing like that
    .note that i only put that up there as my own example, sort of as the script i need, of course it isnt reall and i made it up

    hope someone can help, much thanks

  2. #2
    Senior Member Shotsy247's Avatar
    Join Date
    Apr 2001
    Location
    Be there in a minute!
    Posts
    1,386
    Look into _url;

    _t
    I don't feel tardy.

  3. #3
    Junior Member
    Join Date
    Aug 2004
    Posts
    27
    thanks for answer,
    i dont mean to *****... but could you explain it a little bit?

    cheers

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    _url will only give you the address of the .swf
    To get the full url use the javascript 'window.location.href'

    gparis

  5. #5
    The Flashman earl223's Avatar
    Join Date
    Sep 2000
    Location
    Marikina City, Philippines
    Posts
    876
    or you can use backend scripts to pass the current page number to flash via QueryString...
    i eat actionscripts for breakfast

  6. #6
    Junior Member
    Join Date
    Aug 2004
    Posts
    27
    heheh thanks everyone! but since i know no backend scripts or JS then i will just copy the swf and change it slightly , and have the seperate swfs for each page, its only 2 pages so this wont take long and will slove my problems. thanks anway

  7. #7
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    here's an example, for you or anyone searching on that topic:

    The html (containing the query string, as earl223 suggested):
    PHP Code:
    <HEAD>
    <
    meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
    <
    TITLE>a</TITLE>
    <
    SCRIPT LANGUAGE="JavaScript">
    var 
    ad;
    adwindow.location.href;
    </
    script>
     
    </
    HEAD>
    <
    BODY bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <!-- 
    URL's used in the movie-->
    <!-- text used in the movie-->
    <script>
     document.write('
    <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
     document.write('
    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"');
    document.write(' 
    WIDTH="550" HEIGHT="400" id="a" ALIGN="">');
    document.write(' 
    <PARAM NAME=movie VALUE="a.swf?ad='+ad+'">');
    document.write(' 
    <PARAM NAME=quality VALUE=high>');
    document.write(' 
    <PARAM NAME=bgcolor VALUE=#FFFFFF>');

    document.write('<embed src="a.swf?ad='+ad+'" quality=high bgcolor=#FFFFFF  WIDTH="550" HEIGHT="400" NAME="movie" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
    document.write(' </EMBED>');
    document.write(' </OBJECT>');
    </
    script>

    </
    BODY>
    </
    HTML
    and an example in a flash file (set a dynamic var on _root with variable name 'ad')
    code:
    stop();
    path = "http://www.yourserver.com/";
    switch (ad) {
    case path :
    this.gotoAndStop(1);
    break;
    case path+"index.html" :
    this.gotoAndStop("label1");
    break;
    case path+"index2.html" :
    this.gotoAndStop("label2");
    break;
    case path+"index3.html" :
    this.gotoAndStop("label3");
    break;
    }



    gparis

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