views:

159

answers:

1

Hi there,

I'v made this question before, but I think it was to confuse. I gonna try again, as I can't change or make visible comments to that. Let's go!

I'm working on a photo portfolio to a friend of mine.

I have a main swf with a main class (SEE DIRECTORY STRUCTURE AT THE END). This class i use to create site layout and menu.

This website has a fluid layout and, as I'm a begginer, I can't access stage from sub-classes to resize or reposition, so I have to load the content pages at other swf files.

Each one of the pages/swf calls a different image gallery, and to construct this galleries I have a XMLGallery.as

Inside the swf file I have a click function that calls the image gallery like this:

function clickButton(e:MouseEvent):void {
    var gallerySample:MovieClip = new XMLGallery(stage, "xml/snfashion_xml.xml");
}

And within the XMLGallery.as I have this at the main XMLGallery function:

root.addChild(this, 0);
addChild(thumbContainer);
addChild(fullImageContainer);

Ok! It work perfectly fine. The gallery loads and is added to the mainFile.

But now I'm having this problem that is driving me crazy dude!

When I'm trying to navigate to other pages (swf loaded files) the XMLGallery remains there. Even unloading the swf that calls the XMLGallery.as. And I can't access XMLGallery object to unload it.

Tracing what I have at stage after XMLGallery is loaded, I get this:

name:instance60  type:object [object XMLGallery]
name:root1  type:object [object snMain]

MY PROBLEM IS: How can I access XMLGallery and unload it with a click event inside mainClass menu?

Please, I tryed to be more specific as possible... somebody help-me!!

Thanx!!!

Here is the structure of my project:

//MAIN DIRECTORY
  mainFile.swf
  page1.swf
  page2.swf
  page...

    //COM (SUB-DIRECTORY)
    mainClass.as
    XMLGallery.as

    //XML (SUB-DIRECTORY)
    snfashion_xml.xml
A: 

Yeah! I was talking to a programmer and the solution is very simple.... It was just take-off the addChild from within the function

root.addChild(this, 0);

And addChild when I declare the MovieCLip variable:

function clickButton(e:MouseEvent):void {
    var gallerySample:MovieClip = new XMLGallery(stage, "xml/snfashion_xml.xml");
    addChild(gallerySample);
}

It was a primary error, for children! But it happens everytime. At least this could help somebody one of these days.

Cheers for World**W**ide**W**eb!

Fabio Montone