Tuesday, November 15, 2005

First snow of the season

Well... Here it is.. if it's coming, it'll come. Just sooner or later. The snow is here.. and this time, the snow is not going away that easily. At least not without a fight. After last night snow, freezing rain followed and the road conditions worsened drastically.

Immediately, called Total Home to order winter tires for the Echo..

Kenneth

Now the actual bug..

Kinda wanta do the bug fixing in another entry, although it's kinda simple bug.

The place where the combobox draws and animate the drop down is in

function displayDropdown(show:Boolean) : Void

Now.. this function takes show as a boolean to see if it should open or close the drop down.

To check if it's overflowing, it converts the local coordinate of the the drop down to global by

point.x = 0; point.y = height; localToGlobal(point);

That's all fine and dandy.. and it works.. however, right before the check:

point.y + dd.height > Stage.height;

it does this:
dd._parent.globalToLocal(point);

Why.. i don't know, but that certainly messes up the calculation.

So all i did is doing that after the check. Since you do that in both overflow or nonoverflow conditions, i make a boolean value of that condition and then do the conversion. And then just check the boolean.


...
dd.onTweenEnd = tweenEndShow;
var initVal;
var endVal;

var overflow:Boolean = point.y + dd.height > Stage.height;
dd._parent.globalToLocal(point);
if (overflow)
...


That's it... and everything works like it should.

Fixing Flash standard Combobox code

You think macromedia code in perfect? try their combobox. Recently, i was in this project that loads external swfs into mcs. There were different mcs at different levels that loads swfs and some swfs contain drop downs. The mc that is one level down from _level0 was behaving correctly - combobox would be able to detect the border and know it'll not make it and rolls up. The one that is two levels down, got it wrong and rolls down and consequently rolls beneath the border.

Since redesigning the interface wasn't possible, so i could only debug the macromedia codes. But... where do i find the codes behind the combobox?

One thing - the combobox is stored as swc (components) and loaded into flash every time flash starts. Location is C:\Program Files\Macromedia\Flash 8\en\Configuration\Components\User Interface.

Second... how to generate these swcs...

to make swcs, or any flash objects, you'll need the fla, and the as file.

The AS: can be found @ C:\Program Files\Macromedia\Flash 8\en\First Run\Classes\mx\controls

The fla.. is found @ C:\Program Files\Macromedia\Flash 8\en\Configuration\ComponentFLA

The file you're looking for is StandardComponents.fla

It's a fla that contains all flash standard components there are.

So to make the swcs.. all you have to do is change the as file, and then right click on the comboxbox in the library and say "export to swc".. specify your location, and that's it..

Now the tricky thing is... and i think it's because i'm skinning the thing, so the source is not in the above location but in C:\Documents and Settings\kleong\Local Settings\Application Data\Macromedia\Flash 8\en\Configuration\Classes\mx\controls.

Very strange..

But that's the scoop.