2009-11-17 6 views
1

로더를 사용하여 외부 swf 파일을로드하고이를 고정 치수면 스프라이트 오브젝트처럼 고정 된 영역에 표시하려고했습니다. 그리고 swf 파일의 정확한 크기를 알지 못합니다. 단지 고정 된 영역에 맞추기를 원합니다. 그게 가능하니?어떻게 Actionscript 프로젝트에서 외부 swf의 차원을 변경할 수 있습니까?

코드 :

var loader:Loader = new Loader(); 
loader.load(new URLRequest("some path")); 
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler); 
function completeHandler(e:Event):void 
{ 
    var loaderinfo:LoaderInfo = event.target as LoaderInfo; 
    loaderinfo.content.width = 300; 
    loaderinfo.content.height = 300; 
    loaderinfo.content.x = 0; 
    loaderinfo.content.y = 0;//note that this works for displaying picture, but not for swf 
    thePanel.stage.addChild(loader); 
} 

은 내가 SWF 패널의 영역에 맞게합니다. 어떻게해야합니까?

답변

0

loaderInfo.content.height 대신 loaderInfo.loader.height을 시도하십시오. 이 여전히 당신을 위해 작동하지 않는 경우

,이 시도 :

var container:Sprite = new Sprite(); 
container.addChlid(loaderInfo.loader); 
container.width = 300; 
container.height = 300; 
thePanel.addChild(container) 

을 ... 당신의하면 Event.COMPLETE 리스너에.

+0

아직 작동하지 않으므로 불가능한 임무라면 의심 스럽습니다. 또는 우리는 이것을 위해 재래식 무기를 사용할 수 없습니다 ... – user198816

0
addChild(loader); //you can add it, as it is kind of proxy display object container 
function completeHandler(e:Event):void { 
    loader.width = 300; 
    loader.height = 300; 
    loader.x = 0; 
    loader.y = 0; 
} 
+1

시도했지만, 작동하지 않았습니다. – user198816