*我有一些问题让我的照片在舞台上居中,我使用 Flash cs5 as3 UILoader,照片大小都是不同的,所以我尝试使用自由变换工具将 UILoader 注册点移动到顶部的中心,但是是根本不改变任何东西。我不想检查属性中的 ScaleContent,使这些照片质量很差。1000px x 700px 舞台高度,照片应为 400px 高。我该怎么办?
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.events.MouseEvent;
import flash.events.Event;
import fl.containers.UILoader;
import flash.text.TextField;
import flash.display.SimpleButton;
import fl.transitions.Tween;
import fl.transitions.TweenEvent;
import fl.transitions.easing.*;
stage.colorCorrection = ColorCorrection.ON;
var myImage:String = "smallWildlife/00.jpg";
var request:URLRequest = new URLRequest(myImage);
uiLoader.addEventListener(Event.COMPLETE, completeHandler);
uiLoader.addEventListener(ProgressEvent.PROGRESS, progressHandler);
uiLoader.load(request);
function progressHandler(event:ProgressEvent):void
{
status_txt.text = "Percentage Loaded:" + Math.round(event.target.percentLoaded);
}
function completeHandler(event:Event):void
{
uiLoader.x = stage.stageWidth/6 - uiLoader.content.width/6;
uiLoader.y = stage.stageHeight/100 - uiLoader.content.height/700;
new Tween(uiLoader,"rotationX",Elastic.easeOut,90,0,4,true);
}
next_btn.addEventListener(MouseEvent.CLICK, nextImage);
//variable is a container that holds some value...;
var imageNumber:Number = 0;
function checkNumber():void
{
next_btn.visible = true;
back_btn.visible = true;
//If the imageNumber is = 58, then do something...
if (imageNumber == 58)
{
trace(imageNumber);
next_btn.visible = false;
}
//if the imageNumber is = 1, then don't show the back button
if (imageNumber == 0)
{
trace(imageNumber);
back_btn.visible = false;
}
}
checkNumber();
function nextImage(evtObj:MouseEvent):void
{
//Adding to the current value +1
imageNumber++;
uiLoader.source = "smallWildlife/0" + imageNumber + ".jpg";
checkNumber();
}
back_btn.addEventListener(MouseEvent.CLICK, backImage);
function backImage(evtObj:MouseEvent):void
{
//Subtract 1 from the current value
imageNumber--;
uiLoader.source = "smallWildlife/0" + imageNumber + ".jpg";
checkNumber();
}
stop();
谢谢你的时间!