Comunidad de diseño web y desarrollo en internet online

cambiar tamaño de galería

Citar            
MensajeEscrito el 28 Nov 2008 12:48 am
Buenas, tengo una galería en 800 x 400 y me gustaría aplicarla a un proyecto que ya esta confeccionado en 1024 x 1280.
El punto es que cuando altero los valores y los cambio a 1024 x 1280 sucede que la máscara que contiene la galería, cuya función es agrandarse o achicarse, al volver al tamaño original, es decir, cuando disminuye su tamaño, este no vuelve al original sino que solo reduce su ancho y el largo permanece invariable.
Puede alguien darme alguna mano al respecto?

gracias de antemano.

A continuación en código

Código :

#include "mc_tween2.as"
Stage.scaleMode = "noscale";

// Setup
mc_cursor._visible = false;

var fullscreen:Boolean;
var resizing:Boolean;

//set the size of the stage
var canvasWidth:Number = 800;
var canvasHeight:Number = 400;

//set mask position
var maskPosX = 300;
var maskPosY = 0;
//set the big size image position
var bgPosX = maskPosX - ((mc_bg._width/2)-(mc_mask._width/2));
var bgPosY = maskPosY - ((mc_bg._height/2)-(mc_mask._height/2));

mc_mask._x = maskPosX;
mc_mask._y = maskPosY;
mc_bg._x = bgPosX;
mc_bg._y = bgPosY;

//set the mask over the big image
mc_bg.setMask(mc_mask);

function bgPan() {
   if(!resizing) {
      // Percentage
      mousePosX = (_root._xmouse - mc_mask._x);
      mousePosY = (_root._ymouse - mc_mask._y);
      proxX = Math.abs(mousePosX - mc_mask._width/2)/(mc_mask._width/2)*10;
      proxY = Math.abs(mousePosY - mc_mask._height/2)/(mc_mask._width/2)*10;
      mc_bg.tween("_x", _root._xmouse - (mc_bg._width * (mousePosX/mc_mask._width)), 20/proxX, "EaseOutCubic");
      mc_bg.tween("_y", _root._ymouse - (mc_bg._height * (mousePosY/mc_mask._height)), 20/proxY, "EaseOutCubic");
   }
}

mouseListener = new Object();
mouseListener.onMouseMove = function() {
   if(mc_mask.hitTest(_root._xmouse, _root._ymouse, false)) {
      bgPan();
      mc_cursor._visible = true;
      mc_cursor._x = _root._xmouse+12;
      mc_cursor._y = _root._ymouse+8;
      this.useHandCursor = true;
   } else {
      mc_cursor._visible = false;
      this.useHandCursor = false;
   }
};
mouseListener.onMouseDown = function() {
   if(mc_mask.hitTest(_root._xmouse, _root._ymouse, false)) {
      if(!mc_mask.isTweening() && mc_mask._width < Stage.width) {
         origX = mc_bg._x;
         origY = mc_bg._y;
         mc_mask.resizeTo(Stage.width, Stage.height, 1, "easeInOutCubic");
         mc_mask.slideTo((canvasWidth/2)-(Stage.width/2), (canvasHeight-Stage.height)/2, 1, "easeInOutCubic");
         resizing = true;
         mc_bg.slideTo((canvasWidth/2)-(Stage.width/2), (canvasHeight-Stage.height)/2, 1, "easeInOutCubic");
         mc_mask.onTweenComplete = function() {
            resizing = false;
            _root.fullscreen = true;
         };
         mc_cursor.caption.text = "Exit fullscreen";
         mc_cursor.mc_icon.gotoAndStop(2);
      } else if (!mc_mask.isTweening() && mc_mask._width > 500) {
         mc_mask.resizeTo(500, canvasHeight, 1, "easeInOutCubic");
         mc_mask.slideTo(maskPosX, maskPosY, 1, "easeInOutCubic");
         mc_bg.slideTo(origX, origY, 1, "easeInOutCubic");
         mc_mask.onTweenComplete = function() {
            fullscreen = false; 
         };
         mc_cursor.caption.text = "View fullscreen";
         mc_cursor.mc_icon.gotoAndStop(1);
      }
   } else {
      //
   }
};
Mouse.addListener(mouseListener);

var setStage:Object = new Object();
setStage.onResize = function() {
   cropBG();
};
Stage.addListener(setStage);

function cropBG() {
   trace(fullscreen);
   if(fullscreen) {
      mc_mask._width = Stage.width;
      mc_mask._height = Stage.height;
      mc_mask._x = (canvasWidth/2)-(Stage.width/2);
      mc_mask._y = (canvasHeight-Stage.height)/2;
      mc_bg._x = (canvasWidth/2)-(Stage.width/2);
      mc_bg._y = (canvasHeight-Stage.height)/2;
   }
   if(Stage.width/Stage.height>mc_bg._width/mc_bg._height) {
      // Aspect ratio higher than 4/3 (more horizontally-stretched)
      // Scale the width and make the height follow
      mc_bg._width = Stage.width;
      mc_bg._yscale = mc_bg._xscale;
   } else {
      // Aspect ratio lower than 4/3 (more vertically-stretched)
      // Scale the height and make the width follow
      mc_bg._height = Stage.height;
      mc_bg._xscale = mc_bg._yscale;
   }
}

cropBG();

Por incubo

53 de clabLevel



 

firefox
Citar            
MensajeEscrito el 28 Nov 2008 02:02 pm
Buenas

a este valor lo cambiaste tambien ? var maskPosX = 300;
saludos

Por Fokerone

26 de clabLevel



 

2008

firefox
Citar            
MensajeEscrito el 29 Nov 2008 02:22 am
si, pero lo que varía en eso es la posición de la máscara y no su tamaño

Por incubo

53 de clabLevel



 

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.