0
3D旋轉和縮放相同的FLASH演示文稿。 我有縮放的概率。 它從預定的不同位置縮放。3D旋轉和縮放相同的FL
import flash.display.StageDisplayState;
import fl.controls.Slider;
import fl.events.SliderEvent;
import flash.display.Sprite;
import flash.display.MovieClip;
import fl.transitions.Zoom;
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.display.StageScaleMode;
this.stage.scaleMode=StageScaleMode.NO_SCALE;
Slider1.addEventListener(SliderEvent.THUMB_DRAG, changeHandler);
Slider2.addEventListener(SliderEvent.THUMB_DRAG, zoomHandler);
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
var tempMC:MovieClip =new MovieClip();
var loader:Loader =new Loader();
var tempMCOriWidth:Number=tempMC.width;
var tempMCOriHeight:Number=tempMC.height;
var loaderOriWidth:Number=loader.width;
var loaderOriHeight:Number=loader.height;
stage.scaleMode=StageScaleMode.NO_SCALE;
stage.align=StageAlign.TOP_LEFT;
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onTypicalLoaderComplete);
this.addChild(loader);
var faceRectContainer:Sprite;
var nextFileNameAbsol:String;
var i:int;
var j:Number;
var fileNameAbsol:String;
var fileName:String;
var fileArray:Array;
fileName="version_01\\battery_0001.png" ;
function zoomHandler(event:SliderEvent):void {
trace("File name in zoom hand");
loader.width=loaderOriWidth+Slider2.value;
loader.height=loaderOriHeight+Slider2.value;
}
function changeHandler(event:SliderEvent):void {
j=Slider1.value;
fileNameAbsol= fileName.substr(0 ,(fileName.length-4));
trace("fileNameAbsol");
trace(fileNameAbsol);
nextFileNameAbsol=generateName(fileNameAbsol,j);
trace("nextFileNameAbsol");
trace(nextFileNameAbsol);
nextFileNameAbsol=nextFileNameAbsol+".png";
trace("after cat");
trace(nextFileNameAbsol);
fileName = nextFileNameAbsol;
trace("Just bef lo");
trace(nextFileNameAbsol);
loader.load(new URLRequest(nextFileNameAbsol));
tempMC=new MovieClip();
tempMC.addChild(loader);
tempMC.x=0;
tempMC.y=0;
this.addChild(tempMC);
faceRectContainer = new Sprite();
faceRectContainer.addChild(tempMC);
this.addChild(faceRectContainer);
fileArray=nextFileNameAbsol.split("\\");
var htmlImage:String;
htmlImage="\" <img src='";
htmlImage+=fileArray[0];
htmlImage+="\\\\";
htmlImage+=fileArray[1];
htmlImage+="'/> \"";
trace("html im");
trace(htmlImage);
}
function leadingZeros(theNumber:Number):String{
var ourString:String = String(theNumber);
for(var i:uint = 4-ourString.length; i > 0; i--){
ourString = "0"+ourString;
}
return ourString;
}
function generateName(fileName:String,end:Number):String{
var fileNameRet:String;
var len:Number;
var nameEnd:Number;
var stringPart:String;
var stringPartNum:Number;
var stringPartNumRet:String;
var returnStringInipart:String;
var returnString:String;
trace("before ss");
trace(fileName);
stringPart=fileName.substr((fileName.length-4) ,(fileName.length-1));
trace("after ss");
trace(fileName);
stringPartNum=Number(stringPart);
stringPartNum++;
stringPartNumRet=leadingZeros(j);
returnStringInipart=fileName.substr(0 ,(fileName.length-4));
trace("returnStringInipart");
trace(returnStringInipart);
trace("stringPartNumRet");
trace(stringPartNumRet);
returnStringInipart=returnStringInipart+stringPartNumRet;
trace("returnStringInipart after cat");
trace(returnStringInipart);
return returnStringInipart;
}
在上面的腳本中,在使用slider2時,它永遠不會縮小。 請幫忙。
您的代碼格式很差,太難閱讀。如果你問一個問題,你應該正確地格式化你的代碼(修復縮進並刪除所有空行)。其他試圖幫助你的人不應該爲了能夠閱讀你的代碼而做一些額外的工作。 – user45623
我刪除了不必要的註釋,並留下空行以提高可讀性。 –
請刪除所有多餘的空白行。每個功能之間不應該有3或4個空行。請修復縮進。 – user45623