agiliq
agiliq

Reputation: 7758

dynamic height and width with swfobject

swfObject embed has the following signature,

swfobject.embedSWF(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn)

with width and heigth required attributes,

What can I do to signify dynamic height and width.

Upvotes: 2

Views: 6686

Answers (4)

pipwerks
pipwerks

Reputation: 4581

Create a container element, and set the width/height of the container to whatever you desire. Then embed the SWF with 100% width and 100% height inside your container.

See this StackOverflow question: Resize an SWF when loading it with SWFObject

Upvotes: 1

ufk
ufk

Reputation: 32144

after reading this answer and browsing some more on the net i came up with a solution to the problem.

I have a flex application with several rooms and each room has a different height.

what i did is set swfobject with the minimum height that I need for my application.

In the construct of my flex application i attached to the ResizeEvent and MoveEvent events of the components in my application, so whenever an object moves or resized I can easily calculate the new height of my application.

when I catch one of these events I call a resizeSwfObject javascript function and I pass it the new desired height.

that javascript function sets a new value on the .style.height attribute of the flash object container/element.

Kfir

Upvotes: 3

poke
poke

Reputation: 388313

It's not possible for the browser to determine the size of the application and change the object's size automatically based on that.

Upvotes: 1

Lars Blåsjö
Lars Blåsjö

Reputation: 6127

I am not entirely sure what you mean by dynamic height and width, but as far as I know, you need to specify width and height either in pixels or percent (of the surrounding element), and I don't know of any way to let the size of the swf decide, like you can do for example with an img tag, by leaving out width and height.

Upvotes: 0

Related Questions