Welcome, Guest. Please login or register.
Did you miss your activation email?
02/07/12, 08:55
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  General
| |-+  Flash MX 2004 (Moderators: Flash-db, Musicman, vesa kortelainen, Ronald Wernecke, Andresss, papachan)
| | |-+  Flash and xml photo gallery
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Flash and xml photo gallery  (Read 2153 times)
damon
Jr. Programmer
**
Posts: 94



View Profile Email
« on: 06/09/09, 18:24 »

Hello Everyone.
I founded an Flash and xml photo gallery. It works but I took it to another step
What I want is to have six different galleries in one Flash file. I figure out how to do that but
when I click on the the galleries I can see the pervious gallery files.

The gallery works like this:
When you open the gallery there are links on top of the page where you can go to other gallery; with gallery one which has small thumbnails on the left, if you place the mouse on thumbnails a larger photo will appear in the middle.
If you click on the link for gallery two the page reloads and shows you gallery two, but it will still have some of the thumbnails from gallery one.

Is there a way to refresh the page.

here is the code.
var myGalleryXML = new XML();
myGalleryXML.ignoreWhite=true;
myGalleryXML.load("gallery_buildings.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=0i<_root.myImagesTotali++) {

	
	
thumbURL=myImages[i].attributes.thumb_url;
	
	
myThumb_mc=container_mc.createEmptyMovieClip(i,container_mc.getNextHighestDepth());
	
	
myThumb_mc._y=_root.thumb_height*i;
	
	
clipLoader.loadClip("buildings/3rd/"+thumbURL,myThumb_mc);

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

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

	
	
preloader.onLoadComplete=function(target){
	
	
new 
Tween(target"_alpha"Strong.easeOut0100.5true);
	
	
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",target.getNextHighestDepth(),0,295,200,20);
	
target.my_txt.selectable false;
	
};

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

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

	
fullClipLoader.loadClip("buildings/"+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() {
	
  if (
mask_mc._ymouse<(mask_mc._height*(1/3)) || mask_mc._ymouse>(mask_mc._height*(2/3))) {
	
     
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);
	
     }
        }
	
};
}

import mx.transitions.Tween;
import mx.transitions.easing.*;

I hope that made sense, I can post it on my website if need be,

Thanks any help would be great.
Nomad
« Last Edit: 06/10/09, 05:40 by Jorge Solis » Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14593


View Profile
« Reply #1 on: 06/10/09, 05:42 »

Seems you;re creating all inside container_mc

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

Just use removeMovieClip to remove container_mc prior the next load

Jorge
Logged

damon
Jr. Programmer
**
Posts: 94



View Profile Email
« Reply #2 on: 06/10/09, 20:29 »

Jorge;

I have this already in my code:
Code:
function callThumbs() {

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

Is there somewhere else I need to at the
Code:
_root.createEmptyMovieClip("container_mc",_root.getNextHighestDepth());

Thanks
Damon


Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14593


View Profile
« Reply #3 on: 06/11/09, 05:22 »

If you create a container to put the all thing

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

When you want to create a new Gallery, begin destroying the container

_root.removeMovieClip(container_mc)

This way the whole content will dissapear. If you create things outside container, then consider to put all inside it

Jorge
Logged

Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
anything