我添加了一個滾動窗格,然後我添加一個導出在一個精靈中的自定義影片剪輯,但是當我做所有這些時,然後點擊更新命令ScrollPane永遠不會更新,也不會顯示滾動條。Actionscript 3 ScrollPane內容不更新滾動條
的代碼如下:
function doneLoad(e:Event):void {
trace("doneload");
var bm:Bitmap = e.target.content as Bitmap;
bm.smoothing = true;
bm.x = 20;
bm.y = 20;
bm.width = 80;
bm.height = 80;
shape1.addChild(getTextField("Helvetica",12,"0x31b1e1","left","Name:",120,10));
shape1.addChild(getTextField("Helvetica",12,"0xcccccc","left",user.name,120,28));
shape1.addChild(bm);
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE,doneLoad);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,loadingError);
sql.removeEventListener(SQLEvent.POST_COMPLETE,dataPostResponse);
scroll = new ScrollPane();
scroll.width = 320;
scroll.height = 300;
scroll.x = 0;
scroll.y = 140;
scroll.verticalScrollPolicy = ScrollPolicy.AUTO;
//scroll.verticalScrollPolicy = ScrollPolicy.ON;
shape1.addChild(scroll);
//var content:DisplayObject = new DisplayObject();
content = new Sprite();
var dd:mc_countryDP = new mc_countryDP();
content.addChild(dd);
dd.x = 0;
dd.y = 280;
//scroll.addChild(content);
scroll.source = content;
loader = null;
mc_user.visible = true;
//content.addEventListener(Event.COMPLETE, completeHandler);
scroll.update();
}
當您在此處指定新內容時,滾動窗格會更新。在這種情況下,update()的調用是無關緊要的,並不是問題的根源。您嘗試添加的內容可能不足以強制滾動條出現。嘗試更大的內容。 – BotMaster
我設置滾動高度爲100看看會發生什麼,滾動窗格顯示垂直滾動條,但無法找到添加到scroll.content – redoc01
的內容當我設置滾動高度爲300 – redoc01