dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [F8] box size in actionscript

  1. #1
    v3.0
    Join Date
    Jun 2007
    Posts
    10

    [F8] box size in actionscript

    So here's an issue that's got me stumped..

    i'm creating a picture gallery in my flash document. when the user rolls over the thumbs (which reside on the stage), a larger image appears with a frame around it (both created and controlled in actionscript). the frame consists of a black box, bigger and in back of the image.

    the actionscript resizes and places the box for each picture, since each image is a different size. this is my code:

    Code:
    //creates box
    this.createEmptyMovieClip("largeBox", DepthManager.kTop);
    	largeBox.beginFill(0x000000);
    	largeBox.moveTo(10, 10);
    	largeBox.lineTo(100, 10);
    	largeBox.lineTo(100, 100);
    	largeBox.lineTo(10, 100);
    	largeBox.lineTo(10, 10);
    	largeBox.endFill();
    
    //defines image area
    this.createEmptyMovieClip("image_mc", this.getNextHighestDepth());
    var mclListener:Object = new Object();
    mclListener.onLoadInit = function(target_mc:MovieClip) {
        
        //sets w&h relative to position on stage
        target_mc._x = 655-(target_mc._width/2);
        target_mc._y = 294-(target_mc._height/2);
    	
        target_mc.setDepthTo(DepthManager.kTopmost);
    	
         //positions box and sizes it relative to image
         largeBox._x = target_mc._x;
         largeBox._y = target_mc._y;
         largeBox._width = target_mc._width;
         largeBox._height = target_mc._height;
    	
         //positions caption info
         captionsText._width = target_mc._width;
         captionsText._x = target_mc._x;
         captionsText._y = target_mc._y + target_mc._height + 7;
    };
    
    //sample thumb code
    thumb01.onRollOver = function() {
    	
    	image_mcl.loadClip("portfolio_01.jpg", image_mc);
    };
    The problem is that the box is off-center from the image - by a very noticeable degree. Shouldn't this code position the box directly behind the image?
    there's something in the air here..

  2. #2
    v3.0
    Join Date
    Jun 2007
    Posts
    10
    nevermind, i figured it out. it was an issue with the properties i gave the box when i created it.
    there's something in the air here..

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