3D旋转和缩放相同的fla

时间:2017-07-14 10:48:57

标签: actionscript-3

3D旋转和缩放相同的Flash演示文稿。 我有缩放问题。 它是从与预期不同的位置进行缩放。

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时,它永远不会缩小。 请帮助。

1 个答案:

答案 0 :(得分:0)

如果它从错误的地方缩放,您可能需要调整轴心点。