|
|
|
||||||||||||||||||||||
|
Small dynamic-flash news block feeding with XML
Required software: Macromedia Flash MX The aim of this tutorial is to teach you how to create dynamicly feeded from XML news block for your site. Described metod is usefull for every XML->Flash integration. After figuring this out you will be able to manipulate with data providen in XML. 1.Content of FLA and ZIP We will skip things that you should know in order to create object provided in FLA file and just quote what you have in. Download flashnews.zip here ![]() In Layer 2 you have MovieClip instance called Cover. This we gonna use to hide and unhide news content while text changing after user clicked on Next to switch to earlier item. Cover has two Stop() commands, and the beginning of animation (cover is totaly opened) and at the middle of animation (cover is totaly closed), but there is code at last frame (totaly cosed): _root.LoadNews(); When cover is closed it calls function to load next entry In Layer 1 you have dynamic text fiels objects with instance names: news_title -> holding story's title news_date -> holding story's date news_text_field -> holding story's text news_num_display -> showing to user entry number / number of entries There is also button objects: Link button that opens realated URL in new browser window Next button switching to next entry In this .zip is dog.xml file in which news are stored. 2.Code These functions loading dog.xml file and retrives data. This code is at first frame, Layer 1 This is the main code that calls LoadNews function and sets _global.set as 1 to point on first entry. At the end stop() stops movie playback to avoid contant repeating. Code shown above will load only first entry, in order to allow visitors to switch entries we gonna put these code in Next button: And at the last frame in Cover MC instance: Now we will put code into Link button to make our script opening provided link: on (release) { getURL(_global.related_url, "_blank"); // This will open new browser window (because of _blank flag) with related URL. } Note: XML using UTF-8 so it's usable for any language. see it on-line: http://www.omnetwork.net/cms/tutimages/news.swf
The comments are owned by the poster. We aren't responsible for their content.
|












