Ultrashock Forums > Flash > ActionScript
AS2 - Set max width/heigth for dynamicly called MC

You are currently viewing our website as a guest which gives you limited access to forums, files and other resources.

Click here to join now for free, and start interacting with our members, download files and much more!

Click here if you are looking for our Flash files and other professional assets.
 
Post Reply | View first unread | Rate Thread Search this Thread | Thread Tools | Display Modes

#1
Bookmark and Share!
AS2 - Set max width/heigth for dynamicly called MC
Old 2009-11-27

How do i set the maximum width and height of a dynamicly created MC.
It is a mc holding an loaded image.

This is what i got sofar:
Code:
createEmptyMovieClip("imagecontainermedium", getNextHighestDepth());
    // set the alpha to not see the picture loading...
    imagecontainermedium._alpha = 0;
    imagecontainermedium.loadMovie("photo/images/1.jpg");
    onEnterFrame = function(){
        if(imagecontainermedium.getBytesLoaded() >= imagecontainermedium.getBytesTotal() && imagecontainermedium.getBytesLoaded() > 0){
            imagecontainermedium._x  = 320 - imagecontainermedium._width/2; 
            imagecontainermedium._y  = 67 - imagecontainermedium._height/2;
            delete onEnterFrame;
            imagecontainermedium._alpha = 100; 
        }
    };
Can someone help me with this.
postbit arrow 2 comments | 193 views postbit arrow Reply: with Quote   
Registered User
marcelcolt is offline
seperator
Posts: 33
2008-08-07
marcelcolt lives in Netherlands
seperator

Ultrashock Member Comments:
peter II. peter II. is offline peter II. lives in United Kingdom 2009-11-30 #2 Old  
your mc 'imagecontainermedium' is just a holder, no need to set max width/height. If the dimensions of the loaded image are bigger than your max width and height you could:
1. apply a mask
2. scale the image down.

Hope that helps
Reply With Quote  
marcelcolt marcelcolt is offline marcelcolt lives in Netherlands 2009-12-01 #3 Old  
Jeah, well i've tried about everything and i've been at it for about 4 months now...i give up.
I'll just load square images (png's with transparent squared bg) and that's it.

Thanks anyway.
Reply With Quote  
Thread Tools
Display Modes Rate This Thread
Rate This Thread: