首页 > 代码库 > 层路径

层路径

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>

</body>
<style type="text/css">
<!--
#Layer1 {
 position:absolute;
 left:449px;
 top:106px;
 width:560px;
 height:321px;
 z-index:1;
}
-->
</style>
<script type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=http://www.mamicode.com/x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=http://www.mamicode.com/a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=http://www.mamicode.com/x.src; x.src=a[i+2];}
}

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

function MM_timelinePlay(tmLnName, myID) { //v1.2
  //Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Macromedia, Inc. All rights reserved.
  var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,propNum,theObj,firstTime=false;
  if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time
  tmLn = document.MM_Time[tmLnName];
  if (myID == null) { myID = ++tmLn.ID; firstTime=true;}//if new call, incr ID
  if (myID == tmLn.ID) { //if Im newest
    setTimeout(‘MM_timelinePlay("‘+tmLnName+‘",‘+myID+‘)‘,tmLn.delay);
    fNew = ++tmLn.curFrame;
    for (i=0; i<tmLn.length; i++) {
      sprite = tmLn[i];
      if (sprite.charAt(0) == ‘s‘) {
        if (sprite.obj) {
          numKeyFr = sprite.keyFrames.length; firstKeyFr = sprite.keyFrames[0];
          if (fNew >= firstKeyFr && fNew <= sprite.keyFrames[numKeyFr-1]) {//in range
            keyFrm=1;
            for (j=0; j<sprite.values.length; j++) {
              props = sprite.values[j];
              if (numKeyFr != props.length) {
                if (props.prop2 == null) sprite.obj[props.prop] = props[fNew-firstKeyFr];
                else        sprite.obj[props.prop2][props.prop] = props[fNew-firstKeyFr];
              } else {
                while (keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]) keyFrm++;
                if (firstTime || fNew==sprite.keyFrames[keyFrm-1]) {
                  if (props.prop2 == null) sprite.obj[props.prop] = props[keyFrm-1];
                  else        sprite.obj[props.prop2][props.prop] = props[keyFrm-1];
        } } } } }
      } else if (sprite.charAt(0)==‘b‘ && fNew == sprite.frame) eval(sprite.value);
      if (fNew > tmLn.lastFrame) tmLn.ID = 0;
  } }
}

function MM_initTimelines() { //v4.0
    //MM_initTimelines() Copyright 1997 Macromedia, Inc. All rights reserved.
    var ns = navigator.appName == "Netscape";
    var ns4 = (ns && parseInt(navigator.appVersion) == 4);
    var ns5 = (ns && parseInt(navigator.appVersion) > 4);
    var macIE5 = (navigator.platform ? (navigator.platform == "MacPPC") : false) && (navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4);
    document.MM_Time = new Array(1);
    document.MM_Time[0] = new Array(3);
    document.MM_Time["Timeline1"] = document.MM_Time[0];
    document.MM_Time[0].MM_Name = "Timeline1";
    document.MM_Time[0].fps = 15;
    document.MM_Time[0][0] = new String("sprite");
    document.MM_Time[0][0].slot = 1;
    if (ns4)
        document.MM_Time[0][0].obj = document["Layer1"];
    else if (ns5)
        document.MM_Time[0][0].obj = document.getElementById("Layer1");
    else
        document.MM_Time[0][0].obj = document.all ? document.all["Layer1"] : null;
    document.MM_Time[0][0].keyFrames = new Array(1, 13, 18, 19, 28, 40, 41, 42, 48, 56, 58, 59, 60, 61, 65, 80);
    document.MM_Time[0][0].values = new Array(2);
    if (ns5 || macIE5)
        document.MM_Time[0][0].values[0] = new Array("95px", "100px", "106px", "111px", "116px", "121px", "126px", "132px", "136px", "141px", "145px", "149px", "153px", "160px", "166px", "170px", "174px", "178px", "184px", "188px", "192px", "197px", "202px", "207px", "212px", "218px", "224px", "229px", "233px", "238px", "242px", "246px", "250px", "255px", "258px", "262px", "265px", "268px", "271px", "274px", "275px", "278px", "280px", "283px", "286px", "290px", "294px", "298px", "302px", "306px", "310px", "315px", "319px", "323px", "326px", "329px", "333px", "335px", "336px", "337px", "337px", "344px", "353px", "363px", "376px", "380px", "384px", "389px", "393px", "398px", "402px", "407px", "413px", "418px", "423px", "428px", "433px", "439px", "444px", "449px");
    else
        document.MM_Time[0][0].values[0] = new Array(95,100,106,111,116,121,126,132,136,141,145,149,153,160,166,170,174,178,184,188,192,197,202,207,212,218,224,229,233,238,242,246,250,255,258,262,265,268,271,274,275,278,280,283,286,290,294,298,302,306,310,315,319,323,326,329,333,335,336,337,337,344,353,363,376,380,384,389,393,398,402,407,413,418,423,428,433,439,444,449);
    document.MM_Time[0][0].values[0].prop = "left";
    if (ns5 || macIE5)
        document.MM_Time[0][0].values[1] = new Array("110px", "117px", "123px", "130px", "136px", "143px", "150px", "156px", "162px", "168px", "173px", "178px", "183px", "192px", "199px", "204px", "209px", "214px", "224px", "221px", "217px", "213px", "209px", "204px", "198px", "192px", "185px", "178px", "172px", "165px", "157px", "150px", "142px", "134px", "127px", "120px", "114px", "108px", "103px", "98px", "102px", "111px", "117px", "124px", "132px", "141px", "151px", "161px", "169px", "177px", "185px", "194px", "201px", "208px", "215px", "220px", "228px", "233px", "236px", "237px", "238px", "233px", "227px", "219px", "205px", "200px", "195px", "189px", "183px", "177px", "171px", "164px", "157px", "150px", "142px", "135px", "128px", "120px", "113px", "106px");
    else
        document.MM_Time[0][0].values[1] = new Array(110,117,123,130,136,143,150,156,162,168,173,178,183,192,199,204,209,214,224,221,217,213,209,204,198,192,185,178,172,165,157,150,142,134,127,120,114,108,103,98,102,111,117,124,132,141,151,161,169,177,185,194,201,208,215,220,228,233,236,237,238,233,227,219,205,200,195,189,183,177,171,164,157,150,142,135,128,120,113,106);
    document.MM_Time[0][0].values[1].prop = "top";
    if (!ns4) {
        document.MM_Time[0][0].values[0].prop2 = "style";
        document.MM_Time[0][0].values[1].prop2 = "style";
    }
    document.MM_Time[0][1] = new String("behavior");
    document.MM_Time[0][1].frame = 80;
    document.MM_Time[0][1].value = "http://www.mamicode.com/MM_popupMsg(‘来打我啊!‘)";
    document.MM_Time[0][2] = new String("behavior");
    document.MM_Time[0][2].frame = 81;
    document.MM_Time[0][2].value = "http://www.mamicode.com/MM_timelineGoto(‘Timeline1‘,‘1‘)";
    document.MM_Time[0].lastFrame = 81;
    for (i=0; i<document.MM_Time.length; i++) {
        document.MM_Time[i].ID = null;
        document.MM_Time[i].curFrame = 0;
        document.MM_Time[i].delay = 1000/document.MM_Time[i].fps;
    }
}

function MM_timelineGoto(tmLnName, fNew, numGotos) { //v2.0
  //Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Macromedia, Inc. All rights reserved.
  var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,lastKeyFr,propNum,theObj;
  if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time
  tmLn = document.MM_Time[tmLnName];
  if (numGotos != null)
    if (tmLn.gotoCount == null) tmLn.gotoCount = 1;
    else if (tmLn.gotoCount++ >= numGotos) {tmLn.gotoCount=0; return}
  jmpFwd = (fNew > tmLn.curFrame);
  for (i = 0; i < tmLn.length; i++) {
    sprite = (jmpFwd)? tmLn[i] : tmLn[(tmLn.length-1)-i]; //count bkwds if jumping back
    if (sprite.charAt(0) == "s") {
      numKeyFr = sprite.keyFrames.length;
      firstKeyFr = sprite.keyFrames[0];
      lastKeyFr = sprite.keyFrames[numKeyFr - 1];
      if ((jmpFwd && fNew<firstKeyFr) || (!jmpFwd && lastKeyFr<fNew)) continue; //skip if untouchd
      for (keyFrm=1; keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]; keyFrm++);
      for (j=0; j<sprite.values.length; j++) {
        props = sprite.values[j];
        if (numKeyFr == props.length) propNum = keyFrm-1 //keyframes only
        else propNum = Math.min(Math.max(0,fNew-firstKeyFr),props.length-1); //or keep in legal range
        if (sprite.obj != null) {
          if (props.prop2 == null) sprite.obj[props.prop] = props[propNum];
          else        sprite.obj[props.prop2][props.prop] = props[propNum];
      } }
    } else if (sprite.charAt(0)==‘b‘ && fNew == sprite.frame) eval(sprite.value);
  }
  tmLn.curFrame = fNew;
  if (tmLn.ID == 0) eval(‘MM_timelinePlay(tmLnName)‘);
}
//-->
</script>
<body onl oad="MM_preloadImages(‘e0ac7c5agw1egg386mpo1j20nm0lt76t[1].jpg‘);MM_timelinePlay(‘Timeline1‘)"><div id="Layer1" style="left: 449px; top: 106px;"><a href="http://www.mamicode.com/#" onm ouseout="MM_swapImgRestore()" onm ouseover="MM_swapImage(‘Image1‘,‘‘,‘e0ac7c5agw1egg386mpo1j20nm0lt76t[1].jpg‘,1)"><img src="http://www.mamicode.com/e0ac7c5agw1ejuqf798ugj20rs0go78b[1].jpg" name="Image1" width="464" height="262" border="0" id="Image1" /></a></div>
</html>

层路径