(Flex 3, AS3, but not really a Flex specific question) In short, I'm trying to search for text inside an XML file and return the node that contains it. I'm creating a search button to return XML nodes that contain the user-entered word. Problem is, it doesn't have to match exactly (meaning searching for "Apple" can return an array of any nodes that have attribute values that contain stuff like, "The apple does not fall far from the tree" or "I like apple stock"), and so also needs to search individual words in text nodes and return the parent node. I'm using Flex, but I'm pretty sure the XML classes are the same there as in Flash, so I thought someone here could help. If you know of any Flex components that would help with this, please chime in!
Also, if this solution requires regular expressions, know that I'm 1) an idiot when it comes to regular expressions, and 2) not sure how to mix XML and reg expressions anyway. So far, the following works to find any title attributes that match the search term if they EXACTLY match, but it does not find nodes that have text node content that matches the search term, or a node that contains part of the search term. (i.e. if the node "title" attribute contains, "The Dark Knight", if the user's search string is "Dark", it should find that node and return it as a match. Same with text nodes where there are large paragraphs.) Here is what I have so far. This will find a node from all the descendants where the title attribute matches the search term, but it has to match EXACTLY, and that's no very useful to me. var searchTerm:String = searchInput.text.toUpperCase(); var xmlListSearch:XMLList = xml.topics..topic.(attribute("title").toUpperCase() == searchTerm); var xmlFind:XML = new XML(xmlListSearch[0]); Who's tackled this before? I know it's fairly common, I just haven't been able to find any E4X examples to do it right. Here is a portion of my XML format (i.e, in the below first large paragraph, if I searched for "Coldplay", it should return the topic node with the title "Coldplay's New Album"): <data> <topics> <topic title="Coldplay's New Album"> <content> <![CDATA[No one's been more <font color='#7AA7BA'><u><a href='event:Edit Profile'>painfully aware</a></u></font> of Coldplay's mellow ''Yellow'' aesthetic than the band itself: Frontman Chris Martin once joked to EW about ''driving a Bland Rover.'' It took a while to do something about it, but Viva La Vida, their fourth and best album, feels emboldened at almost every turn. Jonny Buckland's guitars howl insistently; Martin has discovered sub-falsetto vocal registers; and a stark, recurring string section lends an edge. But none of these developments dampen the group's essential melodiousness: Even with this MO, Coldplay can't help but do ''pretty'' proud.The band's new producers are Brian Eno and Markus Dravs - of U2 and Arcade Fire fame, respectively - so you won't be shocked when, at its most poundingly anthemic, Viva sounds a little like The Unforgettable Funeral. Despite how long Coldplay have been dogged with that U2-wannabe tag, they're clearly not feeling defensive about it. (The nearly vocal-free opener, ''Life in Technicolor,'' for one, is a dead ringer for ''Where the Streets Have No Name.'') But the group also cannily borrows from different sources. The pipe organ powering ''Lost!'', a lament about spiritual bereftness, will remind indie rockers of a trip to the Arcade. The dissonant guitar jam in the trifurcated ''42'' finds Buckland turning on the Radiohead. Several tracks echo John Lennon's vocals or Beatles-period orchestration, including the dark, antiwar teaser single ''Violet Hill'' and, most deliciously, ''Yes,'' an uncharacteristically sexy seduction tale on which the violins switch from ''Strawberry Fields'' mode to a Middle Eastern motif.Other songs satisfyingly elude easy comparisons. The confident majesty of the music, however, belies how he and his bandmates have invigorated their rock-lite reign. Protestations aside, the singer can rest assured that it's still good to be the king. A-]]> </content> <seeAlso> <topicLink title="Edit Profile"/> <topicLink title="Marking All Skills As Private" /> </seeAlso> </topic> <topic title="The Dark Knight"> <content> <![CDATA[This may be one of those instances where it seems advisable to whole-heartedly believe the summer blockbuster hype. We sorted through the major reviews available ahead of this weekend's highly-anticipated release of director Christopher Nolan's The Dark Knight, and at this point, there is almost unanimous praise for the flick, which stars Christian Bale as Batman and the late Heath Ledger as the Joker. <font color='#7AA7BA'><u><a href='event:Add Skill'>Critics are saying</a></u></font> that Knight blows away Nolan's 2005 attempt, Batman Begins, and several claim that Ledger has turned in the greatest Joker portrayal ever. So is this the best Batman movie of all time?]]> </content> ..etc.. Jason Merrill Bank of America Enterprise Technology & Global Risk L&LD Instructional Technology & Media Join the Bank of America Flash Platform Developer Community Are you a Bank of America associate interested in innovative learning ideas and technologies? Check out our internal GT&O Innovative Learning Blog & subscribe. >>-----Original Message----- >>From: [EMAIL PROTECTED] >>[mailto:[EMAIL PROTECTED] On Behalf >>Of Hans Wichman >>Sent: Monday, July 14, 2008 7:57 AM >>To: Flash Coders List >>Subject: Re: [Flashcoders] Overlay problem >> >>Hmm not entirely sure what you mean, but normally a : >> >>_parent.onPress = function(){} >>_parent.useHandcursor = false; >> >>does the trick. >> >>greetz >>JC >> >>On Mon, Jul 14, 2008 at 1:37 PM, Rajiv Seth (Pixelated) < >>[EMAIL PROTECTED]> wrote: >> >>> Hi, >>> >>> I want to create an effect like >>> http://www.limoosoft.com/Limoosoft-En.html >>> >>> When user clicks on "zoom image", large image loads in a movie, and >>> all links, rollver effects/actions are disabled by a >>semi-transparent image. >>> How >>> to create such layer, which can disable all links? >>> -- >>> Regards >>> >>> Rajiv Seth >>> Ph: 09839157388 >>> _______________________________________________ >>> Flashcoders mailing list >>> Flashcoders@chattyfig.figleaf.com >>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >>> >>_______________________________________________ >>Flashcoders mailing list >>Flashcoders@chattyfig.figleaf.com >>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >> _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders