0
votes

I have a Flex Application I'm working on with a group. It's a simple travel agency where our data pulled from a URL and stored in an XML object.

Currently we have our application structured with the layout being similar to a webpage. With the application file holding the main look and layout (Header container, body container, and footer container).

I have other mxml component files which has the contents of the application (header component class, page1, etc.). However these pages will need to manipulate the data I'll be taking in.

The basic idea was to load the data in the application after it's built and pass a copy of the original xml list to whatever page the user is currently on to modify the copy when they query their search parameters with the Flex XML object class. Essentially starting big (All vacation spots) and getting more specific (Several from the specified parameters chosen).

I was thinking of passing the copy with strings (Namely .toXMLString) and create another XML object with that modified XML String in each page, but not sure on how to pass that string object.

However I'm a bit confused of how to do this since when searching on my own for examples it ranged from creating events, creating an actionscript file that will be global, and people suggesting have a bindable public var in my application. So it's a bit confusing. I'm not looking for a full blown solution, just something basic I can work on and play around with then implement into this application after I have a good understanding of it.

1
This does actually. I'll look into it and try to get an example from that. Thanks.DrTran

1 Answers

0
votes

The example posted by Reboog711 was exactly what I was looking for. I was able to implement an example and get the functionality I wanted into my application.

EDIT: Unable to mark this as the answer until 2 days.

EDIT #2: I solved it by using the Metadata and defining Events for each MXML file that took in parameters.

I defined these in my component MXML:

MXML Component File:

<fx:Metadata>
    [Event(name="customEvent", type="flash.events.Event")]
</fx:Metadata>

And then define a var object to take in the object, and method in that MXML component:

public var someObject:Object = new Object();
public function setObject(objectRef:Object):void{
    xmlList = new XML(xmlString);
}

Then in your MXML Application file when you use your component you can do the following to invoke your event:

<[Package]:[Component Name] id="id" includeIn="[State]" passXML="id.someObject(passedObject)"/>