Problems clicking on movie clip dynamically put in

Posted on 2007-11-30
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;


var imageNames:Array = Array();

function loadXMLBack(loaded) {

	if (loaded) {

		xmlNode = this.firstChild;

		totalNodes = xmlNode.childNodes.length;

		for (j=0; j<totalNodes; j++) {




	} 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)._height = 50;

		eval(tilePath)._width = 50;

		eval(tilePath)._y = bypos;

		eval(tilePath)._x = bxpos;

		if (perLine<2) {

			bxpos = bxpos+55;


		} 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

Question by:paries
LVL 37

Accepted Solution

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...  ;)


Author Closing Comment

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

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

911 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now