Web Hosting Deals Holiday Logo Design Website Header Templates Register domain Search Engine Optimisation Web Hosting
Go Back   Talk Mania Forum > Flash and ActionScript

Flash and ActionScript General Flash/ActionScript help, tips, tricks and stumbling points can be posted and answered here!

 Image
Buy Sell Downloads

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-10-2007, 04:14 PM
Junior Member
 
Join Date: Mar 2007
Posts: 4
fido.glc is on a distinguished road
What is wrong ?

I put a number of instances of a movie clip from the library on the stage and I need a method to work for all of those instances which I name 'mc_file1', 'mc_file2' and so on. Here is the code. I think there is a problem with the path.
Code:
// Variables declarations
var counter:Number;
var totalTracks:Number;
var loadVars:LoadVars = new LoadVars();

// Loads an external file
loadVars.load("totalTracks.txt");

// When finished loading
loadVars.onLoad = function():Void {
	totalTracks = Number(loadVars.totalTracks);
	
	// Creates 'totalTracks' number of instances
	for(counter = 1; counter <= totalTracks; counter++) {
		mc_clipX.attachMovie("mc_file", "mc_file" + counter, currentDepth + 1, {_x:5, _y:5 * counter});
		currentDepth++;
	}
	
	// Until this point everything works fine. But this method does not work. What is the problem ?
	_root['mc_clipX.mc_file' + 1].onRollOver = function():Void {
		this.gotoAndStop("over");
	}

	// ------------------------------------------------
	// If I put this it works:
	mc_clipX.mc_file1.onRollOver = function():Void {
		this.gotoAndStop("over");
	}
	// ------------------------------------------------

	// But I need this method to work for all the 'totalTracks' number of instances.
}


Last edited by fido.glc; 03-11-2007 at 04:35 PM.
Reply With Quote
  #2 (permalink)  
Old 06-12-2007, 01:16 PM
Junior Member
 
Join Date: Apr 2007
Posts: 10
robert_pal is on a distinguished road
You should use something like:

for (counter =1; i<=totalTracks; counter ++) {
this.mc_clipX.attachMovie("mc_file", "mc_file"+counter ,counter i);
this.mc_clipX["mc_file"+counter ]._x = 0;
this.mc_clipX["mc_file"+counter ]._y = Math.round(this.mc_clipX["mc_file"+(counter -1)]._height+this.mc_clipX["mc_file"+(counter -1)]._y);
this.mc_clipX["mc_file"+counter ].onRollOver = function() {
this.gotoAndPlay("over");
};
}
Reply With Quote
  #3 (permalink)  
Old 06-30-2007, 10:36 PM
Junior Member
 
Join Date: Jun 2007
Posts: 20
Eko-5314 is on a distinguished road
Quote:
Originally Posted by robert_pal View Post
You should use something like:

for (counter =1; i<=totalTracks; counter ++) {
this.mc_clipX.attachMovie("mc_file", "mc_file"+counter ,counter i);
this.mc_clipX["mc_file"+counter ]._x = 0;
this.mc_clipX["mc_file"+counter ]._y = Math.round(this.mc_clipX["mc_file"+(counter -1)]._height+this.mc_clipX["mc_file"+(counter -1)]._y);
this.mc_clipX["mc_file"+counter ].onRollOver = function() {
this.gotoAndPlay("over");
};
}
yes then it will work

Reply With Quote
Reply

Bookmarks

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT +2. The time now is 07:03 AM.



Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC8
Forums Copyright © Talk-Mania.com