473,770 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get the actual size (width*height) of flash file?

yxq
Hello,
I use the com component "shockwave flash object" to play flash file, but how
to get the actual size (width*height) of flash file but no control size?
thank you!
Nov 21 '05 #1
3 7828
yxq
I found a link
http://www.4guysfromrolla.com/webtec...102001-1.shtml

But the code will not work on vb6.0

"yxq" <ga***@163.ne t> дÈëÏûÏ¢ÐÂÎÅ:OT **************@ TK2MSFTNGP10.ph x.gbl...
Hello,
I use the com component "shockwave flash object" to play flash file, but
how to get the actual size (width*height) of flash file but no control
size? thank you!

Nov 21 '05 #2
yxq
I have converted the code into vb.net to get width and height, but the
return value is not right.
Can anyone help me to view the code below? Thank you very much!

The SWF File Format
Specification(http://homepages.tig.com.au/~dkl/swf/SWFfileformat.html)

My vb.net code
*************** *************** *************** *************** **

Public Class SWFInfo
Private header As String
Private RECTdata As String
Private nBits As String
Private mxMin As Int32
Private mxMax As Int32
Private myMin As Int32
Private myMax As Int32
Private mheigt as Int32
Private mwidth As Int32

Public ReadOnly Property Width()
Get
Return mwidth
End Get
End Property

Public ReadOnly Property Height()
Get
Return mheigt
End Get
End Property

Public Function ReadHeader(ByVa l fileName)
Const ForReading As Short = 1
Const ForWriting As Short = 2
Const ForAppending As Short = 8
Dim fso, f As Object
fso = CreateObject("S cripting.FileSy stemObject")
f = fso.OpenTextFil e(fileName, ForReading)
header = f.Read(21)

RECTdata = DecToBin(Asc(Mi d(header, 9, 1)), 8)

RECTdata = RECTdata & DecToBin(Asc(Mi d(header, 10, 1)), 8)
RECTdata = RECTdata & DecToBin(Asc(Mi d(header, 11, 1)), 8)
RECTdata = RECTdata & DecToBin(Asc(Mi d(header, 12, 1)), 8)
RECTdata = RECTdata & DecToBin(Asc(Mi d(header, 13, 1)), 8)
RECTdata = RECTdata & DecToBin(Asc(Mi d(header, 14, 1)), 8)
RECTdata = RECTdata & DecToBin(Asc(Mi d(header, 15, 1)), 8)
RECTdata = RECTdata & DecToBin(Asc(Mi d(header, 16, 1)), 8)
RECTdata = RECTdata & DecToBin(Asc(Mi d(header, 17, 1)), 8)

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

mxMin = BinToDec(Mid(RE CTdata, 6, nBits))
mxMax = BinToDec(Mid(RE CTdata, 6 + nBits * 1, nBits))

myMin = BinToDec(Mid(RE CTdata, 6 + nBits * 2, nBits))
myMax = BinToDec(Mid(RE CTdata, 6 + nBits * 3, nBits))

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

Private Function DecToBin(ByRef inNumber As Object, ByRef OutLenStr
As Object) As String
Dim binary As String
Do While inNumber >= 1
binary = binary & inNumber Mod 2
inNumber = inNumber \ 2
Loop
binary = binary & New String("0", OutLenStr - Len(binary))
Return StrReverse(bina ry)
End Function

Private Function BinToDec(ByRef inBin As Object) As Int32
Dim counter As Int32
Dim temp As Int32
Dim Value As Int32
inBin = StrReverse(inBi n)
temp = 0
For counter = 1 To Len(inBin)
If counter = 1 Then
Value = 1
Else
Value = Value * 2
End If
temp = temp + CDbl(Mid(inBin, counter, 1)) * Value
Next
Return temp
End Function
End Class
"yxq" <ga***@163.ne t> дÈëÏûÏ¢ÐÂÎÅ:%2 *************** *@TK2MSFTNGP11. phx.gbl...
I found a link
http://www.4guysfromrolla.com/webtec...102001-1.shtml

But the code will not work on vb6.0

"yxq" <ga***@163.ne t> дÈëÏûÏ¢ÐÂÎÅ:OT **************@ TK2MSFTNGP10.ph x.gbl...
Hello,
I use the com component "shockwave flash object" to play flash file, but
how to get the actual size (width*height) of flash file but no control
size? thank you!


Nov 21 '05 #3

"yxq" <ga***@163.ne t> wrote
I have converted the code into vb.net to get width and height, but the
return value is not right.


Exactly how is the frame size calculated? The link you provided shows
it is a RECT type, and then that is defined elsewhere using some sort of
variable bit encoding. Can you find more info about that? I don't see how
the header can be a fixed size (20 bytes) if the number of bits is variable....

In any case, I'd suggest you go the binary route and treat it something like
a Random Access record. Once you have the structure defined (properly)
it would be a quick matter to get the info.

See this section on Random Access:

http://msdn.microsoft.com/library/de...FileAccess.asp

HTH
LFS

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2603
by: Phil... | last post by:
how can i find the width and height of a jpeg file i am not interested in viewing the file i just want the height and width
14
21541
by: delerious | last post by:
I need to determine an element's width and height in pixels (not including padding, border, and margin) in Javascript. The element will not have width or height styles specified. In Mozilla, I know I can use document.defaultView.getComputedStyle() to do this. IE does not support document.defaultView.getComputedStyle(). It supports offsetWidth/offsetHeight, but those include the padding and border. IE also supports...
15
1124
by: DM | last post by:
For <img> tags, are the width and height attributes necessary? Could they just be omitted? dm
2
1583
by: Jim Ciotuszynski | last post by:
Anybody know where I can find an example or documentation on how to get and possibly set the width/height of the active browser's window. Thank in advance, Jim Ciotuszynski
3
1679
by: Nathan Sokalski | last post by:
I need to get the width and height of a GIF image through code. I need this info so that I can set the width and height properties of Image and ImageButton objects. System.IO.File.GetAttributes(imagelocation) only seem to return properties that all files have, which does not include width and height. How can I get this info? Any help would be appreciated. Thanks. -- Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/
10
3317
by: News | last post by:
I am trying to be able to manipulate the width and height of an <img> but do not seem to be able. "Yes", I know the JavaScript will "not" manip anything, which is ok. I simply do not know how to capture the width or height. Once I can do that I can manipulate them. Here is the HTML for the <img> <div class="ImgMnp" id="myImg" onmouseover="imgSize('myImg','fpImg)"> <img src="images/FirePlace.jpg" width="480" height="640" id="fpImg" />
4
1946
by: News | last post by:
I am trying to figure out why the HEIGHT <divtags on my page do not work on IE? http://www.wyght.com/mySite/thirds.html http://www.wyght.com/mySite/CSS/div_thrids.css This works on Opera, Firefox and NN Why do the <divheight work on all but IE?
1
4199
epots9
by: epots9 | last post by:
I have a image inside of a div <div id="image"> <div id="loader"> <img id="loaderImage" src="assets/loader.gif" alt="loading..." /> </div> <div id="loaded"> <img id="picture" src="" alt="" /><!--image in question--> <div id="closeAll" onclick="closeAll();">X</div> </div>
1
1941
by: JDeats | last post by:
I have many labels that are disappearing from my form when the user resizes it, they seem to dissapear when certain width/height thresholds are exceeded. I have no code in place purposely trying to alter these controls on maximize, minimize or form resize so whatever is causing this is default behavior. The settings on the labels that are disappearing are all default settings with the exception of Font, which is set to Vernanda 8.25pt...
0
9618
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10101
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9906
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.