遨游5无法加载flash

tech2024-06-23  66

遨游5无法加载flash

Flash movies are renowned for being compact and light in file size. That said, it’s amazing how large those compact files can get when audio and a lot of imported graphics are used in a movie.

Flash电影以紧凑和轻巧的文件大小而闻名。 就是说,当电影中使用音频和大量导入的图形时,这些压缩文件能获得多大的效果令人惊讶。

Fortunately, Flash, with its built-in ActionScript technology, can be optimized to preload each section of a movie before it’s played. Graphics, scenes, and even whole movies can be downloaded as the rest of the movie plays, which can significantly optimize the experience a cus-tomer has with your site.

幸运的是,Flash及其内置的ActionScript技术可以进行优化,以在播放电影之前预加载电影的每个部分。 图形,场景甚至整个电影都可以作为其余电影的一部分下载,这可以极大地优化客户对网站的体验。

入门 (Getting Started)

To begin with, we’ll write a script that will play an animation while the rest of the movie preloads before it starts to play. This is similar to the many "Movie is downloading, please wait…" animations you see on Websites.

首先,我们将编写一个脚本,该脚本将在动画的其余部分开始播放之前先播放动画。 这类似于您在网站上看到的许多“正在下载电影,请稍候……”动画。

To start, open a file and save it as Simple_Preloader.fla. The movie opens up with a default of just one scene. For the preload script to work a second scene must be added. To do this, select Insert — Scene, as shown here.

首先,打开一个文件并将其另存为Simple_Preloader.fla。 电影以默认的一个场景打开。 为了使预加载脚本起作用,必须添加第二个场景。 为此,请选择“插入—场景”,如下所示。

The Preloader script is going to be placed into Scene 1, but before we do this let’s add some content to scene two. Open Scene two, and add two layers: call one layer "Scripts" and the other "Content". Make each layer five frames long.

Preloader脚本将被放置到场景1中,但是在执行此操作之前,让我们向场景2中添加一些内容。 打开第二个场景,并添加两层:将一层称为“脚本”,将另一层称为“内容”。 使每一层长五帧。

Next, select the "Content" layer and add the following text: This is Scene 2.

接下来,选择“内容”层并添加以下文本:这是场景2。

In a production Flash movie this is the section where you will place the main movie. Scene two can be as large and long as you like. When you have finished with the Simple_Preloader, why not experiment with it — add a scene from a complex animation that you’ve written.

在制作的Flash电影中,这是放置主要电影的部分。 场景二可以大而长,只要您喜欢即可。 完成Simple_Preloader后,为何不尝试使用它-从您编写的复杂动画中添加一个场景。

Select the "Scripts" layer. Choose frame 5 and open the ActionScript Inspector. From the Basic Actions drag a "Stop" action on the ActionScript editor window.

选择“脚本”层。 选择第5帧并打开ActionScript检查器。 从“基本动作”中,在“动作脚本”编辑器窗口上拖动“停止”动作。

添加预加载脚本 (Add The Preload Script)

Now let’s add the Preload script itself. Open Scene 1. Add one layer and call it "Preload". Make the Preload layer 5 frames long. Change each frame into a "keyframe" (keyboard short cut F6), as shown below. Converting the frames to keyframes will allow scripts and animation to be added.

现在,让我们添加预加载脚本本身。 打开场景1.添加一层并命名为“ Preload”。 使预紧层长5帧。 如下所示,将每个帧更改为一个“关键帧”(键盘快捷键F6)。 将帧转换为关键帧将允许添加脚本和动画。

Select frame 1. Using the "Text" tool add the word "Loading" in the center of the stage. Make the font Arial Black and 12 point in size.

选择框架1。使用“文本”工具在舞台中央添加单词“ Loading”。 使字体Arial黑色和12点的大小。

Copy the word "Loading" from frame one and paste it into frames 2-5, as shown below. The word should appear in the same place in each frame. Select frame two. Select the word "Loading" and double click it to open it in edit mode. Immediately after the word add a single period.

如下图所示,从第一帧复制单词“ Loading”并将其粘贴到第2-5帧。 该单词应在每个框架中的相同位置出现。 选择第二帧。 选择单词“ Loading”,然后双击以在编辑模式下将其打开。 在单词之后立即添加一个句点。

Next, select frame three and edit the word "Loading" by adding two periods after the word. Add three periods after the word on frame four, and four periods on frame five. Now, when the animation plays it will display the word "Loading", and the three periods will animate after it.

接下来,选择第三个框架,并在单词“ Loading”之后添加两个句点来对其进行编辑。 在第四帧的单词之后添加三个句点,在第五帧添加四个句点。 现在,当动画播放时,它将显示单词“ Loading”,并且三个句点将在其后进行动画处理。

Now, select frame 1. Open the ActionScript Inspector. From the Basic Actions drag "If Frame Is Loaded". Select the settings to "Scene 2" and "frame number 5", as shown here.

现在,选择框架1。打开ActionScript检查器。 从“基本操作”中拖动“如果加载了框架”。 选择“场景2”和“帧编号5”的设置,如下所示。

This script tells Flash that it must preload all of the content up to frame 5 of scene 2. If the animation were longer in scene 2, the number of frames would need to be extended. For instance, if your movie had 550 frames, you’d need to change the frame number to 550. All content, including audio, graphical and scripted content, will be preloaded with this script.

该脚本告诉Flash,它必须将所有内容预加载到场景2的第5帧。如果动画在场景2中较长,则需要扩展帧数。 例如,如果电影有550帧,则需要将帧号更改为550。所有内容(包括音频,图形和脚本内容)都将与此脚本一起预加载。

Drag an instance of the "Go To" action. Select the settings to Scene 2 and frame number 1. This action tells Flash what to do when all of the frames of scene 2 are loaded. In this case, the movie automatically goes to and begins playing frame 1 of scene 2:

拖动“转到”操作的实例。 选择场景2和帧号1的设置。此操作告诉Flash加载场景2的所有帧时该怎么做。 在这种情况下,电影会自动转到场景2的帧1并开始播放。

Now, choose frame 5. From the ActionScript Inspector drag "Go To" and add the settings Scene 1, Frame 1. This will cause the animation to keep repeating until all the content in Scene two is loaded, as shown here:

现在,选择第5帧。从ActionScript检查器中,拖动“转到”并添加场景1,第1帧的设置。这将使动画不断重复,直到加载了场景2中的所有内容为止,如下所示:

测试时间 (Time to Test)

The movie can now be tested. Press F12 to preview in your Web browser. You will notice that while Scene 2 is loading the animation will keep repeating. The more content you have in scene 2, the longer the preload scene will be displayed. The movie in Scene 2 is very short. To see the full effect of the preload script, import an MP3 file into scene 2. Most MP3 files are in excess of 1 MB in file size. When you place the movie on a Website, it will allow you to view the preload script in action while the MP3 downloads.

现在可以测试电影了。 按F12在Web浏览器中预览。 您会注意到,在加载场景2时,动画将不断重复。 场景2中的内容越多,预加载场景的显示时间就越长。 场景2中的电影非常短。 要查看预加载脚本的完整效果,请将MP3文件导入场景2。大多数MP3文件的大小超过1 MB。 将电影放在网站上时,它将允许您在下载MP3时查看正在运行的预加载脚本。

Preloading allows you to create movies that have the same impact to a cus-tomer whether they access the Internet on a dial-up modem or a dedicated high-speed connection. The above script provides a great deal of flexibility. Why not have a company logo animate for the first scene? Or, you could display a simple Flash game, or even a short presentation outlining what is to be covered in the main movie when it has downloaded. The possibilities are endless!

通过预加载,无论是通过拨号调制解调器还是专用的高速连接访问Internet,都可以创建对客户具有相同影响的电影。 上面的脚本提供了很大的灵活性。 为什么第一个场景没有公司徽标的动画? 或者,您可以显示一个简单的Flash游戏,甚至是一个简短的演示文稿,概述下载后的主电影中要涵盖的内容。 可能性是无止境!

翻译自: https://www.sitepoint.com/optimize-preloading-flash-5/

遨游5无法加载flash

相关资源:jdk-8u281-windows-x64.exe
最新回复(0)