2012-01-30 2 views
0

동일한 프레임이지만 동영상 클립에있는 다른 레이어에 두 개의 동영상 클립이 있습니다. 첫 번째 영화 클립이 정상적으로 재생됩니다. 그러나 두 번째 프레임은 단일 프레임으로 진행되지 않습니다. 아래에서 언급 한 코드는 배경 이미지가 포함 된 두 번째 영화 클립에 있습니다. 그리고이 코드를 제거하면 완전히 완벽하게 재생되므로이 코드가 문제의 원인이라고 생각합니다. 이 코드의 기능은 자동으로 브라우저 크기로 배경 이미지의 크기를 조정하는 것입니다. 전체 코드는 기본 타임 라인에서 정상적으로 작동했습니다. 그러나 동영상 클립 내부에서 코드를 이동하여 문제가 발생했습니다.2 개의 동영상 클립이 동시에 재생되지 않는 동영상 클립과 함께 같은 프레임에 위치합니다.

//set stage for FBF 
stage.align = "TL"; 
stage.scaleMode = "noScale"; 

//define dynamic aspect ratios 
var bg_mainHeight = bg_main.height/bg_main.width; 
var bg_mainWidth = bg_main.width/bg_main.height; 

//add event listener to the stage 
stage.addEventListener(Event.RESIZE, sizeListener); 

//conditional statement to account for various initial browswer sizes and proportions 
function scaleProportional():void { 
    if ((stage.stageHeight/stage.stageWidth) < bg_mainHeight) { 
     bg_main.width = stage.stageWidth; 
     bg_main.height = bg_mainHeight * bg_main.width; 
    } else { 
     bg_main.height = stage.stageHeight; 
     bg_main.width = bg_mainWidth * bg_main.height; 
    }; 
} 

//center bg_mainture on stage 
function centerbg_main():void { 
    bg_main.x = stage.stageWidth/1000; 
    bg_main.y = stage.stageHeight/1000; 
} 

// make listener change bg_mainture size and center bg_mainture on browser resize 
function sizeListener(e:Event):void { 
    scaleProportional(); 
    centerbg_main(); 
} 

//run initial locations and size 
scaleProportional(); 
centerbg_main(); 
+0

이유가 무엇입니까? stage.stageWidth/1000; – vulkanino

+0

stage.stageWidth/2로 설정되었습니다. 처음에는 bg 이미지가 제대로 정렬되지 않았습니다. 전체 코드는 기본 타임 라인에서 정상적으로 작동했습니다. 그러나 동영상 클립 내부에서 코드를 이동하여 문제가 발생했습니다. –

+0

동영상 클립 안에 (주로 유지 관리 목적으로) 씁니다. 'bg_main'은 무비 클립에 존재하지 않으며 오류가 발생할 수 있으므로 출력 콘솔을 확인하십시오. – Kodiak

답변

0

네, 일반적 경우 bg_main 동영상 클립이 그 중앙이 (가정 bg_main 무대에 직접 추가 된) 것 등록 포인트입니다 :

function centerbg_main():void { 
    bg_main.x = -stage.stageWidth/2; 
    bg_main.y = -stage.stageHeight/2; 
} 

또는 등록 포인트는 탑을 방치하면

function centerbg_main():void { 
    bg_main.x = 0; 
    bg_main.y = 0; 
} 

두 무비 클립에 인스턴스 이름이 올바르게 지정되었는지 확인할 수도 있습니다.

관련 문제