View Full Version : Force a combo box to drop up
fou99004
07-19-2006, 11:20 PM
I have a swf that has a combo box near the botton. Below that is a footer that is layered above the swf. The problem is that when I click on the combobox, it opens up underneath the footer which means I can't see what is in the dropdown portion. I don't have any control over the footer so I was wondering if there is a way to make the combo box open above it instead of below. Has anyone done anything with this?
dvlnblk
07-19-2006, 11:34 PM
I don't know how to manipulate a Flash component combo box because I don't use them for reasons just like the one you mentioned. I would just build a combo box of my own. It is easy. You should try it. Dvl
fou99004
07-19-2006, 11:41 PM
Let me ask you this then. Is there a way that I can just use the combo Box component and then just modify it's functionality (extending it with a customComboBox class or something like that)? I was looking for it but I can't find the as file or the fla for the component.
dvlnblk
07-19-2006, 11:43 PM
I really don't know, I have a real problem with Flash components; I think they are really bad for multiple reasons. Is it above your programming level to make your own combo box? If so, I can help you when I get some spare time. Dvl
fou99004
07-19-2006, 11:49 PM
no it isn't above my level. It is just that it is used a lot throughout the project and it would be easier to use the skins from the component rather than try and duplicate it on my own. That and I was wondering about this. Thanks for your help and yes, I agree, flash components do suck.
dvlnblk
07-20-2006, 12:18 AM
I see what you mean but I don't know of anyway to change components, maybe someone else does. If you do want to make a comboBox I made a quick and dirty one: http://dead-line.com/victor/comboBox.html
Needs more functionality but you get the basic idea. If you want the FLA reply and I will attach it. Dvl
acolyte
07-20-2006, 12:29 AM
Hi fou99004 ,
are you attaching the component by Code true the Framework ?
If so you need to search for the Container Object and where it is arranged in your Layers.
And i dissagree with your Statement that flash components suck they are very Powerfull you just need to discover thier architecture first , once you done this it can realy speed up your developement process.
And another thing there is something about the skins if you want to define your own skin it is necessary that you load the components on stage at runntime and that you define a style Theme , there are predefined Stylethemes like the Halo theme or the default Theme. You can copy the default Theme name it whatever you want and define your own Style just with this style file and the Style will be applied to all Components you create on the Stage, thats where the advantage comes in about this components thingy.
greets Ac
fou99004
07-20-2006, 03:43 AM
acolyte, thanks for the textual slap in the face. You are right. I did just need to look at the architecture. Looking at the as behind the combobox I found this:
function displayDropdown(show:Boolean) : Void
{
if (show == _showingDropdown)
return;
// subclasses may extend to do pre-processing before the dropdown is displayed
// or override to implement special display behavior
var point = new Object();
point.x = 0;
point.y = height;
localToGlobal(point);
if (show) {
// Store the selectedIndex temporarily so we can tell
// if the value changed when the dropdown is closed
__selectedIndexOnDropdown = selectedIndex;
__initialSelectedIndexOnDropdown = selectedIndex;
getDropdown();
var dd = __dropdown;
dd.isPressed = true;
dd.rowCount = rowCount; // Don't show more lines than there is data for in the dropdown.
dd.visible = show;
dd._parent.globalToLocal(point);
dd.onTweenEnd = tweenEndShow;
var initVal;
var endVal;
if (point.y + dd.height > Stage.height)
{
// Dropdown will go below the bottom of the stage and be clipped.
// Instead, have it grow up. Position the mask above, too.
initVal = point.y - height;
endVal = initVal - dd.height;
mask._y = -dd.height;
}
else
{
initVal = point.y - dd.height;
endVal = point.y;
mask._y = border_mc.height;
}
var sel = dd.selectedIndex;
if (sel==undefined) sel = 0;
var pos = dd.vPosition;
// if (sel>pos+dd.rowCount || sel < pos) {
pos = sel-1;
pos = Math.min( Math.max(pos,0) , dd.length-dd.rowCount);
dd.vPosition = pos;
// }
// This move probably isn't necessary. Most likely we can depend on the
// first call to the tweenUpdate method to set the _y value correctly.
dd.move(point.x, initVal);
dd.tween = new Tween(__dropdown, initVal, endVal, getStyle("openDuration"));
}
else {
__dropdown._parent.globalToLocal(point);
delete __dropdown.dragScrolling;
__dropdown.onTweenEnd = tweenEndHide;
__dropdown.tween = new Tween(__dropdown, __dropdown._y, point.y-__dropdown.height, getStyle("openDuration"));
if (__initialSelectedIndexOnDropdown!=selectedIndex)
dispatchChangeEvent(undefined,__initialSelectedInd exOnDropdown, selectedIndex);
}
var ease = getStyle("openEasing");
if (ease!= undefined)
__dropdown.tween.easingEquation = ease;
_showingDropdown = show;
}
This is the whole function that deals with showing the dropdown. I found this piece of code in there :
if (point.y + dd.height > Stage.height)
{
// Dropdown will go below the bottom of the stage and be clipped.
// Instead, have it grow up. Position the mask above, too.
initVal = point.y - height;
endVal = initVal - dd.height;
mask._y = -dd.height;
}
else
{
initVal = point.y - dd.height;
endVal = point.y;
mask._y = border_mc.height;
}
I am wondering if in the linkage properties, because this is on my stage and not dynamically created if I make a class called comboboxUp which extends combobox and just has this function with the above statement that looks like this:
initVal = point.y - height;
endVal = initVal - dd.height;
mask._y = -dd.height;
This should always make it go up, shouldn't it?
I am going to test it right now, I just wanted to thank you for motivating me.
fou99004
07-20-2006, 03:21 PM
Well I am pretty sure that it will work except that it won't let me link my custom class to the ComboBox component so I guess what I need to do is build my own extension of this component. Does anybody know how I would do this?
acolyte
07-20-2006, 03:37 PM
Hi fou99004 ,
i dont know what you exactly trying to archieve :
the Footer is it in the htmlpage or in the Flashmovie ?/ if you attaching the component on runntime the Controllerclip setting the depth in the movie so rearranging the controllerclip to the upperlayer will bring your attached component set on the very top of the movie.
The Controller Clip will act only to register your Components to the Framework and manage the communication between your Components on Stage
I think what you got to do is attaching the cbox to stage on runntime there is plenty of stuff on the www just google about it .
In the Flash reference it is written that it is recommendet that you attach the components on runntime by Adobe because only this will provide you with all the handy features they offer
http://www.actionscripts.org/tutorials/intermediate/Dynamically_Attaching_Components/index.shtml
http://weblogs.macromedia.com/nigel/
http://www.ultrashock.com/ff.htm?http://www.ultrashock.com/tutorials/flashmx2004/v2a-01.php
or can you post a .fla file with your issue
greets Ac
fou99004
07-20-2006, 04:02 PM
I am limited as to what I can actually control. There is an aspx page that loads my swfs, determines the size of my swfs, then loads the footer over my swf. I don't have much control over the aspx page so I basically am forced to modify the way my swf and combobox works. I think, though, that there is another swf underneath everything that is longer than the swf that i am working with and this is why the combobox thinks that my stage is longer. I am not sure though.
acolyte
07-20-2006, 04:10 PM
I am limited as to what I can actually control....
ohh :o that sucks
can you show me a link ?
fou99004
07-20-2006, 04:31 PM
No I can't. It is on the back end of the site and I don't know how much I would be able to show anyway, you know how it is with software companies. Ohh well, if I can't figure this out I will try something else. Thanks for all of your help though.
fou99004
07-20-2006, 10:01 PM
HOLY COW!!! This was fun to try and figure out. There is a nice little article on the basics of this at http://blog.flashgen.com/?page_id=30
Thanks for all the help.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.