을 사용하여 이미지를로드하면 최근 ActionScript 3을 배우기 시작했으며 이미 질문이 있습니다. 질문이 동일하게 유지됩니다. Loader.load (URLRequest) 객체를 사용하여 그림을 업로드하고 있습니다. 정상적으로 사진을로드하여 표시했습니다. 그러나 이미지 높이와 너비의 속성 값을 읽는 것은 불가능합니다. 대신 0을 발행합니다. 즉,이 작업을 수행한다 : URLRequest
var loader:Loader=new Loader();
var urlR:URLRequest=new URLRequest("Image.jpg");
public function main()
{
loader.load(urlR);
var h:Number = loader.height;// here instead of the width of the image of h is set to 0
// And if you do like this:
DrawText(loader.height.toString(10), 50, 50); // Function which draws the text as defined below
// 256 is displayed, as necessary
}
private function DrawText(text:String, x:int, y:int):void
{
var txt:TextField = new TextField();
txt.autoSize = TextFieldAutoSize.LEFT;
txt.background = true;
txt.border = true;
txt.backgroundColor = 0xff000000;
var tFor:TextFormat = new TextFormat();
tFor.font = "Charlemagne Std";
tFor.color = 0xff00ff00;
tFor.size = 20;
txt.x = x;
txt.y = y;
txt.text = text;
txt.setTextFormat(tFor);
addChild(txt);
}
아마 값이 특수 기능을 통해 얻을 수 있어야 속성,하지만 책 K.Muka "괴로움을위한 액션 스크립트 3"에서 그렇게 할 필요가 있다고 말한다. 이 문제를 해결하도록 도와주세요. 미리 감사드립니다.