A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Set max width/heigth for dynamicly called MC

  1. #1
    Junior Member
    Join Date
    Aug 2008
    Posts
    28

    Set max width/heigth for dynamicly called MC

    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.

  2. #2
    Member
    Join Date
    Nov 2009
    Posts
    43
    I think you can use this>
    if (yourMc._xscale >= x){}
    if (yourMc._yscale >= x){}

  3. #3
    Junior Member
    Join Date
    Aug 2008
    Posts
    28
    Code:
    if (imagecontainermedium._xscale >= 317)
         {imagecontainermedium,_width=316}
    if (imagecontainermedium._yscale >= 317)
         {imagecontainermedium._height=316}
    Like this?

  4. #4
    Member
    Join Date
    Nov 2009
    Posts
    43
    yes
    (in second line you wrote , insted of . )

  5. #5
    Junior Member
    Join Date
    Aug 2008
    Posts
    28
    I couldn't get it to work.
    Do i use it like this (Sorry, my syntax sucks):

    Code:
        createEmptyMovieClip("imagecontainermedium", getNextHighestDepth());
        // set the alpha to not see the picture loading...
        imagecontainermedium._alpha = 0;
        imagecontainermedium.loadMovie("photo/images/1.jpg");
    		if (imagecontainermedium._xscale >= 317)
         		{imagecontainermedium._width=316}
    		if (imagecontainermedium._yscale >= 317)
         		{imagecontainermedium._height=316};
        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; 
            }
        };

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center