Flash Web News Floating Board production (XML application)

Source: Internet
Author: User
Tags final
xml| Float | Web page

We can often see the effects of some Web sites with news floating boards written in JavaScript.

Today, I try to use Flash+xml to do a news floating board, the basic goal is to read the contents of XML and click on the hyperlink effect.

Should have been a hover effect, I was successful in the early test, but in the final combination of the test failed, Onrollout event only excited after a combination of tests failed, in this work had to give up.

The idea should be simpler, that is, the program flowchart as shown in Figure one:

However, the implementation of the time will still encounter some difficulties, I will be the main problems I encountered and the way to solve the following summary:
1htmlText:

I heard that Flash is supporting CSS, but limited support, tried a bit to make the hyperlink color effect, failed.

As for the color directly with <font color= ' #0000FF ' > To do is, as follows:

Private Function Htmlstrmake (Info:string,href:string,textholder:textfield): Void
{
var tmpstr:string= "<font color= ' #0000FF ' ><a href= '";
Tmpstr+=href;
tmpstr+= "' target= ' _blank ' >";
tmpstr+=info+ "</a></font>";
TEXTHOLDER.HTMLTEXT=TMPSTR;
}

2. OnLoad event FOR XML:

Perhaps for security reasons, in my attempt, I found that Flash was quite strict with the access to the read XML file. The space to be able to work is basically the onload.

Once the onload is out, everything that is dynamically created and obtained in the onload, whether or not it is related to the data in the XML file, becomes invalid.

So, in the first design, I was going to separate the reading of the XML file from the dynamic effect behind it. Later, after the throes of failure, I had to put all the main programs in
In the onload, although certainly is unreasonable, but I really can not ~ ~ ~ ~

3. For processing of Read XML content:

The XML data that is read is treated as string, so when the numbers are read, they should be transformed with parseint or parsefloat.

It's no problem if you just use it directly, that is, you don't have to do anything with it. But I do not recommend it.

4. For my description of this XML file.

The first line of the attribute value holds the data related to the movie, which corresponds to the following description:

<newsmsg width= ' 204 ' height= ' 176 ' newsnum= ' 5 ' rowinterval= ' 2 ' fps= ' ' vy= ' 0.5 ' >
Width: The breadth of the movie.
Height: The altitude of the movie.
Newsnum: The number of news.
Rowinterval: The number of rows per piece of news, My line here is 22 pixel units.
The number of milliseconds consumed per frame in the fps:setinterval.
VY: The speed at which the news text box moves up.

As for the main content:

<news>
<url>http://www.google.com<;/url>
</news>

I think, except that you don't know what is XML, you should read it:

5. I would be very happy if this work could be used by you in the actual application of the Web page.

Basically what you need to change is the art part, and the content and parameters in the news XML file. Of course, you are welcome to report some bugs as well as some comments to help me improve the work.

Source code, because the beginning of the design and the final implementation of some does not match, so, some classes are useless, please do not be confused.

   Click here to download the source file

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.