FMX - Problem whit loading image to MC

Can someone take a look at my code, what i was trying to do is to have a picture loadind to inside or upside the MC that streches, the fla included as an attach MC, but I can´t find a way to find the center of the strehed MC

thanks

the center is still 0,0

but since the proportions of the container clip are altered all your content will be squished too. If the container starts a square, it needs to stay a square or any movies loaded into it will be stretched funny. Have the content attach on the main timeline instead of into the clip, and have it position it over the stretched clip.
OLD ->
_root.mc01.content_mc.attachMovie(“movie01”,“movie022”,10)
NEW ->
_root.attachMovie(“movie01”,“movie022”,10,{_x:_root.mc01._x,_y:_root.mc01._y})

this last part between the {} can give the clip properties before it is attached. I am setting its _x and _y properties to be the same as that of the stretched clip (mc01), which will center it over it, as long as you make sure the content is centered around 0,0 in its swf. Other wise you would want to use this:

{_x:_root.mc01._x - <the width of the swf>,
_y:_root.mc01._y - <the height of the swf>}

A better option would be to place both mc01 and the attachedMovie inside a container clip
that does not get stretched. Stretch mc01 inside it and then say _root.containerClip.attachMovie(…

If I say anything confusing just ask me to explain better.

I understand the first part, but I did not the second part were you say " a better option is".

Another question , if you don´t mind is, the objective for this is to have load movie and not attach movie clip, but when i change to load movie , the loaded swf erases the mc that streches, and is loaded to the center of the mc.

thanks

:slight_smile:

loadMovie works a little differently from attachMovie. For the type of thing you are doing loadMovie is probably the way to go.

When you use attachMovie, you have to specify a MovieClip to be the new clip’s parent, when you use loadMovie you have to specify a clip to * be replaced by* the loaded clip. So what you can do is to have an empty clip waiting to be replaced. If this clip is named content_mc, then when your movie is loaded, you can refer to it by the name content_mc, and it will have all the properties that content_mc had when it was replaced.

The main point of the second thing I was saying was that you can use a clip within a clip just to organize your symbols.

Draw a square and convert it to a symbol. Then create a new symbol with nothing in it and drag it on top of the square. Name the square stretch_mc and the emptyclip content_mc, then select them both and convert to symbol. Name it contentframe_mc. Now your clip structure is organized like this:

>contentframe_mc
->stretch_mc
->content_mc

When you apply the stretching script to contentframe_mc.stretch_mc, contentframe_mc.content_mc will be unaffected stretchwise, and when you loadMovie into contentframe_mc.content_mc (which is empty) it will be “over” the stretched rectangle, but it will not wipe it out.

Then on your main stage you have just one clip contentframe_mc which you can duplicate to contentframe2_mc etc, and each content_mc inside will still be centered in the stretch_mc that belongs to it.

it worked, is this what I really wanted, is not new but i think this as some potencial.

Thanks for helping me out,

i live in portugal and i started to work whit flash 1 year and 6 months ago, I take 1 course, but here the courses in flash are so elementar, what book do you think is better, not to begginers.

thsnks a lot

fausto

i have using flash MX by Michael Hurwicz and i find it very helpful and not too elementary. I knew javascript a little before I got the book though, so I was able to get through a lot of it pretty quickly.

kirupa has some good ones too
http://www.kirupa.com/store/flashbooks.asp