all groups > flash actionscript > february 2006 >
You're in the

flash actionscript

group:

Dynamic Movie not scaling


Dynamic Movie not scaling theartist
2/10/2006 7:09:54 PM
flash actionscript:
_root.createEmptyMovieClip("holder_mc", 1000);
holder_mc.loadMovie("little_chapel-Athens.jpg", 500);
with (holder_mc) {
_root.holder_mc._width=320;
_root.holder_mc._height=240;
}


this code produces no picture, but without the "with" statement, it works.

Aren't we supposed to be able to scale the images that we dynamically
create?

Re: Dynamic Movie not scaling theartist
2/10/2006 11:18:51 PM
and in another example...

_root.createEmptyMovieClip("square_mc", 500);
square_mc.onMouseDown=function() {
_root.square_mc._width=320;
_root.square_mc._height=240;
}
trace(_root.square_mc._width);
trace(_root.square_mc._height);

square_mc.createTextField("text", 250, 400, 300, 25, 25);
with (square_mc.text) {
selectable= false;
autosize = true;
text = "hi hello howdy what's up";
}

....the text is there, but it disappears when I click the mouse in the
test environ, instead of resizing anything. What gives?

Both of these are tests at the root level, using MX. Can anyone help?

Thanks in advance,
theartist

[quoted text, click to view]
Re: Dynamic Movie not scaling theartist
2/11/2006 3:11:34 AM
Here is some later code. I've gotten the image to load, but it isn't
the correct size at all. The outer blue box is 320x240, but the image
(little_chapel-Athens.jpg, currently 560x420) never gets to the 320x240
size (nor does the secondary box created on the mouseclick, for that
matter if done without the image). Why are the traces for square_mc1
160 and 120 respectively (indicating that the code has set the proper
pixel size for the image), yet the image isn't being sized correctly
when I have explicitly set the size?

PLEASE? Can someone help me understand why I can't correctly scale down
jpgs? Am I doing something wrong?

---------

_root.createEmptyMovieClip("holder", 500);
wide = 320;
high = 240;
half_wide = wide*.5;
half_high = high*.5;
padW = half_wide*.125;
padH = half_high*.125;
//lightorange
//bxcolr = 0xFFaa22;
//blue
bxcolr = 0x22aaFF;
//green
//bxcolr=0x11BB33;
with (holder) {
lineStyle(1, bxcolr, 100);
beginFill(bxcolr, 13);
moveTo(1, 1);
lineTo(wide, 1);
lineTo(wide, high);
lineTo(1, high);
lineTo(1, 1);
endFill();
}
holder.onMouseDown = function() {
holder.duplicateMovieClip("square_mc1", 1000, "holder");
square_mc1.loadMovie("little_chapel-Athens.jpg", 500);
/* image's height had to be divided just to get close to 320 wide! */
square_mc1._width = wide/2;
square_mc1._height = high/2;
square_mc1._x = padW;
square_mc1._y = padH;
holder.createTextField("text", 300, half_wide*.5, high+10, 25, 25);
with (holder.text) {
selectable = false;
autosize = true;
text = "hi, hello, howdy, what's up? Nothing?, So what are you doing?";
}
trace(square_mc1._width);
trace(square_mc1._height);
};



[quoted text, click to view]
AddThis Social Bookmark Button