FileIO Xtra
Version 1.0.4 - 09dec97 CH
FileIO Xtra for Macromedia Director 6.0
=======================================
FileIO provides a set of methods allowing users of Macromedia Director 6.0 to
programmatically access files using the Lingo scripting language. The FileIO
Xtra is a scripting Xtra. The scripting Xtra interface is portable across
all Macromedia products. Hence the FileIO Xtra may be used with Authorware 4.
Using FileIO
============
If automatic opening is desired, place a copy of the FileIO Xtra for your platform
into Application Xtra's folder. If automatic opening is not desired, the Xtra can be
placed anywhere and opened using Lingo's 'openXLib' command. This applies to
projector's as well, the Xtra must be placed in an Xtra's folder in the same folder
as the projector.
Each instance of FileIO can reference a single open file. If multiple files are to
be opened simultaneously, a new instance of FileIO is required for each opened file.
A single instance can be used to open multiple files, as long as the file is closed
before a new file is opened. To create a new instance, use the new() method, defined
below. To dispose of an instance, set the instance variable to 0. All methods that
read from or write to the file must be called after the file has been opened using
the openFile() method. If a new file is to be opened using the same instance, the
file must be closed using closeFile(). Files can be opened in three different modes:
Read, Write and Read/Write. When writing to a file, the contents of the file after
the current position are overwritten.
Example Lingo
set myFile = new(xtra "fileio") -- Create an instance of FileIO
set fileName = displayOpen(myFile) -- Display Open Dialog and return the fileName
openFile(myFile, fileName, 1) -- Open the file
set theFile = readFile(myFile) -- Read the file and return a string to Lingo
closeFile(myFile) -- Close the file
set myFile = 0 -- Dispose of the instance
In this example, we created a new instance and stored it in the variable myFile.
Next, the displayOpen() method is used to display an open dialog to allow a file to
be chosen. The file is returned as a fully-qualified path string to Lingo. The file
is then opened in read only mode, the contents of the file are read, and the file is
closed. Lastly, the instance is disposed of.
Known Problems
==============
The createFile() method does not support relative filenames, or the Lingo '@'
operator in pathnames. This will be fixed in a later version.
The displaySave() method does not directly inform Lingo whether a user is
replacing an existing file. The workaround is to attempt to create the file using
createFile() and check the error code for a "File Already Exists" error.
History
=======
09dec97 (v1.0.4)
Fixed a problem leading to garbage characters appearing at the ends of lines,
or possibly crash.
18apr97 (v1.0.2)
Fixed parenting problem with displaySave() and displayOpen() methods.
Added support for Authorware.
27may96 (v1.0.1)
Added support for double-byte character sets.
Added version() method to report FileIO Xtra version information.
Added getOSDir() to return a full path to the Windows Directory/System Folder.
15mar96 (v1.0.0 Beta)
First public release.
Method Reference
================
The first line of each definition contains the method name, a list of parameters and
thier value types. The internal name of the FileIO Xtra is "fileio". This name is
used whenever referencing the xtra using the form 'xtra "fileio"'.
Note that while Director and projector's can use net-based files by supplying a URL
for a filename, the FileIO Xtra cannot. It is limited to accessesing files available
via filesystems mounted on the local system.
New methods will appear at the bottom of this list.
---
mMessageList( xtra reference )
Returns a list of methods and parameters, as well as a brief explanation of each.
---
new( xtra reference )
This is called to create a new instance of FileIO. The Xtra can be referenced by name
or number. It returns an instance variable used to reference the instance.
---
fileName( instance )
Returns the fileName string of the current open file. The file must be open use this
method.
---
status( instance )
Returns the error code returned by the last method called. The value is returned as
an integer.
---
error( instance, int error )
Returns a readable error string. A numeric error code is passed in as the
second argument. The errors returned can be any of the following:
"OK"
"Memory allocation failure"
"File directory full"
"Volume full"
"Volume not found"
"I/O Error"
"Bad file name"
"File not open"
"Too many files open"
"File not found"
"No such drive"
"No disk in drive"
"Directory not found"
"Instance has an open file"
"File already exists"
"File is opened read-only"
"File is opened write-only"
"Unknown error"
---
setFilterMask( instance, string mask )
Sets the filter mask used by calls to displayOpen() and displaySave(). The filter
mask determines what files to show when displaying an Open or Save dialog. The second
parameter is a string representing the filter mask to set. On Windows, this is a
comma seperated string of file types and associated extensions (e.g. "All
Files,*.*,Text Files,*.TXT"), and a string of types on the Macintosh (e.g.
"TEXTPICT"). On Windows, the filter mask string is limited to 256 characters. On the
Macintosh, you are limited to four four-character types. When a new instance of
FileIO is created, the filter masks defaults to all files. To reset the filter mask to
display all files after it has been set, just pass in an empty string (e.g.
setFilterMask(me, "")).
---
openFile( instance, string fileName, int openMode )
Opens the named file. This call must be used before any read/write operations can
take place. The filename can be either a fully-qualified path and filename, or a
relative filename. The Lingo '@' pathname operator is supported. The openMode
parameter specifies whether to open the file in Read, Write or ReadWrite mode. Valid
Flags are: 0 Read/Write, 1 Read, 2 Write.
---
closeFile( instance )
Closes a file that has been previously opened using the openFile() method.
---
displayOpen( instance )
Displays a platform specific Open dialog allowing a user to specify a file. Returns a
fully-qualified path and fileName to Lingo. The setFilterMask() method can be used to
control what file types are displayed in the dialog.
---
displaySave( instance, string title, string defaultFileName )
Displays a platform specific Save dialog allowing a user to specify a file. Returns a
fully-qualified path and fileName to Lingo. The setFilterMask() method can be used to
control what file types are displayed in the dialog. The string and defaultFileName
parameters allow you to specifiy a default filename to be displayed, as well as title
text for the save dialog.
---
createFile( instance, string fileName )
Creates a file. The fileName must be either a fileName to be created in the current
directory, or a fully-qualified path and fileName. The Lingo '@' pathname operator
and relative paths are not supported. After creating the new file, the file must be
opened before it can be written to.
---
setPosition( instance, position )
Sets the file position of the current open file. The file must be open to use this
method.
---
getPosition( instance )
Gets the file position of the current open file. Returned as an integer. The file
must be open to use this method.
---
getLength( instance )
Gets the length of the currently opened file. Returned as an integer. The file must
be open use this method. The value returned is the length of the file in bytes.
---
writeChar( instance, string theChar )
Writes a single character to the file at the current position. The file must be open
in write or read/write mode to use this method.
---
writeString( instance, string theString )
Writes a string to the file at the current position. The file must be open in write
or read/write mode to use this method.
---
readChar( instance )
Reads the character (either single or double-byte) at the current position and then
increments the position. The character is returned to Lingo as a string. The file must
be open in read or read/write mode to use this method.
---
readLine( instance )
Reads from the current position up to and including the next CR, increments the
position, and returns the string to Lingo. The file must be open in read or
read/write mode to use this method.
---
readFile( instance )
Reads from the current position to the end of the file and returns the file to Lingo
as a string. The file must be open in read or read/write mode to use this method.
---
readWord( instance )
Reads the next word starting at the current position. The file must be open in read
or read/write mode to use this method.
---
readToken( instance, string skipChar, string breakChar )
Reads the next 'token' starting at the current position. Characters matching the
skipChar parameter are "skipped" and the file is read until breakChar is encountered.
The file must be open in read or read/write mode to use this method. This method will
read double-byte tokens as long as the skip and break are single-byte characters. It
will not detect double-byte skip or break characters.
---
getFinderInfo( instance )
Returns the Type and Creator of the current file as a string. This method does
nothing when used under Windows. The file must be open to use this method.
---
setFinderInfo( instance, string typeAndCreator )
Sets the Type and Creator of the current file. The string takes the form of a space
seperated set of TYPE and CREATOR codes (e.g. "TEXT TTXT"). This method does nothing
when used under Windows. The file must be open to use this method.
---
delete( instance )
Deletes the currently opened file. The file must be open use this method.
---
version( xtraRef )
Returns FileIO version and build information. Useful when filing
bug reports, determining installed version while authoring, etc. No practical use beyond this.
---
getOSDir( )
Global method that returns the full path to either the Windows directory, or the System Folder
depending on which OS is currently being used. Does not require a child instance or
Xtra reference to call.
---(共1张PPT)
以7.9Km/s的速度绕地球表面运行
在该处点火加速,使速度V>7.9Km/s卫星进入椭圆轨道
由P到Q速度变小减速运动机械能守恒
在该处再次点火加速,虽加速,但是以小于7.9Km/s的速度进入预定轨道.
P
Q
人造卫星的发射过程
显示宏观的宇宙空间(共24张PPT)
5
宇宙航行
第5节 宇 宙 航 行
窄视场相机拍摄的图片 伴星位于飞船前上方21度153米处
神七飞船载人航天任务全程精彩回放
吉林省乾安县第七中学 131400 金迎时
E-mail:jys200512@
人教版必修2 新课标地区
会员社区用户名:jys200512@
1.知道三个宇宙速度的含义,并会推导第一宇宙速度.
2.理解人造卫星的线速度、角速度、周期与轨道半径的关系.
3.了解人造卫星的相关知识,了解人类探索宇宙的成就,感受人类对客观世界不断探究的精神和情感.
1.通过近地卫星的运动推导第一宇宙速度并计算其数值,同时理解第二、第三宇宙速度的含义.
2.通过对地球卫星运动的分析,掌握不同高度卫星的线速度、角速度、周期和加速度的特点.
3.通过阅读“梦想成真”,体会人类探索太空的成就与科学精神.
学法指导
课程目标
知识构建
英国科学家牛顿(1643-1727)
在1687年出版的《自然哲学的数学原理》中,牛顿设想抛出速度很大时,物体就不会落回地面。
人造地球卫星
1、牛顿的设想
所有卫星都在以地心为圆心的圆(或椭圆)轨道上
一般轨道
极地轨道
赤道轨道
2、人造卫星的运行轨道
浅谈中学英语课堂教学听说能力训练策略
浅谈中学英语课堂教学听说能力训练策略
3、自主探究:人造卫星的运行规律
高轨低速长周期
拓展:地球同步卫星
1、概念:地球同步卫星是指相对于地面静止,和地球自转周期相同的卫星,又称通信卫星。
2、特点
轨道一定:轨道平面与赤道平面重合
周期一定:与地球自转周期相同
高度一定: h=3.59×104km
角速度一定:与地球的角速度相同
方向一定:与地球自转方向相同
项目 规律 结论 规律
v
近地卫星
赤道物体
桥梁
同步卫星
比较同步卫星、近地卫星和赤道上物体的轨道参量的大小
问题:在牛顿的设想中,物体至少要以多大的速度发射,才能在地面附近绕地球做匀速圆周运动?
解析:设地球和人造地球卫星的质量分别为M和m, 卫星到地心的距离为r,卫星的速度为v,卫星运动所需的向心力是由万有引力提供的。
,
由此解出
宇宙速度
P
V=7.9km/s
7.9km/sV>11.2km/S
探究: 若卫星的发射速度大于7.9km/s ,会怎样呢?
离开地球再也不回来
如果物体所具的动能足以达到上述数值,便可以脱离地球引力的控制,即
而
拓展: 第二宇宙速度的推导
推导如下:
用M表示地球的质量,R表示地球的半径,m表示物体的质量,G表示引力常量,把一个物体从地球表面发射到无限远去,对它所需做的功W是
物体脱离地球引力进入行星轨道需要的速度,叫做第二宇宙速度,ν2=11.2km/s.
物体如果进一步挣脱太阳引力的束缚,则需要更多的能量,挣脱太阳系而飞向太阳系以外的宇宙空间去,必须具有的最小速度叫做第三宇宙速度,ν3=16.7km/s。
所以
拓展: 第三宇宙速度的推导
推导方法如下:
地球以约30km/s的速度绕太阳运动,地球上的物体也随着地球以这个速度绕太阳运动。正像物体挣脱地球引力所需的最小速度等于它绕地球运动的速度的 倍那样,物体脱离太阳引力的束缚所需的速度应等于它绕太阳运动的速度的 倍,即 。由于人造天体已有绕太阳运动的速度30km/s,所以只要使它沿地球运动轨道方向增加12.4km/s的速度就行。但要物体获得这个速度,首先必须使它挣脱地球引力的作用。因此,除了给予物体以 的动能外(其中m表示人造成天体的质量,v表示增加的速度12.4km/s),还需给予它 (v2表示第二宇宙速度)的动能,即 .用V3表示第三宇宙速度(以地球为参考系),则人造天体应具有的动能等于 时,才能满足上述条件,则
(3)第三宇宙速度(逃逸速度):v =16.7千米/秒
(卫星挣脱太阳束缚的最小发射速度)
(1)第一宇宙速度(环绕速度):v =7.9千米/秒
(地球卫星最大的绕行速度,地球卫星的最小发射速度)
(2)第二宇宙速度(脱离速度):v =11.2千米/秒
(卫星挣脱地球束缚变成小行星的最小发射速度)
或
4、宇宙速度
“供”“需”是否平衡决定物体做何种运动
F
=
r
v
m
2
提供物体做圆周运动的力
物体做圆周运动所需要的向心力
以7.9Km/s速度绕地表运行
在该处点火加速,使速度V>7.9Km/s卫星进入椭圆轨道
由P到Q速度变小机械能守恒
在该处再次点火加速, 但以v<7.9Km/s进入预定轨道.
P
Q
动画制作:金迎时
卫星的发射过程
月球
月球轨道
地月转移轨道
点火加速
减速制动
地球
航天科学的三位先驱
齐奥尔科夫斯基
第5节 宇 宙 航 行
罗伯特 戈达德
韦纳·冯·布劳恩
历史放映厅:人类载人航天50年
梦想成真
课堂小结
1、宇宙速度:
第一宇宙速度:v=7.9km/s 是卫星发射的最小速
度,是卫星绕地球运行的最大速度。
第二宇宙速度:v=11.2km/s,是卫星挣脱地球束
缚的最小发射速度
第三宇宙速度: v=16.7km/s,是挣脱太阳束缚的
最小发射速度。
2、研究天体运动的基本方法:
把天体或人造卫星的运动看作匀速圆周运动,万有引力提供天体或人造卫星的向心力.
课堂小结
专题学习网站
中国载人航天工程网:http://www.cmse.
中国探月网:http://www.clep./
再看一遍
Djbm
乾安七中 金迎时