LOADING
Loading
Hi , welcome back.
LogoutLOGOUT
 
  Lost password?  
Hi
 


  #1  
Old 11-06-2008, 09:21 PM
briosac briosac is offline
Registered User
 
Join Date: Nov 2008
Posts: 3
Rep Power: 0
briosac is on a distinguished road
image Count

I've read in some photos from xml. My code duplicates a mc and places a number of clips on the page. The clips have a button function. When you rollOver the button I want a dynamic text field to display the image number and total number as in: 1/14 where "1" increments based on the image that is being targeted by rollOver.

Any ideas?
Reply With Quote
  #2  
Old 11-07-2008, 08:10 AM
[PAUL FERRIE]'s Avatar
[PAUL FERRIE] [PAUL FERRIE] is offline
Glasgow Flash Developer
 
Join Date: Feb 2005
Location: United Kingdom
Posts: 7,756
Rep Power: 16
[PAUL FERRIE] is on a distinguished road
Need to see what you have already.
Can you post the code you using to load xml and populate mc's with the images.
__________________
.:To me AS is like LEGO, Only for the big Kids :.
- Site - Blog - Glasgow Flasher - Activeden

- bringmadeleinehome.com
Reply With Quote
  #3  
Old 11-07-2008, 01:12 PM
briosac briosac is offline
Registered User
 
Join Date: Nov 2008
Posts: 3
Rep Power: 0
briosac is on a distinguished road
image count

Thanks Paul,
I've got two sections, one that loads images, one that handles the rollover.
Actionscript:
for the main images/xml load:
// The thumbnails are on the right side
// The following is for the thumbnails and big image
var myXML2:XML = new XML();
myXML2.ignoreWhite = true;
myXML2.load("gallery.xml");
var thumbPath:Array = Array();
var picPath:Array = Array();
var link:Array = Array();
var imgNum:Array =Array();

_root.gapH = 7.25;
// horizontal space
myXML2.onLoad = function(success) {
	displayPage();
};

function displayPage() {
	//var originY = 22.5;
	var originY = 0.0;
	delete rightBtn.onEnterFrame;
	delete leftBtn.onEnterFrame;
	
	xml = myXML2.firstChild;
	var numberOfItems:Number = xml.childNodes.length;
	var numberPerScreen = 8;
	var integer:Number = Math.floor(numberOfItems/numberPerScreen);
	var remainder:Number = numberOfItems%10;
	var maxRightClickTime:Number = 0;
	//if total imgs over 10
	if (remainder == 0) {
		maxRightClickTime = integer-1;
	} else {
		maxRightClickTime = integer;
	}
	var leftClickTime:Number = 0;
	var rightClickTime:Number = 0;
	var currentTarget:Number = 0;
	var currentCount:Number = numberOfItems;
	
 // End of the function
	
	
	leftBtn._visible = true;
	//if total imgs less than 10 or equal 10
	if (numberOfItems<=numberPerScreen) {
		rightBtn._visible = false;
	} else {
		rightBtn._visible = true;
	}
	
	currentTarget = 0;
	
	rightBtn.onRelease = function() {
		leftBtn._visible = true;
		rightClickTime++;
		if (rightClickTime == maxRightClickTime) {
			rightBtn._visible = true;
		}
		
		currentTarget = originY-(mask._height+_root.gapH)*rightClickTime;
		this.onEnterFrame = function() {
			diff = currentTarget-mc_thumbnail._y;
			mc_thumbnail._y += diff/4;
			
		};
		
	};
	
	
	leftBtn.onRelease = function() {
		rightBtn._visible = true;
		rightClickTime--;
		leftClickTime++;
		if (rightClickTime == 0) {
			leftBtn._visible = true;
		}
		
		
		currentTarget = originY-(mask._height+_root.gapH)*rightClickTime;
		
		this.onEnterFrame = function() {
			diff = currentTarget-mc_thumbnail._y;
			mc_thumbnail._y += diff/4;
			
		};

	};
	
	
	for (var i = 0; i<numberOfItems; i++) {
		thumbPath[i] = xml.childNodes[i].childNodes[1].childNodes[0].nodeValue;
		picPath[i] = xml.childNodes[i].childNodes[2].childNodes[0].nodeValue;
		link[i] = xml.childNodes[i].childNodes[3].childNodes[0].nodeValue;
		
		
		mc_thumbnail.img.duplicateMovieClip("img"+i, i);
		mc_thumbnail["img"+i]._y = mc_thumbnail.img._y+i*(mc_thumbnail.img._height+_root.gapH);
		
		
		if (thumbPath[i] == "undefined") {
			mc_thumbnail["img"+i].enabled = false;
		} else {
			
			mc_thumbnail["img"+i].enabled = true;
			
			mc_thumbnail["img"+i].img_mc.loadMovie(thumbPath[i]);
			
		}
		mc_thumbnail["img"+i].thePicPath = picPath[i];
		mc_thumbnail["img"+i].theLinkURL = link[i];
		
		
		
	}
	mc_thumbnail.img._visible=false;
	
	
	//load the first big image   
	getFirst(picPath[0],link[0]);
	
}


//for loading first big image
function getFirst(thePicPath:String,link:String) {
	_root.theBigImageContainer = _root.main.big_mc.big_mc_image;
	_root.theBigImageContainer.loadMovie(thePicPath);
	
			
	_root.theBigImageContainer._alpha = 10;
	this.a_mc.onEnterFrame = function() {
			if (_root.theBigImageContainer.getBytesLoaded()==_root.theBigImageContainer.getBytesTotal() && _root.theBigImageContainer.getBytesTotal()!=4) {
				delete _root.main.a_mc.onEnterFrame;
				_root.main.changeColor();
	_root.theBigImageContainer._alpha = 100;
				
			}
	};
		
	_root.main.big_mc.onRelease = function() {
		getURL(link, "_blank");
	};
	
	if (link == undefined) {
		_root.main.big_mc.enabled = false;
	} else {
		_root.main.big_mc.enabled = true;
	}
	
}

var imN:Number=1;
_root.main.imgNumber_txt.htmlText=imN;

function changeColor():Void {
	var colorComponent:Number = 100;
	
	onEnterFrame = function () {
		myColor = new Color(_root.main.big_mc.big_mc_image);
		myColTr = new Object();
		colorComponent += (100-colorComponent)/10;
		myColTr = {ra:colorComponent, ga:colorComponent, ba:colorComponent};
		myColor.setTransform(myColTr);
		
		if (Math.round(colorComponent) == 100) {
			delete this.onEnterFrame;
			colorComponent=500;
		}
		
	};
}

stop();


AND FOR THE ROLLOVER:

on (rollOver) {
	theBigImageContainer = _root.main.big_mc.big_mc_image;
	theBigImageContainer.loadMovie(thePicPath);
	theBigImageContainer._alpha = 0;
	_root.main.a_mc.onEnterFrame = function() {
			if (_root.theBigImageContainer.getBytesLoaded()==_root.theBigImageContainer.getBytesTotal() && _root.theBigImageContainer.getBytesTotal()!=4) {
				delete _root.main.a_mc.onEnterFrame;
				_root.main.changeColor();
				theBigImageContainer._alpha = 100;
				
			}
	};
	
	_root.main.big_mc.onRelease = function () {
			getURL(theLinkURL, "_blank");
		}
		
	if (theLinkURL == undefined) {
		_root.main.big_mc.enabled=false;
	} else {
		_root.main.big_mc.enabled=true;
	}
}

on (rollOver) {
	colorComponent = 500;
	onEnterFrame = function () {
		myColor = new Color(this);
		myColTr = new Object();
		colorComponent += (100-colorComponent)/10;
		myColTr = {ra:colorComponent, ga:colorComponent, ba:colorComponent};
		
		myColor.setTransform(myColTr);
		//trace(colorComponent);
		if (Math.round(colorComponent) == 100) {
			delete this.onEnterFrame;
			colorComponent=500;
		}
	};
	mask._alpha=100;
	
}

on (rollOut) {
	mask._alpha=0;
}

Last edited by [PAUL FERRIE] : 11-07-2008 at 01:19 PM Reason: read my footer
Reply With Quote


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Zoom into part of image -- image goes beyond stage area krrdummy Newbies 1 12-21-2009 06:08 AM
Actions Losing Updates antad6 Flash CS3 / Flash 9 0 03-27-2009 04:00 PM
Dynamic Image Load Centre Issue leelee Flash MX ActionScript 0 12-26-2008 01:05 PM
Movie clip resize not working when image is loaded clem_c_rock General Flash 3 11-01-2007 06:11 PM
exported image gets cut off at 4000px gregonzola General Flash 3 08-07-2007 10:36 PM




All times are GMT. The time now is 12:51 PM.