This content has been marked as final. Show 6 replies
Are you usng as2?
If yes then I believe the best option (using the MovieClipLoader class) is to adjust your image (via the containing movieclips _x property, after checking its _width property) in the the MovieClipLoader's onLoadInit handler.
Thanks for the reply.
I am very new to this so a little unsure where I would adjust this action script. I have included the script if you get a chance to reply could you give me an example where this new code would go.
Will not be able to reply back until tonight as about to go to work.
Thanks again for the help.
I did this quickly and didn't test it - but if it doesn't work straight off it might give you a starting point - or someone else may correct it if there are errors. I'll check back tomorrow - where I am its time to go to sleep...
EDIT DETAILS: Just changed a couple of bits of the code I posted last night - I forgot to change the holder_mc.loadMovie instruction in the xml.onLoad handler. I haven't tested this, but its along the lines of the approach I would use to fix your problem with the image sizing. Let me know how you get on with it.
Thanks so much for the help I really appreciate it. Your script works perfect. All images that get called by the xml are centre aligned within the picture holder. I think it's going to take me a while to understand the changes you made to make it work.
Until next time
You're welcome. Pleased it worked.
All it does is use the MovieClipLoader class to load the images into your holder_mc. Because loading takes time, and because you can't check or adjust the size or position of images until they have loaded, the MovieClipLoader class gives you a handy option to run some code whenever its finished loading something you told it to load.
That's what the addListener instruction does... it says whenever myLoader has something new to tell me about the status of the load requests I ask it to do... make it run some related code in the listener object (which is called loadListener in this code... it could equally be called something else). You 'listen' for different events or updates of status. All I 'listened' for here was the onLoadInit event.
The onLoadInit is the 'final' status update after loading. It occurs when something has loaded and its properties are accessible (_x, _width etc). The target_mc that is an argument for the loadListener.onLoadInit is a reference to the clip that was loaded into.
The best way to learn about this stuff is probably to read up on MovieClipLoader in the livedocs and try google to see if there's an online tutorial somewhere. Then give it a try yourself in another new fla.
Thanks GWD for the help as well as explanaton of what the script is doing.
Will try it out in a new fla.