all groups > flash actionscript > november 2004 >
You're in the

flash actionscript

group:

Sizing a flash movie in a browser


Re: Sizing a flash movie in a browser David Stiller
11/30/2004 5:12:25 PM
flash actionscript:
GrandmasterB,

You can manually set the height and width attributes of the HTML's
<embed> tag and <object> tags to whatever size you like. Flash resizes
well, especially if these graphcs use vector art.


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

Sizing a flash movie in a browser GrandmasterB
11/30/2004 9:35:04 PM
Could someone point me in the right direction for this?

I created a few graphing movies with Flash (MX 2004). These create pie
graphs, bar charts, etc, and load their data by pulling an XML file from the
server. These graphs have worked well, so now the people in charge & the
customers want the flash graphs rolled out across our web application.

The problem I'm encountering is that some graphs - particularly the bar graphs
- have a lot of data, and really should be larger than what the move is sized
at. For example, the movie's properties specifies a stage height of 300 and a
width of 400. But on some of the bar graphs, it might be better if it was set
to a 600 height.

Is there a way that I can set the size of the stage via, say a variable in the
html file where the object is embedded? I'm not looking to scale the image,
but actually alter the size of the movie itself.

I've changed some of the 'scale' properties, but that doesnt look to do what I
need. I've also tried a resizing listener, but that doesnt seem to fire when
within a browser window.

Any ideas? Am I missing something obvious?


Re: Sizing a flash movie in a browser ryder1212
12/1/2004 12:09:24 AM
no way that I know of to re-size the stage dynamically. But you could stick
the graphs in a scroll pane component that could be scrolled vertically or
horizontally if the newly loaded graph is bigger than stage size.
Re: Sizing a flash movie in a browser shamou
12/1/2004 12:20:37 AM
Hi, scaling is hugely useful but also hugely frustrating. In terms of
dynamically resizing the stage without necessarily resizing the content, help
is at hand. MX 2004 now inlcudes a stage class that lets you dynamically resize
the stage within Flash itself. Input the following code and view it in the
test environment as you physically resize the window. You will get an idea of
how the stage dynamically resizes. If you direct the output to a text field,
you can than view the result in a brower as well. Stage.scaleMode = 'noScale'
var myListener:Object = new Object(); myListener.onResize = function () {
trace('Stage size is now ' + Stage.width + ' by ' + Stage.height); }
Stage.addListener(myListener); // later, call Stage.removeListener(myListener)
Use this in conjunction with the System.capabilities object and you have a very
flexible Flash app that responds intelligently to whatever environment it
encounters. Hope this helps
Re: Sizing a flash movie in a browser NSurveyor
12/1/2004 1:09:02 AM
Not only does MX 2004 include this class, but so does Flash 6 (MX 2003). But, I
don't believe this will let you resize flash. It merely tells you when the
stage is resized. And, if this were to be placed in an HTML document, your
script wouldn't resize the stage.
Re: Sizing a flash movie in a browser shamou
12/1/2004 2:00:23 AM
Thank you for that clarification. You are correct that the stage size cannot be
dynamically set, but the stage does resize itself according to, for example,
the size of the browser window. Using the stage.onResize event handler you can
then control the size of the objects on the stage so that more room is created
for bar charts etc by sizing them in proportion to the stage. Regards
Re: Sizing a flash movie in a browser David Stiller
12/1/2004 3:54:18 PM
GrandmasterB,

Run with the solution that makes most sense to you. :) For clarity's
sake, though, the Stage object's onResize() event handler works just fine
for SWFs. You have to create a listener object to listen to the broadcasts,
but it's pretty straight foward once you see how it's done.

Here's a tutorial:
http://moock.org/asdg/technotes/relayout/

And here's kick-a$$ usage example:
http://www.nttdata.co.jp/


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

Re: Sizing a flash movie in a browser GrandmasterB
12/1/2004 8:46:25 PM
Thanks all for the replies.

I had earlier tried the OnResize event, and that didnt look to be what I was
looking for. I think that would have worked perfectly if the flash files I was
making were to be stand alone movies, as opposed to embedded within an HTML doc.

What I'll probably end up doing is making a few different sized versions of
each graph, and just picking the most suitable size to use when the HTML is
generated. The HTML is generated by PHP anyways, so dynamically picking a size
shouldnt be a problem.

AddThis Social Bookmark Button