# \[Flash8\]MC with scroller

**URL:** <https://forum.kirupa.com/t/flash8-mc-with-scroller/222262>\
**Category:** Uncategorized\
**Created:** [April 12, 2007, 2:09am UTC](https://forum.kirupa.com/t/flash8-mc-with-scroller/222262 "2007-04-12T02:09:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![3L3CTRA](https://avatars.discourse-cdn.com/v4/letter/3/53a042/32.png) [@3L3CTRA](https://forum.kirupa.com/u/3L3CTRA)\
**Post date:** [April 12, 2007, 2:09am UTC](https://forum.kirupa.com/t/flash8-mc-with-scroller/222262/1 "2007-04-12T02:09:57Z")

</div>

Please help. My head is about to burst =( Any help is much appreciated.

The loaded background keeps moving while resizing the window. Please see attached files.

My current actionscript looks like this.

Stage.scaleMode = “noScale”;  
Stage.align = “LT”;  
stageListener = new Object();  
stageListener.onResize = function() {  
expandTop();  
};  
expandTop = function () {  
gallery.\_x = Stage.width/2-gallery.\_width/2;  
gallery.\_y = Stage.height/2-gallery.\_height/2;  
};  
import flash.display._;  
function loadBitmapSmoothed(url:String, target:MovieClip) {  
var bmc:MovieClip = target.createEmptyMovieClip(“bmc”, target.getNextHighestDepth());  
var listener:Object = new Object();  
listener.tmc = target;  
listener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {  
percent = Math.round((bytesLoaded/bytesTotal)100);  
pText.text = percent+"%";  
};  
listener.onLoadInit = function(mc:MovieClip) {  
mc.\_visible = false;  
var bitmap:BitmapData = new BitmapData(mc.\_width, mc.\_height, true);  
this.tmc.attachBitmap(bitmap, this.tmc.getNextHighestDepth(), “auto”, true);  
bitmap.draw(mc);  
// set size and position on load  
if (Stage.height/Stage.width\>target.\_height/target.\_width) {  
img\_prop = target.\_width/target.\_height;  
target.\_height = Stage.height;  
target.\_width = Stage.heightimg\_prop;  
target.\_x = Stage.width/2-target.\_width/2;  
target.\_y = Stage.height/2-target.\_height/2;  
} else {  
img\_prop = target.\_height/target.\_width;  
target.\_width = Stage.width;  
target.\_height = Stage.width_img\_prop;  
target.\_x = Stage.width/2-target.\_width/2;  
target.\_y = Stage.height/2-target.\_height/2;  
}  
};  
var loader:MovieClipLoader = new MovieClipLoader();  
loader.addListener(listener);  
loader.loadClip(url, bmc);  
}  
loadBitmapSmoothed(“references/bgrnd.png”, bg\_con);  
// set size and position on resize  
var stageListener:Object = new Object();  
stageListener.onResize = function():Void {  
if (Stage.height/Stage.width\>bg\_con.\_height/bg\_con.\_width) {  
img\_prop = bg\_con.\_width/bg\_con.\_height;  
bg\_con.\_height = Stage.height;  
bg\_con.\_width = Stage.height_img\_prop;  
bg\_con.\_x = Stage.width/2-bg\_con.\_width/2;  
bg\_con.\_y = Stage.height/2-bg\_con.\_height/2;  
} else {  
img\_prop = bg\_con.\_height/bg\_con.\_width;  
bg\_con.\_width = Stage.width;  
bg\_con.\_height = Stage.width_img\_prop;  
bg\_con.\_x = Stage.width/2-bg\_con.\_width/2;  
bg\_con.\_y = Stage.height/2-bg\_con.\_height/2;  
}  
};  
Stage.addListener(stageListener);
