Solved

Problems clicking on movie clip dynamically put in

Posted on 2007-11-30
2
174 Views
Last Modified: 2010-04-21
Hi again experts,

I just received help loading movie clips specified by a XML file.  Now I am tryin to figure out how to click on the movie clip and have it do somthing.  I have done this in the past, but it is not working for me for some reason.  Here is the code:

Thanks for your help
xmlBackFile = "/flashgadgets/images/backgrounds.xml";
xmlBack = new XML();
xmlBack.ignoreWhite = true;
xmlBack.onLoad = loadXMLBack;
xmlBack.load(xmlBackFile);
var imageNames:Array = Array();
function loadXMLBack(loaded) {
	if (loaded) {
		xmlNode = this.firstChild;
		totalNodes = xmlNode.childNodes.length;
		for (j=0; j<totalNodes; j++) {
			imageNames.push(xmlNode.childNodes[j].childNodes[0]);
		}
		listBackgroundTiles();
	} else {
		trace("Background file not loaded");
	}
}
function listBackgroundTiles() {
	arrayength = imageNames.length;
	bxpos = 5;
	bypos = 5;
	perLine = 1;
	for (m=0; m<arrayength; m++) {
		tileName = "bTile"+m;
		tilePath = "_root.backgroundsBox."+tileName;
		_root.backgroundsBox.attachMovie("backgroundLoader", tileName, 500+m);
		eval(tilePath).loadMovie("/flashgadgets/images/"+imageNames[m]);
		eval(tilePath)._height = 50;
		eval(tilePath)._width = 50;
		eval(tilePath)._y = bypos;
		eval(tilePath)._x = bxpos;
		if (perLine<2) {
			bxpos = bxpos+55;
			perLine++;
		} else {
			bxpos = 5;
			bypos = bypos+55;
			perLine = 1;
		}
		eval(tilePath)._onRelease= function(){
			trace("Moiveclip is clicked"); //THIS IS WHAT IS NOT WORKING.  Mouse doesn't even change to hand shape.		}
	}
}

Open in new window

0
Comment
Question by:paries
2 Comments
 
LVL 37

Accepted Solution

by:
CyanBlue earned 500 total points
ID: 20385000
The deal is that the content of the movieClip gets cleared once the new image is loaded into that bucket, hence onRelease does not work at all...

You can use MovieClipLoad and assign those variables/handlers to the movieClip once the external file is fully loaded by using the onLoadInit hander...  Check it out...  ;)

CyanBlue
0
 

Author Closing Comment

by:paries
ID: 31412021
Took a little bit to fugure out but got it working.  Thanks
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Powershell variable with -SearchBase cmdlet 2 120
exchange 2007, scripts 15 79
copy-item script help 15 77
Quickest way to query Windows Event ID from a Linux Device 3 33
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question