给图像加水印
今天应朋友需求,写了一个简单的图像加水印小软件,这个姑且叫做1.0版本吧,以后还会陆续添加更多功能。
今天应朋友需求,写了一个简单的图像加水印小软件,这个姑且叫做1.0版本吧,以后还会陆续添加更多功能。
我最近开发的mp3播放器!希望大家帮着测试一下,多多提意见,可以在下面跟帖!
这里提供了测试用的mp3和lrc文件:lrc&MP3.rar
————————— 版本 Beta4.3 —————————
更新日志:
1、更正了在开启“重复AB”模式下,切换歌曲时时间总长度刷新错误的bug
2、更正了当歌曲列表中音乐文件链接失效时不能读取下一首歌的bug
————————— 版本 Beta4.2 —————————
更新日志:
1、修改了加载歌曲算法
2、更正了滚动歌曲名称序号的显示错误
3、更正了清除列表后再添加歌曲但播放序号没有更新的bug
4、重新设计了滑竿样式
————————— 版本 Beta4.1 —————————
新增功能:
1、播放时间正反计时
2、播放模式:5种
3、支持歌曲文件夹拖拽
4、支持打开文件窗口和文件夹窗口(右上角的“+”)添加歌曲
5、文件列表全部清空按钮(右上角的“-”)
另:界面皮肤略有调整
————————— 版本 Beta3.0 —————————
新增功能:
1、添加歌曲:将mp3拖拽到界面内,支持多项拖拽
2、删除歌曲:选中歌曲按del,按住del不放再单击歌曲,则可以连续删除
3、重复ab:直接在重复ab面板拖拽选区
4、歌词同步:单击歌曲列表其中一项,然后拖拽lrc文件到主界面,然后重新播放该歌曲
经过一系列测试,如果在enterframe里如果做一个简单的效果,比如更新txt文字变化,正常状态下cpu是5%-12%之间,窗口透明的话,cpu在10%-18%之间。但是我做个mp3波形图动画,正常状态下是17%-25%,而透明状态下是37%-55% ,运算量越大,差异越明显。所以说,透明效果如果想要使用的话,还得根据项目需求三思而行。
昨天在网上看到了oreilly官网发布AIR1.5 CookBook,太兴奋了,偶要想办法尽快搞到手。
oreilly url:http://oreilly.com/catalog/9780596522506/toc.html

只要看过帮助文档的人都知道,FileMode里面包含了4种静态常量READ、WRITE、APPEND、UPDATE。前三种都很容易理解,但是UPDATE根据官方文档的意思,当没有外部文件的时候就生成外部文件,如果有的话,就对文件进行读写操作。在我看来它似乎就是一个READ、WRITE的集合,但是经过几次测试后发现,结果似乎和预期的不一样。仔细研究之后我才发现,原来这里面还有一个细节问题需要注意:当读取文件并获取到相应内容之后,如果你改变了其中某个字符或者在原有字符基础上追加了字符之后,在UPDATE的时候就会对文件相应字符进行改写。如果你仅仅是删除了部分字符的话,那就不会对原字符更新。举个例子:比如你生成一个txt文件,里面包含了abcde这几个字符,如果你把字符改为abbde或者abcdef的话,都可以成功进行UPDATE操作。但如果你想改为abcd或者abef的话,那将更新无效,但是并不会提示你操作错误或者失效之类的。然而这一点在官方文档中并没有提及到,今天在这里小记一下,留作备忘。
本文由powerboy翻译,转载请注明出处。
The runtime provides you with capabilities to work with directories on the local file system.
运行环境为你提供了在本地文件系统上管理目录的能力。
Pointing a File object to a directory
指向一个文件目录。
There are different ways to set a File object to point to a directory.
这里提供过了很多不同的方法来把文件对象指向一个目录。
Pointing to the user’s home directory
指向用户目录。
You can point a File object to the user’s home directory. On Windows, the home directory is the parent of the “My Documents” directory (for example, “C:\Documents and Settings\userName\My Documents”). On Mac OS, it is the Users/userName directory. The following code sets a File object to point to an AIR Test subdirectory of the home directory:
你可以把文件对象指向用户目录。在Windows系统上,指的也就是“My Documents”目录的父级(例如: “C:\Documents and Settings\userName\My Documents”)。在Mac系统上,目录是Users/userName。下面的代码设置文件对象指向用户目录的子目录AIR Test:
var file:File = File.userDirectory.resolvePath(”AIR Test”);
Pointing to the user’s documents directory
指向用户文档目录。
You can point a File object to the user’s documents directory. On Windows, this is typically the “My Documents” directory (for example, “C:\Documents and Settings\userName\My Documents”). On Mac OS, it is the Users/userName/Documents directory. The following code sets a File object to point to an AIR Test subdirectory of the documents directory:
你可以把文件对象指向用户目录。在Windows系统上,是典型的”My Documents”目录(例如:”C:\Documents and Settings\userName\My Documents”)。在Mac系统上,是Users/userName/Documents目录。下面的代码设置文件对象指向用户文档目录的子目录AIR Test:
var file:File = File.documentsDirectory.resolvePath(”AIR Test”);
Pointing to the desktop directory
指向用户桌面目录。
You can point a File object to the desktop. The following code sets a File object to point to an AIR Test subdirectory of the desktop:
你可以把文件对象指向桌面。下面的代码设置文件对象指向用户桌面目录的子目录AIR Test:
var file:File = File.desktopDirectory.resolvePath(”AIR Test”);
Pointing to the application storage directory
指向应用程序的专用存储目录。
You can point a File object to the application storage directory. For every AIR application, there is a unique associated path that defines the application storage directory. This directory is unique to each application and user. You may want to use this directory to store user-specific, application-specific data (such as user data or preferences files). For example, the following code points a File object to a preferences file, prefs.xml, contained in the application storage directory:
你可以把文件对象指向应用程序的专用存储目录。每个AIR应用程序,都有一个唯一的针对专用存储目录的关联路径。这个目录对每个应用程序和用户都是唯一的。你可能要用这个目录存储用户和应用程序特定的数据(例如用户数据或选择文件)。例如,下面的代码把文件对象指向一个被包含在专用存储目录的选择文件prefs.xml:
var file:File = File.applicationStorageDirectory;
file = file.resolvePath(”prefs.xml”);
The application storage directory location is based on the user name, the application ID, and the publisher ID:
应用程序专用存储目录位置是基于用户名字、应用程序ID和发布者ID组成:
•
On Mac OS—In:
/Users/
user name
/Library/Preferences/
applicationID
.
publisherID
/Local Store/
For example:
/Users/babbage/Library/Preferences/com.example.TestApp.02D88EEED35F84C264A183921344EEA353A629FD.1/Local Store
•
On Windows—In the documents and Settings directory, in:
user name
/Application Data/
applicationID
.
publisherID
/Local Store/
For example:
C:\Documents and Settings\babbage\Application Data\com.example.TestApp.02D88EEED35F84C264A183921344EEA353A629FD.1\Local Store
The URL (and url property) for a File object created with File.applicationStorageDirectory uses the app-storage URL scheme (see “Supported URL schemes” on page 101), as in the following:
URL为了实现File.applicationStorageDirectory创建文件对象,而使用了app-storage URL方案,如下所示:
var dir:File = File.applicationStorageDirectory;
dir = dir.resolvePath(”preferences”);
trace(dir.url); // app-storage:/preferences
Pointing to the application directory
指向应用程序目录。
You can point a File object to the directory in which the application was installed, known as the application directory. You can reference this directory using the File.applicationDirectory property. You may use this directory to examine the application descriptor file or other resources installed with the application. For example, the following code points a File object to a directory named images in the application directory:
你可以把文件对象指向应用程序被安装的目录,就是通常所说的应用程序目录。你可以使用File.applicationDirectory属性来引用它。你可以使用安装目录来检查应用程序的描述文件或者其他资源。例如,下面的代码把文件对象指向应用程序目录下名为images的目录。
var dir:File = File.applicationDirectory;
dir = dir.resolvePath(”images”);
The URL (and url property) for a File object created with File.applicationDirectory uses the app URL scheme (see “Supported URL schemes” on page 101), as in the following:
URL为了实现File.applicationDirectory创建文件对象,而使用了app URL方案,如下所示:
var dir:File = File.applicationDirectory;
dir = dir.resolvePath(”images”);
trace(dir.url); // app:/images
Pointing to the filesystem root
指向文件系统根目录
The File.getRootDirectories() method lists all root volumes, such as C: on a Windows computer. On Mac, this method always returns the unique root directory for the machine (the “/” directory).
File.getRootDirectories()方法列出所有根目录卷标,例如windows电脑的c:。在Mac上,这个方法返回唯一的根目录(”/”目录)
Pointing to an explicit directory
指向具体的目录
You can point the File object to an explicit directory by setting the nativePath property of the File object, as in the following example (on Windows):
你可以通过设置文件的nativePath属性使文件对象指向具体目录,就像下面的例子(在windows上):
var file:File = new File();
file.nativePath = “C:\\AIR Test\”;