Flash MX 2004 中的一些问题?

9116 2003-11-23 10:48:18
在 Flash MX 2004 的书中提到了 ID3 和ContextMenu 是什么意思?
各位可以解释一下,或者举个例子?
...全文
45 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
9116 2003-11-30
  • 打赏
  • 举报
回复
多谢了
jiagao 2003-11-27
  • 打赏
  • 举报
回复
ID3 标签是添加到 MP3 文件的数据字段,这些数据字段包含有关该文件的信息,例如歌曲名称、唱片名称和歌手姓名。

若要读取 MP3 文件中的 ID3 标签,请使用 Sound.ID3 属性,其属性对应于正在加载的 MP3 文件中包含的 ID3 标签的名称。若要确定正在下载的 MP3 文件的 ID3 标签何时可用,请使用 Sound.onID3 事件处理函数。Flash Player 7 支持版本 1.0、1.1、2.3 和 2.4 标签;不支持版
本 2.2 标签。

例如,以下代码将名为 favoriteSong.mp3 的 MP3 文件加载到名为 song 的 Sound 对象中。当该文件的 ID3 标签可用时,名为 display_txt 的文本字段显示歌手姓名和歌曲名称。

var song = new Sound();
song.onID3 = function () {
display_txt.text = "Artist:" + song.id3.TCOM + newline;
display_txt.text += "Song:" + song.id3.TIT2);
}
song.loadSound("mp3s/favoriteSong.mp3, true");

因为 ID3 2.0 标签位于 MP3 文件的开始处(在声音数据之前),所以当文件刚开始下载时便可以得到这些标签。但是,ID3 1.0 标签位于文件的末尾(在声音数据之后),这些标签直到整个 MP3 文件完成下载后才可用。

每次有新的 ID3 数据可用时都会调用 onID3 事件处理函数。这意味着如果 MP3 文件包含 ID3 2.0 标签和 ID3 1.0 标签,onID3 处理函数将被调用两次,这是因为这些标签位于文件中的不同部分。

有关支持的 ID3 标签的列表,请参见 Sound.ID3。

9116 2003-11-26
  • 打赏
  • 举报
回复
那么ID3又是什么呢?
小羊羔可否再帮我解释一下? 多谢了
21xxb 2003-11-24
  • 打赏
  • 举报
回复
右键菜单
jiagao 2003-11-23
  • 打赏
  • 举报
回复
ContextMenu class

Description
The ContextMenu class provides runtime control over the items in the Flash Player context menu, which appears when a user right-clicks (Windows) or Control-clicks (Macintosh) on Flash Player. You can use the methods and properties of the ContextMenu class to add custom menu items, control the display of the built-in context menu items (for example, Zoom In and Print), or create copies of menus.

You can attach a ContextMenu object to a specific button, movie clip, or text field object, or to an entire movie level. You use the menu property of the Button, MovieClip, or TextField classes to do this. For more information about the menu property, see Button.menu, MovieClip.menu, and TextField.menu.

To add new items to a ContextMenu object, you create a ContextMenuItem object, and then add that object to the ContextMenu.customItems array. For more information about creating context menu items, see the ContextMenuItem class entry.

Flash Player has three types of context menus: the standard menu (which appears when you right-click in Flash Player), the edit menu (which appears when you right-click over a selectable or editable text field), and an error menu (which appears when a SWF file has failed to load into Flash Player.) Only the standard and edit menus can be modified with the ContextMenu class.

Custom menu items always appear at the top of the Flash Player context menu, above any visible built-in menu items; a separator bar distinguishes built-in and custom menu items. A context menu can contain no more than 15 custom menu items.

You must use the constructor new ContextMenu() to create a ContextMenu object before calling its methods.

Method summary for the ContextMenu class
Method
Description

ContextMenu.copy()
Returns a copy of the specified ContextMenu object.

ContextMenu.hideBuiltInItems()
Hides most built-in items in the Flash Player context menu.


Property summary for the ContextMenu class
Property
Description

ContextMenu.builtInItems
An object whose members correspond to built-in context menu items.

ContextMenu.customItems
An array, undefined by default, that contains ContextMenuItem objects.


Event handler summary for the ContextMenu class
Property
Description

ContextMenu.onSelect
Invoked before the menu is displayed.


Constructor for the ContextMenu class
Availability
Flash Player 7.

Usage
new ContextMenu ([callBackFunction])

Parameters
callBackFunction A reference to a function that is called when the user right-clicks or Control-clicks, before the menu is displayed. This parameter is optional.

Returns
Nothing.

Description
Constructor; creates a new ContextMenu object. You can optionally specify an identifier for an event handler when you create the object. The specified function is called when the user invokes the context menu, but before the menu is actually displayed. This is useful for customizing menu contents based on application state or based on the type of object (movie clip, text field, or button) that the user right-clicks or Control-clicks. (For an example of creating an event handler, see ContextMenu.onSelect.)

Example
The following example hides all the built-in objects in the Context menu. (However, the Settings and About items still appear, because they cannot be disabled.)

var newMenu = new ContextMenu();
newMenu.hideBuiltInItems();
_root.menu = newMenu;

In this example, the specified event handler, menuHandler, enables or disables a custom menu item (using the ContextMenu.customItems array) based on the value of a Boolean variable named showItem. If false, the custom menu item is disabled; otherwise, it's enabled.

var showItem = false; // Change this to true to see its effect
my_cm = new ContextMenu(menuHandler);
my_cm.customItems.push(new ContextMenuItem("Hello", itemHandler));
function menuHandler(obj, menuObj) {
if (showItem == false) {
menuObj.customItems[0].enabled = false;
} else {
menuObj.customItems[0].enabled = true;
}
}
function itemHandler(obj, item) {
}
_root.menu = my_cm;

2,275

社区成员

发帖
与我相关
我的任务
社区描述
多媒体/设计/Flash/Silverlight 开发 Flash流媒体开发
社区管理员
  • Flash流媒体开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧