Jump to content

XML Gallery help


nomadrw

Recommended Posts

Hello everyone:

 

I need a little help here in adding a two other text fields for an xml Gallery.

 

Here is the flash action Script

var myGalleryXML = new XML();
myGalleryXML.ignoreWhite = true;

myGalleryXML.load("fine_arts.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.removeMovieClip());
_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<_root.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.removeMovieClip(container_mc);

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(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",target.getNextHighestDepth(),0,295,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("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.*;

 

Here is the XML code

<gallery thumb_width="120" thumb_height="120" gallery_width="120" gallery_height="400" gallery_x="50" gallery_y="125" full_x="220" full_y="125">
<image thumb_url="balboa_sm.jpg" full_url="balboa.jpg" title="balboa.jpg" subtitle2="Mansonite" subtitle3="$400.00"/>
<image thumb_url="surf_sm.jpg" full_url="surf.jpg" title="balboa.jpg" subtitle2="Mansonite" subtitle3="$400.00"/>
</gallery>

 

What I want is the photo then the title below it then the subtitle below that and then the subtitle below that.

 

Any Help would be great

thanks

damon

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.