PDA

View Full Version : Resizing imported jpegs


s_purs
09-10-2005, 09:22 AM
Hi, i could really do with some quick help resizing imported jpegs. Im sure that it is quite simple, but i dont know how to do it.

Thus far i have created an empty movie clip on the stage- called 'container' and with an instance name of 'container'.

One frame one i have the code:

container.loadMovie('http://img5.picsplace.to/img5/3/DSCF2072.JPG');

stop();

this imports a jpeg from that url into the flash animation.

How do i then resize or move this jpeg in the movie? I would like to have like 10 jpegs imported into the movie all placed in frames, but i do not know how to resize or move these imported jpegs.

Thanks alot for your help

s_purs
09-10-2005, 09:30 AM
I have worked out that:

container._x=10

will position the jpeg, how do i resize it?

pan69
09-10-2005, 09:36 AM
After the JPEG has been fully loaded you have two options. Use the _width and _height properties of the MovieClip (in which the JPEG is loaded) or the _xscale and _yscale. I recommend the _xscale and _yscale properties.

s_purs
09-10-2005, 09:43 AM
Thanks alot.

I knew it was something like that but couldnt remember exactly.

for the positioing i used the: container._x=100

is there anyway i can use the code: container.moveTo (100,100) ?
as i have used that to position things before, but it does not seem to work.

thanks alot

sfhazel
09-10-2005, 09:50 AM
how do i resize it?


container._width = 100;
container._height = 75;

s_purs
09-10-2005, 09:53 AM
container._width = 100;
container._height = 75;


i tried that but it did not work, the ._xscale works though. thanks

do you know the answer to my second question about moving?

Sunny13
09-10-2005, 10:22 AM
container.moveTo (100,100)
this is used for the drawing on the clip not to move the clip...:)
try this one
this.createEmptyMovieClip("triangle_mc", 1);
triangle_mc.beginFill(0x0000FF, 30);
triangle_mc.lineStyle(5, 0xFF00FF, 100);
triangle_mc.moveTo(200, 200);
triangle_mc.lineTo(300, 300);
triangle_mc.endFill();

s_purs
09-10-2005, 10:24 AM
cool thanks,

so is there a command like it to possition mc's to a co-ordinate or do i have to stick with ._x=100 ?

Sunny13
09-10-2005, 10:25 AM
what exactly you want to do....???

Sunny13
09-10-2005, 10:26 AM
I have edited my earlier post plz go throught it....

pan69
09-10-2005, 10:27 AM
The moveTo is part of the drawing API (to draw lines and stuff). Unless your MovieClip inherits from UIObject you will have to use the _x and _y properties to position your MovieClip or define your own move method:


//-- Put at the top of your first frame.
MovieClip.prototype.move = function(x, y)
{
this._x = x;
this._y = y;
};

s_purs
09-10-2005, 12:52 PM
Thanks alot for your help guys, i can resize and possition them fine now.

If get flash to import the jpeg, but tell flash to resize it so it is now 10% of the size, does flash do the resizing first and thus only import 10% of the original jpeg file size, or does it import the whole jpeg file size, and then resize?

ie. if the original file size is 2mb, would flash import 0.2mb or 2mb then resize?

(im trying to work out the best way for people to view files on my flash website, as for flash to import the full files and then resize would take alot more time than just the 10%)

pan69
09-10-2005, 02:31 PM
If get flash to import the jpeg, but tell flash to resize it so it is now 10% of the size, does flash do the resizing first and thus only import 10% of the original jpeg file size, or does it import the whole jpeg file size, and then resize?Flash loads the whole kit and kaboodle...

s_purs
09-10-2005, 03:45 PM
ok thanks, guess i will have to get it to import smaller jpegs for the thumbnail page then and the full thing for the large pages