Ver Mensaje Individual
  #89 (permalink)  
Antiguo 13/08/2004, 10:39
Avatar de Saruman
Saruman
 
Fecha de Ingreso: mayo-2003
Ubicación: Panama city, Panama, Panama
Mensajes: 1.154
Antigüedad: 21 años, 5 meses
Puntos: 5
De acuerdo Propiedades de un SWF con ASP

hola a todos.... solo era para cooperar con el foro y compartir los conocimientos con los demas....
aqui les dejo una funcion interesante para conseguir las propiedades de un archivo en flash (.swf).

lo unico malo es que funciona bien para las versiones menores a la 6. esto es cuando exportan el archivo desde el macromedia flash le colocan la opcion que diga version y alli colocan una menor a la 6. eso es lo unico malo que encontre del codigo, por lo demas esta excelente.... sacas el ancho, alto, version, framerate, etc. del swf....

aqui esta el codigo.... los tranfsforme a una funcion para mejor facilidad de uso. el mismo tiene un include .inc.

ok


swfheaderdump.inc

Código:
<%
'-------------------------------------------------------------
'  Create Date : 17/10/2001 (dd/mm/yyyy)
'  Mod. Date   : 17/10/2001
'  Author      : Claudio Heidel ([email protected])
'-------------------------------------------------------------

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 = round((myMax - myMin) / 20)
    mwidth = round((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
%>

la funcion


Código:
function FlashDimension(path, archivo, tipo)
		set myObj = new swfdump
		myObj.SWFDump (Server.MapPath(path & archivo))
		
		select case lcase(tipo)
			case "w":
				out = myObj.Width
			case "h":
				out = myObj.Heigt
			case "version":
				out = myObj.Version
			case "fileLen":
				out = myObj.FileLen
			case "xmin":
				out = myObj.xMin
			case "xmax":
				out = myObj.xMax
			case "ymin":
				out = myObj.yMin
			case "ymax":
				out = myObj.yMax
			case "framerate":
				out = myObj.FrameRate
			case "framecount":
				out = myObj.FrameCount
			case else:
				out = "Alto: " & myObj.Heigt & " pixeles<br>"
				out = out & "Ancho: " & myObj.Width & " pixeles<br>"
				out = out & "Version: " & myObj.Version & "<br>"
				out = out & "Peso: " & myObj.FileLen & " bytes<br>"
				out = out & "xMin: " & myObj.xMin & "<br>"
				out = out & "xMax: " & myObj.xMax & "<br>"
				out = out & "yMin: " & myObj.yMin & "<br>"
				out = out & "yMax: " & myObj.yMax & "<br>"
				out = out & "FrameRate: " & myObj.FrameRate  & "<br>"
				out = out & "Total de Frames: " & myObj.FrameCount & "<br>"
		end select
	
	FlashDimension = out
	
	set myObj = nothing
end function
cualquier comentario solo avisen....
si tienen uno mejor... bienvenido sea... estamos para compartir y aprender

saludos
__________________
Saruman

One Ring to rule them all, One Ring to find them, One Ring to bring them all and in the darkness bind them.