帝国软件
  设为首页 加入收藏 关于我们
 
解密帝国网站管理系统
栏 目:
 
您的位置:首页 > 技术文档 > ASP编程
在asp文件中访问flash详细信息
作者:chenyangasp 发布时间:2005-03-12 来源:开发者俱乐部
<%

Class SWFDump

Private header
Private RECTdata
Private nBits
Private mversion
Private mfilelen
Private mxMin
Private mxMax
Private myMin
Private myMax
Private mheigt
Private mwidth
Private mframerate
Private mframecount

Private Sub Class_Initialize()

End Sub

Private Sub Class_Terminate()

End Sub


Private Function ReadHeader (filename)
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(filename, ForReading)
ReadHeader = f.Read(21)
End Function

Private Function ToBin(inNumber, OutLenStr )
Dim binary
binary = ""
do while inNumber >= 1
binary = binary & inNumber mod 2
inNumber = inNumber 2
loop
binary = binary & String(OutLenStr - len(binary), "0")
ToBin = StrReverse(binary)
End Function

Private Function Bin2Decimal(inBin)
Dim counter
Dim temp
Dim Value
inBin = StrReverse(inBin)
temp = 0
For counter = 1 to Len(inBin)
If counter = 1 then
Value = 1
Else
Value = Value * 2
End If
temp = temp + mid(inBin, counter ,1) * Value
Next
Bin2Decimal = temp
End Function

Public Function SWFDump(fileName)

header = ReadHeader (fileName)
mversion = asc(mid(header,4,1))
mfilelen = asc(mid(header,5,1))
mfilelen = mfilelen + asc(mid(header,6,1)) * 256
mfilelen = mfilelen + asc(mid(header,7,1)) * 256 * 256
mfilelen = mfilelen + asc(mid(header,8,1)) * 256 * 256 * 256

RECTdata = ToBin(asc(mid(header,9,1)),8)
RECTdata = RECTdata & ToBin(asc(mid(header,10,1)),8)
RECTdata = RECTdata & ToBin(asc(mid(header,11,1)),8)
RECTdata = RECTdata & ToBin(asc(mid(header,12,1)),8)
RECTdata = RECTdata & ToBin(asc(mid(header,13,1)),8)
RECTdata = RECTdata & ToBin(asc(mid(header,14,1)),8)
RECTdata = RECTdata & ToBin(asc(mid(header,15,1)),8)
RECTdata = RECTdata & ToBin(asc(mid(header,16,1)),8)
RECTdata = RECTdata & ToBin(asc(mid(header,17,1)),8)

nBits = Mid(RECTdata,1,5)
nBits = Bin2Decimal(nBits)

mxMin = Bin2Decimal(Mid(RECTdata,6,nBits))
mxMax = Bin2Decimal(Mid(RECTdata,6 + nBits * 1 ,nBits))
myMin = Bin2Decimal(Mid(RECTdata,6 + nBits * 2 ,nBits))
myMax = Bin2Decimal(Mid(RECTdata,6 + nBits * 3 ,nBits))

mheigt = (myMax - myMin) / 20
mwidth = (mxMax - mxMin) / 20

mframerate = asc(mid(header,18,1))

mframecount = asc(mid(header,19,1))
mframecount = mframecount + asc(mid(header,20,1)) * 256

End Function


Public Property Get Heigt()
Heigt = mheigt
End Property

Public Property Get Width()
Width = mwidth
End Property

Public Property Get Version()
Version = mversion
End Property

Public Property Get FileLen()
FileLen = mfilelen
End Property

Public Property Get xMin()
xMin = mxMin
End Property

Public Property Get xMax()
xMax = mxMax
End Property

Public Property Get yMin()
yMin = myMin
End Property

Public Property Get yMax()
yMax = myMax
End Property

Public Property Get Framerate()
Framerate = mframerate
End Property

Public Property Get Framecount()
Framecount = mframecount
End Property
End Class
%>

做成包含文件swfheaderdump.inc
调用:

<!-- #include file="swfheaderdump.inc" -->
<%
' Pass the SWF name in querystring this way
' swfdump.asp?swf=yourmovie.swf

set myObj = new swfdump
myObj.SWFDump (Server.MapPath(request("swf")))

Response.Write "Heigt (pixel) = " & myObj.Heigt & "<br>"
Response.Write "Width (pixel) = " & myObj.Width & "<br>"
Response.Write "Version = " & myObj.Version & "<br>"
Response.Write "FileLen (bytes) = " & myObj.FileLen & "<br>"
Response.Write "xMin (twips) = " & myObj.xMin & "<br>"
Response.Write "xMax (twips) = " & myObj.xMax & "<br>"
Response.Write "yMin (twips) = " & myObj.yMin & "<br>"
Response.Write "yMax (twips) = " & myObj.yMax & "<br>"
Response.Write "FrameRate = " & myObj.FrameRate & "<br>"
Response.Write "FrameCount = " & myObj.FrameCount & "<br>"
%>

  
评论】【加入收藏夹】【 】【打印】【关闭
※ 相关链接
 ·在ASP中使用SQL语句之12:连接  (2005-03-12)
 ·在ASP中使用SQL语句之11:记录统计  (2005-03-12)
 ·在ASP中使用SQL语句之10:视图  (2005-03-12)
 ·在ASP中使用SQL语句之9:表单操作  (2005-03-12)
 ·在ASP中使用SQL语句之8:随机数  (2005-03-12)
 ·在ASP中使用SQL语句之7:ORDER BY  (2005-03-12)
 ·在ASP中使用SQL语句之6:存储查询  (2005-03-12)
 ·在ASP中使用SQL语句之5:开始执行  (2005-03-12)
 ·在ASP中使用SQL语句之4:联合语句  (2005-03-12)
 ·在ASP中使用SQL语句之3:LIKE、NO  (2005-03-12)

   栏目导行
  PHP编程
  ASP编程
  ASP.NET编程
  JAVA编程
   站点最新
·致合作伙伴的欢迎信
·媒体报道
·帝国软件合作伙伴计划协议
·DiscuzX2.5会员整合通行证发布
·帝国CMS 7.0版本功能建议收集
·帝国网站管理系统2012年授权购买说
·PHPWind8.7会员整合通行证发布
·[官方插件]帝国CMS-访问统计插件
·[官方插件]帝国CMS-sitemap插件
·[官方插件]帝国CMS内容页评论AJAX分
   类别最新
·在ASP中使用数据库
·使用ASP脚本技术
·通过启动脚本来感受ASP的力量
·学习使用ASP对象和组件
·解析asp的脚本语言
·初看ASP-针对初学者
·ASP开发10条经验总结
·ASP之对象总结
·ASP与数据库应用(给初学者)
·关于学习ASP和编程的28个观点
 
关于帝国 | 广告服务 | 联系我们 | 程序开发 | 网站地图 | 留言板 帝国网站管理系统