Archive for December, 2007

23
Dec

Flash scrollPane component scrollbar not showing up

Posted By wassim in Flash, Flash Tutorials

This fix applies to flash 8 scrollPane component v2.

Here’s the problem: you attach content dynamically at runtime to your scrollPane, then much to your surprise, the vertical scroll bar doesn’t show up despite the fact that you specified vScrollPolicy as “on” or “auto” and that the content is larger than the scrollPane.

You probably know the problem that’s why you are here! Google dropped you in the right place, I have found a solution! A working fix.

After searching for two hours, and trying all the suggested workarounds like calling the redraw() method on the instance or the onComplete(), doLater() or even the invalidate() method, none of these worked, I even tried lowering the frame rate of the movie but all this ended up failing so I started experimenting and I found the following:

If you change the position of the content clip inside your scroll pane component, the scroll bar will fail to account for this change, it might even not appear in the first place, if you add content dynamically, like attaching a movieClip from the library on runtime, you will also face issues with the scroll bar.

What I did to solve the issue and debug is that I simply called the setSize() method twice, in the first call, I assigned a height higher than the desired one then in the second call, I assigned the desired height and this worked ! the scroll bar of the scrollpane now appears and behaves as expected.

Note that this fixed the case where the content is being attached from the library, not loaded externally.

 

4
Dec

Flash Player cache and smaller swf files

Posted By wassim in Flash Tutorials

This new feature has been introduced in flash player 9,0,115,0.

 Certain standard flash components (dataGrid, comboBox, list etc..) are used by a large number of websites. For example, More than 100 Kb of identical data has to be downloaded for every Flex application (the flex framework) . With the new Flash Player cache, Flex applications will download and start up much faster because users will probably have the framework already in a special cache from one site and will not need to download it again.

The Flash Player cache is not the same as the browser’s cache. It works by storing the contents of a new type of file (SWZ) on your hard drive. When a website makes a request for the SWZ file from the server, Flash Player first checks to see whether it has the matching file already in the cache before attempting to download it.

 Besides providing smaller size advantage and thus faster loading, this feature is also beneficial to the application host by reducing bandwidth.

4
Dec

Flash loader component failing to scale down loaded pictures

Posted By wassim in Flash

Hi,

I’ve ran into this bug recently and tried to find a solution, a quick google search returned no answers to the issue so I thought I would post about the problem here and also post the solution / workaround I found.

The problem is that the loader component (flash 8 AS2) is not scaling down the loaded jpg (unless the latter are cached by the browser) despite the fact that I have set the scaleContent property of the component to true via the component inspector panel (and even tried to set it via actionScript code), so as soon as the picture is loaded, it displays or renders to the screen with its original dimensions, if you refresh the page, it will scale down correctly.

Just a side note here, this has happened while I was using multiple instance of the loader component each loading a different jpg having a unique contentPath.

The solution I found is simply to preload the pictures I intend to use first using the MovieClipLoader class and then to set the contentPath property of the instances AFTER the images have been fully loaded (and thus cached by the browser). This solution works.

 

PS: you’ll have to test online to reproduce this since flash loads local content differently.