- Home
- Categorie
- Digital Marketing
- Grafica, Visual Design & UX
- Smoothing and resize
-
Smoothing and resize
Salve a tutti ragazzi devo assolutamente risolvere questo problema altrimenti vado via di testa! Premetto che sono un dilettante di as! Dovrei applicare sia la funzione smoothing che resize ma non riesco a farlo... questo è lo script:
pages._visible = 0;
debug._visible = 0;
mano._visible = false;
#include "import_xml.as"
stop();
import flash.display.BitmapData;
import flash.geom.Matrix;
function myCopy(pic) {
var mc = this.createEmptyMovieClip('mc', this.getNextHighestDepth());
var bmp = new flash.display.BitmapData(loadListener.myWidth, loadListener.myHeight, true, 0xFFFFFF);
bmp.draw(pic);
_root.pages.p4.page.pf.ph.pic.attachBitmap(bmp,0,null,true);
_root.pages.p4.page.pf.ph._rotation = 0;
}
this.createEmptyMovieClip('temploader',this.getNextHighestDepth());var loadListener:Object = new Object();
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(loadListener);
loadListener.onLoadStart = function(target_mc:MovieClip):Void {
// make the temporay mc invisible
target_mc._alpha = 0;
};
var myWidth:Number;
var myHeight:Number;
var maximumHeight:Number;//height to which movieclip to be resized
var maximumWidth:Number;//width to which movieclip to be resized
var oldx:Number;
var oldy:Number;
var ratio:Number;
loadListener.onLoadInit = function(target_mc:MovieClip):Void {
this.myHeight = target_mc._height;
this.maximumHeight = 1520;
this.myWidth = target_mc._width;//loaded movieclip width
this.maximumWidth = 1057;
ratio = myHeight/myWidth;//calculation ratio to which resize takes place
if (myWidth>maximumWidth) {
myWidth = maximumWidth;
myWidth = Math.round(myWidth*ratio);
}
if (myHeight>maximumHeight) {
myHeight = maximumHeight;
myHeight = Math.round(myHeight/ratio);
}
target_mc._width = 200;//applying new width
target_mc._height = 200;//applying new height
this._x = 0;//applying new height
this._y = 0;//applying new height
//this.myWidth = 100;
//this.myHeight = 200;
// when the image is fully loaded copy it with smoothing to the final container
myCopy(temploader);
};
function preload(myClip) {
//loding fumction
mcLoader.loadClip(myClip,temploader);
}
preload("page07.jpg",_root.pages.p4.page.pf.ph.pic);Sono riuscrito a fare entrambe le cose ma separatamente... dovrei farle contemporaneamente! Aiutatemi vi prego!!!:x