How to resize swf at runtime so that the browser creates an html scrollbar?

I have a swf with loading text in Sprite that changes based on the content placed in - I would like, though for those that are larger than the page, for the browser to use its own scrollbars and not process them in actionscript (very similar at http://www.nike.com/nikeskateboarding/v3/ ...)

I really looked at the material that I did, but I just could not remove it. Any idea?

+4
source share
5 answers

I have never done it this way, but I think swffit could disable it.

+1
source

The trick is to use simple JavaScript to resize the Flash DOM node:

function resizeFlash( h ) { // "flash-node-id" is the ID of the embedded Flash movie document.getElementById("flash-node-id").style.height = h + "px"; } 

What do you call from the Flash movie as follows:

 ExternalInterface.call("resizeFlash", 400); 

In fact, you don’t need to have JavaScript code from the outside, you can do all this from Flash if you want:

 ExternalInterface.call( "function( id, h ) { document.getElementById(id).style.height = h + 'px'; }", ExternalInterface.objectID, 400 ); 

An anonymous function is to simply pass identifiers and heights as parameters, rather than concatenating them into a JavaScript string.

I think JavaScript is pretty cross-platform. If you want to see a live example, look at this site: talkoftheweather.com . It may not look like it was doing anything, but it automatically resizes the Flash movie to accommodate all the news (this happens immediately after downloading the news, which is done so quickly that you did not notice that this is happening) . Resizing causes the browser to show a vertical scroll bar.

+7
source

I looked at swffit halfway, but the height (and the width sometimes, but mostly the height) would be dynamic - swffit allows you to declare maxHeight, but that number will constantly change ... maybe I could figure out how to set it dynamically. Great place for me to start - thanks!

0
source

What I mainly used, if needed, is to limit how small you can create a “fullbrowser” flash memory, and for this it works great. Happy hack!

(and don't forget to post your results here, I may need this too soon;))

0
source

SWFSize

See here for more details.

Intuitsolutions.ca

0
source

Source: https://habr.com/ru/post/1276469/


All Articles