little help on Flash 100% width

  • routhu
  • Beginner
  • Beginner
  • User avatar
  • Posts: 47
  • Loc: India

Post 3+ Months Ago

Hi to all,

I am new in actionscrip.

I have developed this code for variable width gallery.
But I want the Image to be changed proportional with respect to window, No Stretching will be happen while dragging the window.

Below code belongs to that one.

Can any one Please Help me to solve this Problme.


Code: [ Select ]
function loadXML(loaded) {
    if (loaded) {
        xmlNode = this.firstChild;
        image = [];
        total = xmlNode.childNodes.length;
        for (i=0; i<total; i++) {
            image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
        }
        firstImage();
    } else {
        content = "file not loaded!";
    }
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");

/////////////////////////////////////


Stage.align = "LT";
Stage.scaleMode = "noScale";
stageListener = new Object();
stageListener.onResize = function() {
expandTop();
expandImage();
}

Stage.addListener(stageListener);

expandTop = function() {
bannerBackground_mc._width = Stage.width;
mask_mc._width = Stage.width - mask_mc._y -20;
bannerBackground_mc._height = Stage.height;
mask_mc._height = Stage.height - mask_mc._x -20;
}
/////////////////////////////////////

p = 0;
this.onEnterFrame = function() {
    filesize = picture.pic.getBytesTotal();
    loaded = picture.pic.getBytesLoaded();
    preloader._visible = true;
    if (loaded != filesize) {
        preloader.preload_bar._xscale = 100*loaded/filesize;
    } else {
        preloader._visible = false;
        if (picture.pic._alpha<100) {
            picture.pic._alpha += 10;
        }
    }
};
function firstImage() {
    if (loaded == filesize) {
        picture.pic._alpha = 0;
        picture.pic.loadMovie(image[0], 1);
        picture.pic_num();
    }
}
function picturepic_num() {
    current_pos = p+1;
    pos_txt.text = current_pos+" / "+total;
}
  1. function loadXML(loaded) {
  2.     if (loaded) {
  3.         xmlNode = this.firstChild;
  4.         image = [];
  5.         total = xmlNode.childNodes.length;
  6.         for (i=0; i<total; i++) {
  7.             image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
  8.         }
  9.         firstImage();
  10.     } else {
  11.         content = "file not loaded!";
  12.     }
  13. }
  14. xmlData = new XML();
  15. xmlData.ignoreWhite = true;
  16. xmlData.onLoad = loadXML;
  17. xmlData.load("images.xml");
  18. /////////////////////////////////////
  19. Stage.align = "LT";
  20. Stage.scaleMode = "noScale";
  21. stageListener = new Object();
  22. stageListener.onResize = function() {
  23. expandTop();
  24. expandImage();
  25. }
  26. Stage.addListener(stageListener);
  27. expandTop = function() {
  28. bannerBackground_mc._width = Stage.width;
  29. mask_mc._width = Stage.width - mask_mc._y -20;
  30. bannerBackground_mc._height = Stage.height;
  31. mask_mc._height = Stage.height - mask_mc._x -20;
  32. }
  33. /////////////////////////////////////
  34. p = 0;
  35. this.onEnterFrame = function() {
  36.     filesize = picture.pic.getBytesTotal();
  37.     loaded = picture.pic.getBytesLoaded();
  38.     preloader._visible = true;
  39.     if (loaded != filesize) {
  40.         preloader.preload_bar._xscale = 100*loaded/filesize;
  41.     } else {
  42.         preloader._visible = false;
  43.         if (picture.pic._alpha<100) {
  44.             picture.pic._alpha += 10;
  45.         }
  46.     }
  47. };
  48. function firstImage() {
  49.     if (loaded == filesize) {
  50.         picture.pic._alpha = 0;
  51.         picture.pic.loadMovie(image[0], 1);
  52.         picture.pic_num();
  53.     }
  54. }
  55. function picturepic_num() {
  56.     current_pos = p+1;
  57.     pos_txt.text = current_pos+" / "+total;
  58. }
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

then again ... you want the Image to be changed proportional with respect to window, No Stretching will be happen while dragging the window.
That means you will have to set picture._width and picture._height and keep the proportions.
  • routhu
  • Beginner
  • Beginner
  • User avatar
  • Posts: 47
  • Loc: India

Post 3+ Months Ago

Hi IceCold,

Thanks for you reply,

This code is working fine but I need height and width should be same. As this code is streching the image.

Thanks
krish



Code: [ Select ]
Stage.align = "LT";

Stage.scaleMode = "noScale";

stageListener = new Object();

stageListener.onResize = function() {

expandTop();

expandImage();

}

Stage.addListener(stageListener);

expandTop = function() {

bannerBackground_mc._width = Stage.width;

mask_mc._width = Stage.width - mask_mc._y -20;

bannerBackground_mc._height = Stage.height;

mask_mc._height = Stage.height - mask_mc._x -20;

picture_width = Stage.width;

picture_height = Stage.height;

}
  1. Stage.align = "LT";
  2. Stage.scaleMode = "noScale";
  3. stageListener = new Object();
  4. stageListener.onResize = function() {
  5. expandTop();
  6. expandImage();
  7. }
  8. Stage.addListener(stageListener);
  9. expandTop = function() {
  10. bannerBackground_mc._width = Stage.width;
  11. mask_mc._width = Stage.width - mask_mc._y -20;
  12. bannerBackground_mc._height = Stage.height;
  13. mask_mc._height = Stage.height - mask_mc._x -20;
  14. picture_width = Stage.width;
  15. picture_height = Stage.height;
  16. }
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

not sure what you really want. Keep the same size of the picture or what?
  • routhu
  • Beginner
  • Beginner
  • User avatar
  • Posts: 47
  • Loc: India

Post 3+ Months Ago

Hi,

I want the image exactly like in below link. Consider only large Image.

Whenever i stretch the window the Image has to behave like in the Below window.

http://www.theinfantphotographer.com/co ... index.html
  • routhu
  • Beginner
  • Beginner
  • User avatar
  • Posts: 47
  • Loc: India

Post 3+ Months Ago

Any One Please...?
  • routhu
  • Beginner
  • Beginner
  • User avatar
  • Posts: 47
  • Loc: India

Post 3+ Months Ago

Hi to all ,

I am using the below code. But here is my problem . In the starting the image is stretching , if i done any operation like minimising or Maxmising I get the correct Image.
I need to solve that Starting Image stretching problem.

Can any one please help me to Solve this one.

Code: [ Select ]
Stage.align = "TL";
Stage.scaleMode = "noScale";
stageListener = new Object();

stageListener.onResize = function() {
expandTop();
expandImage()
}
Stage.addListener(stageListener);

expandTop = function() {
mask_mc._width = Stage.width - mask_mc._y -20;
mask_mc._height = Stage.height - mask_mc._x -20;
}

function expandImage() {
  picture._width = Stage.width;
  picture._yscale = picture._xscale;
 
  if (picture.height >= _yscale) {
   picture._x = (Stage.width)/4;
   picture._y = (Stage.height)/4;
  }
  else{
   picture._height = Stage.height;
   picture._xscale = picture._yscale;
   picture._x = (Stage.width)/4;
   picture._y = (Stage.height)/4;
  }
}

  1. Stage.align = "TL";
  2. Stage.scaleMode = "noScale";
  3. stageListener = new Object();
  4. stageListener.onResize = function() {
  5. expandTop();
  6. expandImage()
  7. }
  8. Stage.addListener(stageListener);
  9. expandTop = function() {
  10. mask_mc._width = Stage.width - mask_mc._y -20;
  11. mask_mc._height = Stage.height - mask_mc._x -20;
  12. }
  13. function expandImage() {
  14.   picture._width = Stage.width;
  15.   picture._yscale = picture._xscale;
  16.  
  17.   if (picture.height >= _yscale) {
  18.    picture._x = (Stage.width)/4;
  19.    picture._y = (Stage.height)/4;
  20.   }
  21.   else{
  22.    picture._height = Stage.height;
  23.    picture._xscale = picture._yscale;
  24.    picture._x = (Stage.width)/4;
  25.    picture._y = (Stage.height)/4;
  26.   }
  27. }


Thanks,
Krishna

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 9 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.