Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 02-08-2004, 05:32 PM   #1
suhayda
Registered User
 
Join Date: Jan 2004
Posts: 16
Default need help...

Hey all,

I have an interesting (and frustrating) problem. I have made this actionscript, that generates movieclips according to data extracted from an XML file. I would like to remove all these movieclip when moving on to another frame. The interesting thing is, I use the same code for both the generating as well as the removal of these clips, except for the "removeMovieClip" Syntax instead of the "duplicateMovieClip"

The duplication works perfectly and I get all my points plotted, however when I try to remove them sor some reason I get only half of my clips removed as if I had the k++ in my loop twice.
On a closer look I found that it simply can't find every second movieclip that it searches for. Specifically if you look down in the remove clip function, the following " if (dataset[k].nodeName == "set") " returns NULL for every other value...

Hope someone uderstands this... I am freaking out...


XMLDoc = new XML();
XMLDoc.ignoreWhite = true;
xmldocurl = _root.dataurl;
if (xmldocurl.length<1) {
xmldocurl = "Data.xml";
}
XMLDoc.load(xmldocurl);
XMLDoc.onLoad=function(){
var i=0
cldnodes = new Array();
cldnodes = XMLDoc.childNodes;
for (j=0; j<=cldnodes.length; j++) {
if (cldnodes[j].nodeName.toUpperCase() == "GRAPH") {

dataset = cldnodes[j].childNodes;
for (k=0; k<=dataset.length; k++) {
if (dataset[k].nodeName == "set") {
arg=dataset[k].attributes.name
//strtext="<B>" + dataset[k].attributes.name + " :</B><BR>" + dataset[k].attributes.count + " deals from $" + dataset[k].attributes.from
//setProperty ( arg, _visible, true);
//EventHandler(arg, strtext);
duplicateMovieClip (_root.mainmovie, arg, dataset[k].attributes.level);
trace(k+" "+arg+" "+_root[arg].getDepth());
// p=project(dataset[k].attributes.x,dataset[k].attributes.y)
// px=p.x
// py=p.y
// setProperty (arg, _x, 425);
// setProperty (arg, _y, 270);

setProperty (arg, _x, projectx(dataset[k].attributes.y,dataset[k].attributes.x));
setProperty (arg, _y, projecty(dataset[k].attributes.y,dataset[k].attributes.x));
setProperty(arg,_visible,true);
}
}
}
}
}




REMOVING THE CLIPS:


on (release) {
trace (k)
XMLDoc = new XML();
// XMLDoc.ignoreWhite = true;
xmldocurl = _root.dataurl;
if (xmldocurl.length<1) {
xmldocurl = "Data.xml";
}
var arg
var d
XMLDoc.load(xmldocurl);
XMLDoc.onLoad=function(){


cldnodes = new Array();

cldnodes = XMLDoc.childNodes;
for (j=0; j<=cldnodes.length; j++) {
if (cldnodes[j].nodeName.toUpperCase() == "GRAPH") {
dataset = cldnodes[j].childNodes;
for (k=0; k<=dataset.length; k++) {
if (dataset[k].nodeName == "set") {
arg=dataset[k].attributes.name


trace(_root[arg].getDepth());
_root[arg].removeMovieClip();
}
}
}
}
}
suhayda is offline   Reply With Quote
Old 02-09-2004, 01:12 PM   #2
myarro
Registered User
 
myarro's Avatar
 
Join Date: Sep 2003
Posts: 66
Default

Use an array to track the specific names of the MovieClips so that you can be sure to remove them all.
myarro is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:27 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.