Getting Flash SWF Dimensions in RR CGI?

Are you using LiveCode to create server scripts or CGIs?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
hsthompson
Posts: 10
Joined: Fri Mar 14, 2008 8:13 pm

Getting Flash SWF Dimensions in RR CGI?

Post by hsthompson » Wed Jul 16, 2008 1:37 am

I'm authoring Flash content to work with an RR CGI script, written by another programmer who's currently too busy to update the code himself. I'd like to take a stab at modifying it.

The other programmer's CGI generates a page with a list of possible SWF files to open. When a SWF file is selected in a list, the SWF is presented in a thumbnail size (it is the actual SWF, just reduced).

The user can then click a button to launch a new window with the SWF presented in a dynamically-generated HTML page.

We want the SWF to be presented at its actual size, so we turn off scaling in the embed and object code. However, since we don't know what each SWF's dimensions are, we've given the embed and object codes a large arbitrary number; which sort of works, except that you can have a small SWF floating in the middle of a massive embed/object area.

What I would like to do is change the RR code somehow to get the actual dimensions of the SWF and write them into the dynamically-generated HTML page's embed/object tags to perfectly fit. I've read that PHP has a function called "getimagesize" that works with SWFs. Does RR have something similar?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Wed Jul 16, 2008 9:35 am

Dear hsthompson,

Set the filename of a player object to the path to your flash movie and get the formattedWidth and formattedHeight of the player object.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

hsthompson
Posts: 10
Joined: Fri Mar 14, 2008 8:13 pm

Post by hsthompson » Wed Jul 16, 2008 6:23 pm

Hi Mark. Thanks for your reply.

I'm a total noob here. Is there a player object when it's called as a CGI through a web browser?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Wed Jul 16, 2008 11:59 pm

Dear hsthompson,

If you created a player object and the CGi server can deal with it, there is a player object :-) Sorry, I can't really help you with that.

Perhaps you could put some exif information or ID3 tags into your flash files. Easier would probably be to have your flash files accompanied by a simple text file with the necessary information and have that read by Rev or php.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Post by trevordevore » Thu Jul 17, 2008 3:26 am

Hi,

Revolution doesn't have any way of dealing with SWF natively at the moment. If you want to get at the info for a SWF file you have to parse the file header yourself and grab the data.

Depending on how important this feature is to you it may or may not be worth the effort to write your own library. Parsing the SWF header isn't terribly difficult if you are familiar with binary and have the SWF spec in hand but you do have to account for ZLib compression in SWF files that are compressed. That can be a little trickier.

If you do want to do this and need help there is a developer named Dar Scott who is very knowledgable in this area. It would be worth contacting him.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

Post Reply

Return to “CGIs and the Server”