Groups | Blog | Home
all groups > flash actionscript > march 2005 >

flash actionscript : _xscale trouble



darrylfrith
3/29/2005 11:08:44 PM
I am loading images dynamically into my flash movie. They are loaded into a
mc called target. I have another mc that I want to use as a frame for the
images this has an instance name of border. How do I change the _xscale of
border to match the _xscale of the images I'm loading. Each image could have
different dimensions .

Please help.
Byron Canfield
3/29/2005 11:26:33 PM
The _width will give you an accurate value as soon as it is greater than
zero. That WILL be the width of the image as soon as the image has loaded to
the point that the width is known.

I suspect that what is happening is that you are assuming the image is
loaded as soon as you issue the loadMovie command, which it is not.
Successive lines of code are going to execute immediately -- they do not
wait for the movie to load unless you explicitly build in a waiting
mechanism, continually testing for load completion and not continuing on to
execute the remaining code until the load IS complete.

But then, I'm just guessing because you didn't post your code.

--
--------
Reality will not be altered to comply with preconceived notions.

Byron "Barn" Canfield
Flash example files: http://www.canfieldstudios.com

darrylfrith
3/29/2005 11:56:48 PM
No I have to use _xscale because changing the width crops my image. I want to
show the entire image at the scale of the uploaded objet. The problem is that
I don't know how to get the height and width of a dynamically loaded image to
define my variable.

Please help
darrylfrith
3/30/2005 1:15:38 AM
because I'm loading the image dynamically I am having trouble getting the
width and height of that image. I use _width to try and get the value of the
holder the image loads in but when I try to pass that value to a seperate mc
that I'm using on a different layer as a frame. The mc border_mc loads to
infinity the _width is not giving me an accurate value
Jeckyl
3/30/2005 9:21:25 AM
sounds like you really want to match the _width ... not the _xscale .. as
each image would be loaded at 100% scale, but just be a different size. So
just set the _width of the frame to be the _width of the content (after its
loaded).
--
Jeckyl

Jeckyl
3/30/2005 10:00:48 AM
_width an _height give you the width and height
if you then set the _width and _height of your frame to be the same (plus
allow an allowance for the frame thickness) all should be fine.

There would not be any cropping .. unless you're doing something you've not
told us, or not described what you're doing properly.
--
Jeckyl

darrylfrith
3/30/2005 10:42:29 PM
Thanks Byron. I used the following to check to see when the picture was loaded
because i don;t know the file names in advance or the file sizes. and I'm
loading dynamically.

stop();


h3_mc.loadMovie("Pictures/landscape/landscape11.jpg");
var id = setInterval(function () {
trace(h3_mc._width)
if (h3_mc._width > 0) {
_global.v = h3_mc._width;
gotoAndPlay(2);

clearInterval(id);

once I know the picture is loaded I use _global.v to set the border size.
Thanks again.

Darryl
AddThis Social Bookmark Button