It looks like you need xfactorstudio's xml xpath :) And yes, Flash can do what you need it to do here
On 9/1/06, Jeff Brown <[EMAIL PROTECTED]> wrote:
Hello List. I'm a programer with a good background in PHP, Smarty, MySql, javascript and other web technologies. I'm working on an application that needs to blend PHP and Flash components together. Since I haven't touched flash since way back in the dark ages, I'm a little put off at the current interface. (Not in a 'I-hate-you' way, but more in a 'Will-this-do-what-I'm-thinking' way). Okay, this boils down to two different questions. Esentially the app is a database driven lookup engine. The PHP/Smarty will decide based on user input and business logic to display an item. The PHP templates need to write out the HTML/XHTML for a Flash component. Question 1: Assuming my item id is "123" and my template writes: <param name="i_id" value="123" /> into the <object></object> block, can my flash's action script 'get' the variable i_id. And would my action script be able to use i_id as a variable directly? (I've seen some sort of confirmation of this on the list, but no qualitative answer). Question 2: Now assuming my flash has the id, it needs to load an XML file from the web server, based on the id. as in http://my.server.com/myapp/xmlfile123.xml Obviously interpolating the value of i_id into the url it uses. (behind the scenes, the server uses an URL Rewrite to map http://my.server.com/myapp/xmfile123.xml to http://my.server.com/xmlgen.php?i_id=123 which is a PHP script that 'speaks' XML and produces an xml file filled with database data) The xml contains a list of categories and their colors and a list of related items and their details that will be something like the following: -----------------------xml code--------------- <data> <grouplist> <group id="1" name="a group name" bgcolor="#aabff" fgcolor="#882299" highlight="#999933" /> <group id="2" name="the second name" bgcolor="#bbaaee" fgcolor="#882299" highlight="#AA8844" /> ... </grouplist> <itemlist> <item id="456" group="1" name="my first item name" url="http://my.server.com/myapp/show/456 " /> <item id="789" group="1" name="another item name" url="http://my.server.com/myapp/show/789 " /> <item id="333" group="2" name="third name" url=" http://my.server.com/myapp/show/333" /> ... </itemlist> </data> ----------------------/xml code--------------- With me so far? In theory, I can use the action script call: -------------------------code ------------ getxmldata = new XML(); getxmldata.load("xmlfile" + i_id + ".xml", ""); ------------------------/code ------------ to load this up. I've seen some examples of this. And I've seen examples of loading the attributes for a give 'node' (as in the group or item tags above). But I'm not sure how to process the grouplists and itemlists. I mean do you think this could be processed with: ---------------------------------code------------------------- /* ** Note, I'm basing nearly all of this on code examples, but I'm flying halfway blind. I'm not certain that an XML sub object ** suports 'firstChild", 'lastChild' or 'nextSibling' If not, I'd like to know what to use. */ if (getxmldata.loaded) { var grouplist = getxmldata.firstChild; var itemlist = getxmldata.lastChild; var groups:Array = []; var items:Array = []; var last = grouplist.lastChild; var group = grouplist.firstChild; do { groups[group.attribute.id] = group; group = group.nextSibling; } while (group != last); last = itemlist.lastChild; var item = itemlist.firstChild; do { items[item.attribute.id] = item; item = item.nextSibling; } while (item != last); } --------------------------------/code------------------------- Or is there a better way to handle all of this? Just hoping for either some pointers, or general help Jeff _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
-- Ramon Miguel M. Tayag _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com