flash / xml
- Started
- Last post
- 13 Responses
- rabattski
need a little help. got some flash xml issues.
take this test xml for instance:
http://www.sckr4bmb.com/dropbox/…the xml is used to generate a dynamic menu.
TEST is the menu name, the menu initially consists of A, B and C.
A.1, A.2 etc. will fold out on rollover.
problem: i need to figure out to what menu an item belongs in flash at a rollover. for instance when i rollover B.2.1 i need to know that it belongs to B.2 by using flash.
could be that from the ground up i coded it all wrong. any help is ofcourse appreciated a lot.
- PixelDrama0
not knowing what your code looks like.... make sure that you are giving each item a name as iyou are looping through each item in the loading sequence of the xml. meaning, well.. you can do this many ways, one of wich is loading each menu item into its own moving clip and naming the instance accordingly, or using an eval statement to name a variable name acordingly.. hope this helps. :/
- PixelDrama0
oh my, i dont really like how you are labeling your xml either, your going to confuse the hell out of yourself.
- UndoUndo0
parse the xml into an object??
- rabattski0
yeah i think i'm totally driving myself crazy here. the code is based on kirupa's xml driven drop down menu and it's tweeked to fit the needed functionality but i think i should start from scratch because some functionalities it seems i can't build in. bummer. xml is my weakpoint.
- rabattski0
undo, what do you mean exactly with parsing it into an object?
- zackgilbert0
can't you just substring the item name? being that "b.1.1" belongs to "b.1". similar to a last instance of type of thing.
but i do agree, you are going to get confused with how you have it set up now.
- PixelDrama0
ive done something similiar to what your trying to acomplish and as i loaded in the XML i loadeded each item into a mc with a button, and from there named the instance of the clip... then in the button i wrote a function that executes and grabs the instance name of whatever you clicked on and does what it needs to do from there.
- rabattski0
that is what the karupa code's doing as well. the functionality i've added is a) sliding from bottom to top (works) b) when the submenu items are longer than the initial menu it's compensated by more negative sliding (that works). problem is it partially works when it needs to slide back, hence i need to figure out to what menu the items belong.
i think it's wiser to start from scratch knowing now what it needs to do and go from there.
argh. i so do not like xml but it's so handy dandy.
- rabattski0
so what would be the best way to create a xml driven menu when i want to keep as much control as possible?
- UndoUndo0
assuming their is a regular format to your xml I would setup a function that looks at the number of children in yr xml sorts through it and puts all yr information into objects.
This also allows you to add in extra info to your objects.
At the end of the routine call yr drop down menu creator function and pull the data from the objects that you have created.
??
- rabattski0
thanks i definitely have to look into that undo. makes more sense. cleaner coding as well, at this point it's patching with if then else constructions. fixed it though for now, took me about one zillion trace commands, still one small bug to go and i'm done. although when i have time later on i might rewrite it to a cleaner / more workable code in a way you suggested.
- UndoUndo0
have you looked into amfphp yet?
very interesting and their about to release the 1st non beta version. in short dataTypes between flash and php are maintained which may well remove the need for xml in certain instances
- rabattski0
well at this point it's unclear if the site's gonna run php so i have to keep php out of the loop for now (still have to check that out btw, thanks for reminding me).