Copy link to clipboard
Copied
I got many objects on stage (containers, components, etc) and one of them creates scrollbar, but I don't know which one. I've set horizontalScrollPolicy="off" verticalScrollPolicy="off" on most of them but the scrollbar still appears.
It will take me long time to check each component separetly, because they are all connected and removing one of them will force me to change a lot of code.
Is there any simple way to check out which object is parent or owner of this scrollbar?
Copy link to clipboard
Copied
you could use the trace function:
trace(your_scrollbar.parent.name);
or
trace(your_scrollbar.scrollTarget.name)
or what ever else you mean by 'owner'.
Copy link to clipboard
Copied
By owner I mean object which created this scrollbar.
But I don't know where to find this scrollbar, I see it on stage, but don't know which object created it.
So I can't trace it - in your answer I need scrollbar's instance name? But it's not my scrollbar, it's build-in scrollbar of some object.
Copy link to clipboard
Copied
if you mean you can't find it in the fla, then you can't be helped via a forum (unless someone else checks the fla and finds it).
Copy link to clipboard
Copied
It's in flex (but flex forum is closed I think) so don't have .fla.
I give up, I made recursive search for all children of my app and it didn't find any object with scrollbar, but I still see this bar when app is running
public function check(comp:*):void {
var num:int = comp.numChildren;
for(var i:int = 0; i < num; i++) {
var child:* = comp.getChildAt(i);
trace("child: " + child + " at i: " + i);
if (child.hasOwnProperty('verticalScrollBar')) {
trace ('child has vertical bar');
if (child.verticalScrollBar && child.verticalScrollBar.visible == true) {
trace ('found scroll bar');
}
if(child.numChildren > 0)
{
check(child);
}
}
}
Copy link to clipboard
Copied
Since recursive search of objects with scrollbar didn't give any results (don't know why) I had to deconstruct my app and I found reason why scorllbar appears. My screen is 900px height and flex shows stage.height as 904px. It was not a problem for components using height="100%", but it started to be a problem when using scaling. One of my components is 768px height I scaled my component with
scaleY = stage.height/768;
So in the end my component had scrollbars coz it was bigger than the screen. Now I'm using
scaleY = parentApplication.height/768;
and it seems to work alright.
Still don't know why stage.height is 904px when it should be 900px.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now