I was wondering if anyone can point me in the rigth direction.
I have been trying for days now to figure this out.
I know there is some little thing I am missing
and its probably right under my nose so to speak.
Here is my code:
//--------------------------------------------------
// Start Image loader
//--------------------------------------------------
import com.martijndevisser.ImageLoader;
_root.stage_mc.attachMovie("LargePic","LargePic" +
ID,this.getNextHighestDepth());
_root.stage_mc["LargePic" + ID].ID = ID;
_root.stage_mc["LargePic" + ID]._x = originalX;
_root.stage_mc["LargePic" + ID]._y = originalY;
var mcProgress:Number = 0;
var checkLoader:Object = new Object();
checkLoader.onLoadStart = function(target:MovieClip):Void {
trace("Start Width:" + _root.stage_mc["LargePic" +
ID].previewW);
trace("Start Height:" + _root.stage_mc["LargePic" +
ID].previewH);
_root.stage_mc["LargePic" + ID].newPic.spiralLoader._visible
= true;
_root.stage_mc["LargePic" +
ID].newPic.spiralLoader.gotoAndPlay(2);
};
checkLoader.onLoadComplete = function(target:MovieClip) {
target = _root.stage_mc["LargePic" + ID].newPic.Image_mc;
_root.stage_mc["LargePic" + ID].newPic.percentCom.text = "";
_root.stage_mc["LargePic" + ID].newPic.spiralLoader.stop();
_root.stage_mc["LargePic" +
ID].newPic.spiralLoader.gotoAndStop(1);
_root.stage_mc["LargePic" + ID].newPic.spiralLoader._visible =
false;
target._width = target._width / 3;
target._height = target._height / 3;
_root.stage_mc["LargePic" + ID].previewW =
_root.stage_mc["LargePic"
+ ID].newPic._width;
_root.stage_mc["LargePic" + ID].previewH =
_root.stage_mc["LargePic"
+ ID].newPic._height;
trace("End Width:" + _root.stage_mc["LargePic" + ID].previewW);
trace("End Height:" + _root.stage_mc["LargePic" +
ID].previewH);
};
checkLoader.onLoadProgress = function(target:MovieClip,
bytesLoaded:Number,
bytesTotal:Number):Void {
mcProgress = Math.ceil((bytesLoaded / bytesTotal) * 100);
_root.stage_mc["LargePic" + ID].newPic.percentCom.text =
mcProgress.toString() + "%";
};
var loader:ImageLoader = new
ImageLoader(_root.stage_mc["LargePic" +
ID].newPic.Image_mc);
loader.addListener(checkLoader);
loader.loadImage(_global.projectPic,_root.stage_mc["LargePic" +
ID].newPic.Image_mc);
//--------------------------------------------------
// End Image Loader
//--------------------------------------------------
To explain further, I have a oversized image loading at first
which is
sized down 3 times.
Once it sizes down, I want previewW and previewH to equal the new
width
and
height.
Everything loads fine, it loads and the progress runs and it
resizes
fine,
but when I hit my resize button to make it smaller, the variables
previewW
and previewH
take on the dimensions of _root.stage_mc["LargePic" +
ID].newPic.Image_mc
before anything was loaded into it.
(my resize button works off of the previewW and previewH
vairables, this
info is just FYI)
var fitSizeW:Number = previewW;
var fitSizeH:Number = previewH;
var maxSizeW:Number = (previewW * 3);
var maxSizeH:Number = (previewW * 3);
var minSizeW:Number = (previewW / 3);
var minSizeH:Number = (previewH / 3);
Note: I have to keep previewW and previewH also because I have a
mousescroll attached to that variable as well.
I have a feeling that because the ImageLoader class loads a dummy
MC for
the bitmap
and then removes it to place the "img" MC for smoothing, my
script is not
getting the final value
of what is loaded into it and so previewW and previewH do not
inherit its
final values, just its beginning values.
There is a background bitmap that gets replaced by the loaded
image that
is
in the MC when it is placed on stage.
This is the beginning value.
This is in AS2 BTW.
Any help would be GREATLY appreciated at this point.
THX
Karl DeSaulniers
Design Drumm
http://designdrumm.com
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________