The most popular Sina Image Rotation Effect

Source: Internet
Author: User
Tags arrays

0.1 prepare external files: create a folder on your hard disk and put a list of image list files in the file list. xml in the following format:
<? Xml version = "1.0" encoding = "GB2312"?> <Images> <I s = "images/v82008.jpg" a = "images_abbr/v82008.jpg"> not broadcast Super Girl contest </I> <I s = "images/060820110116v82009.jpg" a =" "images_abbr/movie"> eat "cheapest lunch box" </I> <I s = "images/movie" a = "images_abbr/060820110131v82010.jpg"> Our reporter experienced "Super Girl voice" in Changsha" background </I> </images>
Place the image file according to the path here.
PS: In fact, the name is not clear, but at the beginning I considered the transmission time, the xml file was compressed in the variable.
0.2 create a new Flash file. The file size is set to 300*225 (reference) and saved as picsExchange. fla. The file is in the same directory as list. xml.
1.1 start reading and analyzing XML, and store all the information in the array. Here, the author creates three arrays: descriptions, imgabbrs, and imgs.
1.2 add code to the first frame:
Stop (); // because it is a timeline version, you must stop playing the video before entering the second timeline after reading and analyzing xml.
System. useCodepage = true // prevents Chinese garbled characters
Var imgList: XML = new XML () // create an object for reading xml
ImgList. load ("list. xml") // read the list. xml file.
Var descriptions: Array
Var imgabbrs: Array
Var imgs: Array // defines three arrays for storing image information
Var imgsNum: Number = 0; // variable for placing the Number of images
ImgList. onLoad = function (success ){
ImgList. ignoreWhite = true
If (success ){
Descriptions = new Array ()
Imgabbrs = new Array ()
Imgs = new Array () // This step is used to initialize the Array. When you re-read the Array, clear the content.
ImgsNum = imgList. childNodes [0]. childNodes. length
For (var I in imgList. childNodes [0]. childNodes ){
Var imgNode: XMLNode = imgList. childNodes [0]. childNodes
Descriptions= ImgNode. childNodes [0]. nodeValue // This is the text description of the image.
Trace ("description:" + descriptions)
Imgabbrs = imgNode. attributes. a // This is the path of the thumbnail.
Trace ("imgabbr:" + imgabbrs)
Imgs = imgNode. attributes. s // This is the path of the source image.
Trace ("img:" + imgs)
                }
Play (); // after analysis, the timeline can be played.
} Else {
Trace ("loading error! ")
        }
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.