Link to home
Start Free TrialLog in
Avatar of mmucom
mmucomFlag for India

asked on

is there a way to unload a xml in flash

Hi,

can some one help me how to unload a xml from flash. basically i have a 9 square image thumbnail gallery on main time line each thumbnail is acting as a button.

1).if you click on any thumbnail image it will go to the same frame called "event gal"

2).on each thumbnail on release function i set it up in such a way should load the different xml files dynamically these things are working fine

3).i have back button on that "event gal" to come back the main gallery

4).let say i click on the first button from the main gallery. this should load the galler1.xml the gallery content loads in perfectly fine now click on the back button to return to the main gallery.

5).now if i click on the 2nd thumbnail button its going to the "event gal" here it should load the gallery2.xml. but before is loads the gallery2.xml i can still see the gallery1.xml content on the fields

how do i get rid of this problem any suggestion or any way to unload the xml while i click on the back button

Thanks,
Avatar of blue-genie
blue-genie
Flag of South Africa image

your problem isn't so much with unloading xml but rather unloading the content you've loaded.
so how you unload it will depend on how you created it in the first place.
i.e attachMovie  or addChild or which ever approach you used.
create a function that clears the frame, i.e. removes everything, and call that function each time you click a thumbnail.

AS2 or AS3?
if you need specifics i'll need to see the code you're using to create the contents.
Avatar of mmucom

ASKER

Hi blue-genie;

thanks for your reply..

yes my problem is unloading the content. see when you click on the thumbnail 1 from the main gallery that is going to "event gal" frame. there i have the following script to remove the dynamically loaded images from the 9 square image thumbnail gallery

var total = dataObj.length;
for (var i = 0; i<total; i++) {
    this['item'+i].removeMovieClip();

}

this "item" is duplicate Movie Clip so when the gallery1.xml is loading in the "event gal"
using the above script it removes the duplicated movie clip's. after that only it loads the gallery1.xml.

so is there a way to do the same thing for the second set of gallery movie clips also????

and its a AS2 if you still not clear ill attach the entire code..

Thanks again,
ASKER CERTIFIED SOLUTION
Avatar of blue-genie
blue-genie
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mmucom

ASKER

Hi blue-genie,

1).first i am setting up an array because i might want to add more gallery in the future on the main gallery

var galObj:Array = new Array();



2).next i am loading the xml here

var xmlImages:XML = new XML();
xmlImages.ignoreWhite = true;
xmlImages.load("main.xml");



3).attaching the child nodes for xml here in the forloop

for (var i:Number = 0; i < total; i++) {
           
            galObj[i].xml = images[i].childNodes[3].firstChild.nodeValue;



4).here is the on release function

thum1.onRelease = function() {
                _root.subgal = galObj[this.i].xml;
                _root.gotoAndStop('event_gal');
 };



5).on event_gal frame lable i removing the 9 square thumbnail gallery using the following code

var total = dataObj.length;
for (var i = 0; i<total; i++) {
this['item'+i].removeMovieClip();
}

6).loading the sub gallery xml like this

xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad =loadXML;
xmlData.load(subgal);

this is how i am getting my xml data into my flash file.. one important thing in the main.xml
i got all the sub gallery xml linked by calling the [3] rd childNodes

i hope u clear enough

Thanks,