Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Flash ActionScript 2 HELP attachMovie refuses to work

Posted on 2008-09-30
7
1,051 Views
Last Modified: 2013-11-11
This code works perfectly in on project - but not this one.

XML loads perfectly
Loops work
Declarations work
Array Works

But the attachMovie refuses to do anything.
As I said, this works in another project - just not this one.

I tried setting the library item to "export" but it's not set that way in the other project AND it didn't fix it this time.

The only real difference betweeen projects, that that this SWF is embedded one level deeper.

Old File: _level0.container_r.contentMain_mc
This File: _level0.shell_mc.loader_r.contentMain_mc

What am I missing? Or do I need to post more?
var floorplanArray:Array = new Array();
 
var myxml:XML = new XML();
myxml.ignoreWhite = true;
myxml.onLoad = function(success) {
	trace("success");
	var comm = "aaa"
	var itemY = this.firstChild.childNodes;
	if (success) {
		// Scroller XML
		var newY = 0;
		for (var j:Number = 0; j < itemY.length; j++) {
			var comm = myVariables.getNewComm();
			var srchComm = itemY[j].firstChild.firstChild.nodeValue;
			if (srchComm == comm) {
				trace(j+" - "+comm+" ok"); //returns 1 - aaa ok
				var temp_mc:MovieClip = shell_mc.loader_r.contentMain_mc.attachMovie("itemY","itemY"+j,j);
				temp_mc._y += newY;
				newY = newY+(temp_mc._height + space);
				contentMain_mc.back_mc._height = j * (temp_mc._height + space);
 
				trace(itemY[j].firstChild.firstChild.nodeValue);
				temp_mc.planComm = itemY[j].firstChild.firstChild.nodeValue;
				temp_mc.planID = itemY[j].childNodes[1].firstChild.nodeValue;
				temp_mc.planName = itemY[j].childNodes[2].firstChild.nodeValue;
 
				floorplanArray.push(temp_mc.planComm);
				floorplanArray.push(temp_mc.planID);
				floorplanArray.push(temp_mc.planName);
 
				//Scroller Display 
				url = srcPl + job + "pl_" + temp_mc.planComm + "-" + temp_mc.planID + ".swf";
				loader.loadClip(url,temp_mc.item_floorplan);
 
				temp_mc.onPress = function(planID) {
					changeMasterPlan(this.planID);
				};
				
				trace("temp_mc test:");
				trace("  temp_mc.planComm: "+temp_mc.planComm); // returns perfectly
				trace("  "+temp_mc.planID); //returns undefined
				trace("  "+temp_mc.planName); //returns undefined
				trace("  "+temp_mc._y); //returns undefined
			}
		}
		contentMain_mc.item0.onRelease();
		//startPreload(item[0].childNodes[1].firstChild.nodeValue);
	} else {
		trace("error");
	}
	
 
	
};
myxml.load(path);
contentMain_mc.createEmptyMovieClip("back_mc",this.getNextHighestDepth());
contentMain_mc.setMask(maskedView);
trace(contentMain_mc); //returns _level0.shell_mc.loader_r.contentMain_mc

Open in new window

0
Comment
Question by:LazarusBlack
  • 5
  • 2
7 Comments
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 22607893
For your info,

AttachMovie cannot be used to attach a movieClip inside an externally loaded SWF.
This is not allowed and not possible in any way..

-------------------
Aneesh Chopra
-------------------
0
 

Author Comment

by:LazarusBlack
ID: 22608050
I'm sorry but you are not correct. As I said, it works here perfectly:

http://betalennar.zadv.com/_WebSites/Plasma/index.htm

The "shell.swf" uses containerPrime.loadMovie("xxx") to load fp-r.swf which in turn uses the script posted above. Works GREAT!

But I'm updating this same project to a slight different configuration. The new configuration uses:

"shell.swf" to load "timeline.swf" which then loads "fp-r.swf".

Now, it's not working. Need another solution.



0
 

Author Comment

by:LazarusBlack
ID: 22608067
Wait. Maybe you misunderstood - the attachMovie is inside the fp-r.swf,

You would be correct if I was using attachMovie from shell.swf or timeline.swf.

Still need a solution.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 22608121
I got it right,
trying to explain it again..

MovieClip.attachMovie method uses a linkageID of an library item..
I want to explain that, linkageID of the library of an SWF can't be attached in any child SWFs movieClip..

earlier, you were loading "timeline.swf" into "shell.swf" and attachMovie command may be inside "timeline.swf" and which might be using the linkageID of a library Item of "timeline.swf" which means attaching in same SWF which were working..

now you may be trying to attach the linkageID item of the library "timeline.swf" into the movieClip of "fp-r.swf"
as per my explaination that will not work.
0
 

Author Comment

by:LazarusBlack
ID: 22608291
Thank you.

>you may be trying to attach the linkageID item of the library "timeline.swf" into the movieClip of "fp-r.swf"

I am not trying to do this.

The linkage is inside "fp-r.swf" drawing in "1.swf, "2.swf" or whatever the XML wants.

Does that help?
0
 

Author Comment

by:LazarusBlack
ID: 22609312
I am now confident that there is nothing wrong with the code.

It's some other feature of Flash attaching movies that I don't know that is the problem.
0
 

Accepted Solution

by:
LazarusBlack earned 0 total points
ID: 22610704
found the culprit. there was a corrupt container_mc requiring the inclusion of 2 other empty mc!!!

once I copied the 2 missing mcs from the old working file into the new file, everything worked.

still can't figure out how the master container references them. one is listed as 'for export' but i can't find any object on the stage OR any declaration in the code.

Thanks anyway.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

829 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