主题:  Flash读写文件Action

困龙在天

职务:普通成员
等级:7
金币:10.0
发贴:2942
注册:2001/5/17 23:14:57
#12001/8/9 10:44:38
朋友leedesign写的,不知可不可以,大家试试吧!

写文件
function WriteDemo()
{
  var fso, f, r
  var ForReading = 1, ForWriting = 2;
  fso = new ActiveXObject("Scripting.FileSystemObject")
  f = fso.OpenTextFile("c:\\testfile.txt", ForWriting, true)  f.Write("Hello world!");
  f.Close();  f = fso.OpenTextFile("c:\\testfile.txt", ForReading);
  r = f.ReadLine();
  return(r);
}
读文件
function GetHeader()
{  
var fso, f;
  var ForReading = 1, ForWriting = 2;
  fso = new ActiveXObject("Scripting.FileSystemObject");
  f = fso.OpenTextFile("c:\\testfile.txt", ForWriting, true);
  f.Write("Header");
  f.Write("1234567890987654321");
  f.Close();
  f = fso.OpenTextFile("c:\\testfile.txt", ForReading);
  return(f.Read(6));
}

编辑历史:[这消息被sintian编辑过(编辑时间2001-08-09 10:46:33)]

[url]http://sintian.chinaccd.net[/url]

Demon.S

职务:版主
等级:5
金币:10.0
发贴:2468
注册:2000/9/15 13:56:49
#22001/8/9 11:00:36
ft,这个是ActiveX的文件系统控件没错,但用到flash中是不太可能的,因为flash的action执行过程是假的编程环境...当然你这两个function用到js里面是没错误的。
它本身的Active X我可以提供:

Properties
ReadyState (get only)
Returns the state of the Flash movie. Use to check for availability. 0=Loading, 1=Uninitialized, 2=Loaded, 3=Interactive, 4=Complete. Authorware syntax:
result:= GetSpriteProperty(IconID@"IconTitle",#ReadyState)
TotalFrames (get only)
Returns the total number of frames in the movie. This is not available until the movie has loaded. Authorware syntax:
result := GetSpriteProperty(IconID@"IconTitle",#TotalFrames)
FrameNum (get or set)
Returns or determines the currently displayed frame of the movie. Setting this property advances or rewinds the movie. Authorware syntax:
result := GetSpriteProperty(IconID@"IconTitle",#FrameNum)
SetSpriteProperty(IconID@"IconTitle",#FrameNum,frame)
Playing or IsPlaying (get or set)
Specifies whether the movie is playing. Returns true if the movie is currently playing, false if it is paused. Authorware syntax:
result := GetSpriteProperty(IconID@"IconTitle",#Playing)
result := GetSpriteProperty(IconID@"IconTitle",#IsPlaying)
SetSpriteProperty(IconID@"IconTitle",#Playing,state)
SetSpriteProperty(IconID@"IconTitle",#IsPlaying,state)
Quality (get or set)
Returns or specifies the current rendering quality (0=Low, 1=High, 2=AutoLow, 3=AutoHigh). Authorware syntax:
result := GetSpriteProperty(IconID@"IconTitle",#Quality)
SetSpriteProperty(IconID@"IconTitle",#Quality,setting)
ScaleMode (get or set)
Returns or specifies the scale mode for the Flash movie (0=ShowAll, 1= NoBorder, 2 = ExactFit). Authorware syntax:
result := GetSpriteProperty(IconID@"IconTitle",#ScaleMode)
SetSpriteProperty(IconID@"IconTitle",#ScaleMode,mode)
AlignMode (get or set)
Returns or specifies the align mode of bit flags. (Left=+1, Right=+2, Top=+4, Bottom=+8). Authorware syntax:
result := GetSpriteProperty(IconID@"IconTitle",#AlignMode)
SetSpriteProperty(IconID@"IconTitle",#AlignMode,mode)
Loop (get or set)
Specifies the loop state of the Flash movie. Returns true if the movie loops, false to play once. Authorware syntax:
result := GetSpriteProperty(IconID@"IconTitle",#Loop)
SetSpriteProperty(IconID@"IconTitle",#Loop,state)
Movie (get or set)
Returns or specifies the URL source for the movie file. Setting this property will load a new movie. Authorware syntax:
result := GetSpriteProperty(IconID@"IconTitle",#Movie)
SetSpriteProperty(IconID@"IconTitle",#Movie,source)
Events
OnProgress(percent)
Generated as the Flash movie is downloading.
OnReadyStateChange(state)
Generated when the ready state of the control changes. The possible states are: 0=Loading, 1=Uninitialized, 2=Loaded, 3=Interactive, 4=Complete.
FSCommand(command, args)
Generated when an FSCommand action is performed in the movie with a URL and the URL starts with FSCommand :. Use this to create a response to a frame or button action in the Flash movie.


除非是用geturl,lv等读取外部js语法的文件系统。



困龙在天

职务:普通成员
等级:7
金币:10.0
发贴:2942
注册:2001/5/17 23:14:57
#32001/8/9 11:26:34
头都大了!
你怎么写出来的!!


[url]http://sintian.chinaccd.net[/url]

Demon.S

职务:版主
等级:5
金币:10.0
发贴:2468
注册:2000/9/15 13:56:49
#42001/8/9 11:29:56
不要慌,它分两种
property属性和events事件,用过vb的一看就知道其实并不强大的破activeX.



suzzledboy

职务:普通成员
等级:1
金币:1.0
发贴:225
注册:2001/6/21 19:07:00
#52001/8/14 5:55:46
那东西怎么用呀。。



木桫椤

职务:普通成员
等级:1
金币:0.0
发贴:46
注册:2001/8/9 0:43:37
#62001/8/18 20:20:44
画魔我头大了~!晕~!