동적 스프라이트 개체의 중심에 이미지 크기를 가져 오려고하지만 height 및 widh 속성에 0이 표시됩니다. 이미지 크기를 얻으려고 나를 도울 수 있습니까? 나는 이미지 컨트롤의 다양한 속성을 사용하여 시도했지만 치수를 얻고 있습니다. 아래의 코드를 볼 수와 인라인의 값은flex 4 이미지 크기
MXML 코드 코멘트하십시오 :
이<mx:Image id = "imgActive" visible="false" />
이벤트 핸들러 : 이미지의 소스를 설정하면
private function addImageHandler(e:MyCustomeEve){
imgActive.source = e.imageUrl;
imgActive.visible = true;
GAME_STATUS = "ITEM_SELECTED";
trace(imgActive.width,
imgActive.height, // 0
imgActive.contentHeight, // 0
imgActive.contentWidth, // NaN
imgActive.content.width, // error because imgActive.content is null
imgActive.content.height // error because imgActive.contentis null);
imgActive.cacheAsBitmap = true;
}
당신이 듣고있는 이벤트가 무엇입니까? – Kodiak