2013-08-30 5 views
0

이미지를 클릭 할 때로드되는 비디오가 있습니다. 비디오가 자동 재생되지 않으므로 두 번 클릭해야합니다. 이미지를 클릭하면이 비디오가 자동 재생됩니다. 사전swfobject로 swf 비디오 자동 시작

<tr> 
    <td class="filmbodyplay" height="50" align="right" valign="top"> 
     <a href="#" onclick="playMovie(this, 'https://www.capcomfcu.org/images/stories/security-center/swf/phishing.swf');" > 
      <img src="https://www.capcomfcu.org/images/stories/security-center/phishing.jpg" border="0" alt="play" /> 
     </a> 
    </td> 
</tr> 
<script type="text/javascript"> 
swfobject.registerObject("FlashID"); 
</script> 

헤더 코드

<script src="Scripts/swfobject_modified.js" type="text/javascript"></script> 
<script type="text/javascript"> 
function playMovie(a, href) { 

    // remove element if exists 
    var container = document.getElementById("playing"); 
    var flash_movie = document.getElementById("flash_movie"); 

    if(flash_movie) { 
     container.removeChild(flash_movie); 
    } 

    // create new element 
    var embed = document.createElement("EMBED"); 
    embed.setAttribute("allowFullScreen", "true"); 
    embed.setAttribute("autostart", "true"); 
    embed.setAttribute("src", href); 
    embed.setAttribute("type", "application/x-shockwave-flash"); 
    embed.setAttribute("width", "480"); 
    embed.setAttribute("height", "360"); 
    embed.setAttribute("id", "flash_movie"); 

    // clear out the cell 
    cell = a.parentNode; 
    cell.id = 'playing'; 

    while(cell.hasChildNodes()) { 
     cell.removeChild(cell.firstChild); 
    } 

    // insert the element into the cell 
    cell.appendChild(embed); 

} 


</script> 

답변

0

감사 true로 기본값을 로딩 플레이 (http://helpx.adobe.com/flash/kb/flash-object-embed-tag-attributes.html)는 즉시 재생을 시작하는 embed 태그를 속성을 사용할 때 같은데,하지만. 당신의 SWF가 메인 타임 라인에 로더를 가지고 있는지 궁금 해서요. 자동으로 재생을 시작하기 위해 액션 스크립트를 배치해야합니다.

+0

자동 시작, 자동 재생, 재생을 사용해 보았지만 아무 것도 작동하지 않았습니다. 이 작업을 수행하는 가장 좋은 방법은 프리 로더를 만드는 것이지만 원래 플래시 파일에 액세스 할 수는 없다는 것을 알고 있습니다. 난이 SWF 파일과 제한된 자바 스크립트 지식 만 가지고있다. – user2733112