Jump to content
GreenSock

icekomo

Using loaded xml data from a preloader class fiile

Recommended Posts

Round 2:

Ok so I'm just starting to get into the OOP of as3, but as a designer it's hard for me to wrap my head around some of these concepts. I have a site built out already(which I will go back and reset up as a modleViewController, but for now I just need to get this last aspect of it working. Here is what I have:

preloader.fla

Preloader.as

main.fla

Main.as

 

so I have a preloader fla linked up to a preloader.as class, which is using loaderMax to load 2 things, the main.fla(main.swf) and an xml file that has data for the main.swf. I need to make sure the xml data loads first, before the main.swf file, which it does. I am able to trace the xml data when it loads, so I know it's been loaded. Here is where i get lost. So once the main swf is loaded and it's now using the Main.as file to function as a website. How am I able to use the xml var from the preloader.as file for the main.as file. So that I can populate my textFields with data that my Preloader.as file loaded.

 

I hope this makes sense, and if there is any code I need to post just let me know, I tried to explain it, in the most basic way I know how.

Thanks :)

Link to comment
Share on other sites

There are many ways to do this.

 

1) In your child swf (as long as it's loaded into the same securityDomain which it should be by default), simply get the content from LoaderMax by name like:

var xml:XML = LoaderMax.getContent("myXMLLoaderName");

 

-OR-

 

2) Pass the data to your child swf directly using a public method in your root (Main) class. Like if you're using a SWFLoader to load it, you'd do:

 

Object(mySWFLoader.rawContent).applyXML( LoaderMax.getContent("myXMLLoaderName") );

 

-OR-

 

3) Just load the XML directly into your child swf with its own XMLLoader.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×