Altering This Gallery+Thumbs. Who's Good??

  • Playdo
  • Born
  • Born
  • Playdo
  • Posts: 2

Post 3+ Months Ago

I'm not an actionscripter but an artist with limited actionscript knowledge. For over two weeks now I've been trying to get a piece of code together but keep running into endless brick walls. I would have thought this would be easy but there hasn't been anyone out there capable of showing me the final solution so far.

I'm looking for a result similar to this tutorial http://www.republicofcode. (put com here)/tutorials/flash/xmlimagegallery/ but with a few specific changes. I haven't uploaded my attempts at the code because it probably will complicate things.

The source files are located at the bottom of this link: http://www.republicofcode. (put com here)/tutorials/flash/xmlimagegallery/7.php

What I am trying to acheive is the above gallery but which specifically does the following when a thumbnail is pressed:

- Show the preloader (whilst keeping the current image on screen).
- When the preloader has finished then fade the current image to alpha=0
- Slight Pause
- After the pause fade the next image in to alpha=100.

- In addition I've been trying to get the thumbnails alpha to be 50%. Then on onRollover and onRelease to set the alpha to 100%. Similar to this: http://www.republicofcode. (put com here)/tutorials/flash/imagegallery/

If anyone can actually do this then please post. But don't post unless you have tested and confirmed it because I can't be running backwards and forwards anymore.

ps I've hade to put com in brackets to allow me to post a url
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Playdo
  • Born
  • Born
  • Playdo
  • Posts: 2

Post 3+ Months Ago

Below is the tutorial's code:

Code: [ Select ]
import mx.transitions.Tween;
import mx.transitions.easing.*;

var myGalleryXML = new XML();
myGalleryXML.ignoreWhite = true;
myGalleryXML.load("gallery.xml");

myGalleryXML.onLoad = function() {
_root.gallery_x = myGalleryXML.firstChild.attributes.gallery_x;
_root.gallery_y = myGalleryXML.firstChild.attributes.gallery_y;
_root.gallery_width = myGalleryXML.firstChild.attributes.gallery_width;
_root.gallery_height = myGalleryXML.firstChild.attributes.gallery_height;

_root.myImages = myGalleryXML.firstChild.childNodes;
_root.myImagesTotal = myImages.length;

_root.thumb_height = myGalleryXML.firstChild.attributes.thumb_height;
_root.thumb_width = myGalleryXML.firstChild.attributes.thumb_width;

_root.full_x = myGalleryXML.firstChild.attributes.full_x;
_root.full_y = myGalleryXML.firstChild.attributes.full_y;

callThumbs();
createMask();
scrolling();

};

function callThumbs() {
_root.createEmptyMovieClip("container_mc",_root.getNextHighestDepth());
container_mc._x = _root.gallery_x;
container_mc._y = _root.gallery_y;

var clipLoader = new MovieClipLoader();
var preloader = new Object();
clipLoader.addListener(preloader);

for (i=0; i<myImagesTotal; i++) {
thumbURL = myImages[i].attributes.thumb_url;
myThumb_mc = container_mc.createEmptyMovieClip(i, container_mc.getNextHighestDepth());
myThumb_mc._y = _root.thumb_height*i;
clipLoader.loadClip("thumbs/"+thumbURL,myThumb_mc);

preloader.onLoadStart = function(target) {
target.createTextField("my_txt",target.getNextHighestDepth(),0,0,100,20);
target.my_txt.selectable = false;
};


preloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);
};

preloader.onLoadComplete = function(target) {
new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
target.my_txt.removeTextField();
target.onRelease = function() {
callFullImage(this._name);
};

target.onRollOver = function() {
this._alpha = 50;
};

target.onRollOut = function() {
this._alpha = 100;
};


};
}
}



function callFullImage(myNumber) {

myURL = myImages[myNumber].attributes.full_url;
myTitle = myImages[myNumber].attributes.title;
_root.createEmptyMovieClip("fullImage_mc",_root.getNextHighestDepth());
fullImage_mc._x = _root.full_x;
fullImage_mc._y = _root.full_y;

var fullClipLoader = new MovieClipLoader();
var fullPreloader = new Object();
fullClipLoader.addListener(fullPreloader);

fullPreloader.onLoadStart = function(target) {
target.createTextField("my_txt",fullImage_mc.getNextHighestDepth(),0,0,200,20);
target.my_txt.selectable = false;
};

fullPreloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);
};

fullPreloader.onLoadComplete = function(target) {
new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
target.my_txt.text = myTitle;
};

fullClipLoader.loadClip("full_images/"+myURL,fullImage_mc);

}

function createMask() {

_root.createEmptyMovieClip("mask_mc",_root.getNextHighestDepth());

mask_mc._x = _root.gallery_x;
mask_mc._y = _root.gallery_y;

mask_mc.beginFill(0x000000,100);
mask_mc.lineTo(_root.gallery_width,0);
mask_mc.lineTo(_root.gallery_width,_root.gallery_height);
mask_mc.lineTo(0,_root.gallery_height);
mask_mc.lineTo(0,0);

container_mc.setMask(mask_mc);

}

function scrolling() {
_root.onEnterFrame = function() {

container_mc._y += Math.cos(((mask_mc._ymouse)/mask_mc._height)*Math.PI)*15;

if (container_mc._y>mask_mc._y) {
container_mc._y = mask_mc._y;
}

if (container_mc._y<(mask_mc._y-(container_mc._height-mask_mc._height))) {
container_mc._y = mask_mc._y-(container_mc._height-mask_mc._height);
}

};
}
  1. import mx.transitions.Tween;
  2. import mx.transitions.easing.*;
  3. var myGalleryXML = new XML();
  4. myGalleryXML.ignoreWhite = true;
  5. myGalleryXML.load("gallery.xml");
  6. myGalleryXML.onLoad = function() {
  7. _root.gallery_x = myGalleryXML.firstChild.attributes.gallery_x;
  8. _root.gallery_y = myGalleryXML.firstChild.attributes.gallery_y;
  9. _root.gallery_width = myGalleryXML.firstChild.attributes.gallery_width;
  10. _root.gallery_height = myGalleryXML.firstChild.attributes.gallery_height;
  11. _root.myImages = myGalleryXML.firstChild.childNodes;
  12. _root.myImagesTotal = myImages.length;
  13. _root.thumb_height = myGalleryXML.firstChild.attributes.thumb_height;
  14. _root.thumb_width = myGalleryXML.firstChild.attributes.thumb_width;
  15. _root.full_x = myGalleryXML.firstChild.attributes.full_x;
  16. _root.full_y = myGalleryXML.firstChild.attributes.full_y;
  17. callThumbs();
  18. createMask();
  19. scrolling();
  20. };
  21. function callThumbs() {
  22. _root.createEmptyMovieClip("container_mc",_root.getNextHighestDepth());
  23. container_mc._x = _root.gallery_x;
  24. container_mc._y = _root.gallery_y;
  25. var clipLoader = new MovieClipLoader();
  26. var preloader = new Object();
  27. clipLoader.addListener(preloader);
  28. for (i=0; i<myImagesTotal; i++) {
  29. thumbURL = myImages[i].attributes.thumb_url;
  30. myThumb_mc = container_mc.createEmptyMovieClip(i, container_mc.getNextHighestDepth());
  31. myThumb_mc._y = _root.thumb_height*i;
  32. clipLoader.loadClip("thumbs/"+thumbURL,myThumb_mc);
  33. preloader.onLoadStart = function(target) {
  34. target.createTextField("my_txt",target.getNextHighestDepth(),0,0,100,20);
  35. target.my_txt.selectable = false;
  36. };
  37. preloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
  38. target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);
  39. };
  40. preloader.onLoadComplete = function(target) {
  41. new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
  42. target.my_txt.removeTextField();
  43. target.onRelease = function() {
  44. callFullImage(this._name);
  45. };
  46. target.onRollOver = function() {
  47. this._alpha = 50;
  48. };
  49. target.onRollOut = function() {
  50. this._alpha = 100;
  51. };
  52. };
  53. }
  54. }
  55. function callFullImage(myNumber) {
  56. myURL = myImages[myNumber].attributes.full_url;
  57. myTitle = myImages[myNumber].attributes.title;
  58. _root.createEmptyMovieClip("fullImage_mc",_root.getNextHighestDepth());
  59. fullImage_mc._x = _root.full_x;
  60. fullImage_mc._y = _root.full_y;
  61. var fullClipLoader = new MovieClipLoader();
  62. var fullPreloader = new Object();
  63. fullClipLoader.addListener(fullPreloader);
  64. fullPreloader.onLoadStart = function(target) {
  65. target.createTextField("my_txt",fullImage_mc.getNextHighestDepth(),0,0,200,20);
  66. target.my_txt.selectable = false;
  67. };
  68. fullPreloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
  69. target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);
  70. };
  71. fullPreloader.onLoadComplete = function(target) {
  72. new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
  73. target.my_txt.text = myTitle;
  74. };
  75. fullClipLoader.loadClip("full_images/"+myURL,fullImage_mc);
  76. }
  77. function createMask() {
  78. _root.createEmptyMovieClip("mask_mc",_root.getNextHighestDepth());
  79. mask_mc._x = _root.gallery_x;
  80. mask_mc._y = _root.gallery_y;
  81. mask_mc.beginFill(0x000000,100);
  82. mask_mc.lineTo(_root.gallery_width,0);
  83. mask_mc.lineTo(_root.gallery_width,_root.gallery_height);
  84. mask_mc.lineTo(0,_root.gallery_height);
  85. mask_mc.lineTo(0,0);
  86. container_mc.setMask(mask_mc);
  87. }
  88. function scrolling() {
  89. _root.onEnterFrame = function() {
  90. container_mc._y += Math.cos(((mask_mc._ymouse)/mask_mc._height)*Math.PI)*15;
  91. if (container_mc._y>mask_mc._y) {
  92. container_mc._y = mask_mc._y;
  93. }
  94. if (container_mc._y<(mask_mc._y-(container_mc._height-mask_mc._height))) {
  95. container_mc._y = mask_mc._y-(container_mc._height-mask_mc._height);
  96. }
  97. };
  98. }

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 13 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
 
 

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