Link to home
Start Free TrialLog in
Avatar of kamarrizwan
kamarrizwan

asked on

embedding a flash file in JSP page

Hi,

I’m embedding a flash file in JSP page and the file is coming from database and every time this is a different file.
Some flash files are of different size. As flash file is not taking default dimension (like an image) in the Browser so I need to specify the dimension (width, height).

How can I fetch the Attributes (width, height) of a flash file so that I can put the dimension dynamically?
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

According to this:

http://www.half-serious.com/swf/format/

you should be able to read the first few bytes of the swf file, and find out the width and height:

SWF File Header      
     Field                Type*      Comment    
     Signature        byte              Signature byte always ‘F’    
     Signature        byte              Signature byte always ‘W’    
     Signature        byte              Signature byte always ‘S’    
     Version           byte         Single byte file version (e.g. 0x04F for SWF 4)    
     FileLength       int            Length of entire file in bytes    
     FrameSize      RECT      Frame size in twips    

where "RECT" is of the format:

RECT      
     Field        Type                 Comment    
     Nbits       nBits = UB[5]     Bits used for each subsequent field    
     Xmin       SB[nBits]            X minimum position for rectangle in twips    
     Xmax      SB[nBits]            X maximum position for rectangle in twips    
     Ymin            SB[nBits]            Y minimum position for rectangle in twips    
     Ymax      SB[nBits]           Y maximum position for rectangle in twips  
Any use?

Problems?

Tim
Avatar of kamarrizwan
kamarrizwan

ASKER

Hi TimYates,
thanks for workout.
As i'm new to jsp, still trying to got the solution. can you please help me out to understand the code in better way.
ASKER CERTIFIED SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Tim,

Thanks for your workout and i hope this should be good answer as i am seeing the confidence in writing the solution.

Sorry for delayed reply, actually i have not got chance to test your code as we are feeding the flash dimension into the database.

Thank you very much.