# Using HTML scroll for a dynamically sized flash file

**URL:** <https://forum.kirupa.com/t/using-html-scroll-for-a-dynamically-sized-flash-file/198074>\
**Category:** web dev\
**Created:** [August 22, 2006, 7:30am UTC](https://forum.kirupa.com/t/using-html-scroll-for-a-dynamically-sized-flash-file/198074 "2006-08-22T07:30:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![makecake](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@makecake](https://forum.kirupa.com/u/makecake)\
**Post date:** [August 22, 2006, 7:30am UTC](https://forum.kirupa.com/t/using-html-scroll-for-a-dynamically-sized-flash-file/198074/1 "2006-08-22T07:30:57Z")

</div>

EDIT: Okay, I solved it and it was a lot easier than I thought, anyway, here is a solution if you want to change your swf size dynamically, delete this post if you find it unessecary

first make a swf file containing a movieclip with the instance name “sizeBtn” and add this code to frame1

```auto

import flash.external.*;
var command:String;
var targetSize:Number = 700; //the target height

sizeBtn.onRelease = function() {[INDENT]command = String(ExternalInterface.call("setFlashHeight", "flashid", targetSize)); 
//make more buttons or functions to change to any other size
[/INDENT]}

```

and publish it to get a html file, you might have to change the publish settings for the HTML a bit if the resizeing behaves strangely.

Then add

```auto

<div id="flashid" style="width:550px; height:400px;">

</div>

```

around the flash \<object\> tag (change dimensions to suit your needs)

and in the \<head\> tag add:

\<CODE\>  
\<script type=“text/javascript”\>  
function setFlashHeight(divid, newH){  
document.getElementById(divid).style.height = newH+“px”;  
}  
\</script\>  
\</CODE\>

and test it, you should now be able to change the height of the flash file from within the swf, animations can probably be added but I haven’t gotten around to that yet
