0
我正在尝试使用ActionScript为图像添加链接。无论如何,我都看不到链接。下面是我的代码,你能提出建议我做错了什么。我正在尝试在图像上添加链接
<?xml version="1.0" encoding="utf-8"?>
<mx:Application creationComplete="application1_creationCompleteHandler(event)" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600">
<mx:Script>
<![CDATA[
import mx.controls.Button;
import mx.controls.Image;
import mx.events.FlexEvent;
protected function application1_creationCompleteHandler(event:FlexEvent):void
{
var but:Button = new Button();
but.label = "BUT";
uic.addChild(but);
var dollLoader:Loader=new Loader();
dollLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, dollCompleteHandler);
var dollRequest:URLRequest = new URLRequest("http://www.google.com/intl/en_ALL/images/logo.gif");
dollLoader.load(dollRequest);
uic.addChild(dollLoader);
}
private function dollCompleteHandler(event:Event):void
{
}
]]>
</mx:Script>
<mx:UIComponent id="uic" width="100%" height="100%">
</mx:UIComponent>
</mx:Application>
尝试设置dollLoader'的'尺寸太大。使用'UIComponent'作为父容器可以给出意想不到的结果。如果将'UIComponent'更改为'Canvas'或'VBox',会发生什么? – 2010-04-15 21:13:13
只需设置宽度和高度....解决了问题。 but.width = 100; but.height = 100; 谢谢 – firemonkey 2010-04-15 22:27:33