如何在不同状态和不同容器中滚动画布上的元素而不移动其他元素

发布于 2024-10-05 15:26:41 字数 2797 浏览 3 评论 0原文

我动态生成面板并以这种方式将它们置于其他状态,因此在一种状态下,左侧有一个面板列表,右侧有一个大面板,例如在一种状态下,当您单击左侧的列表时(使用小面板),面板取代大面板的位置,而大面板又回到原来的位置。因此,我左侧有 50 个面板,我想将它们向下滚动,但我不想让大面板与它们一起向下滚动,我希望将其修复。替代文字 这就是我得到的地方,我不知道该怎么做 这是我的代码:

enter code here

protected function canvas1_creationCompleteHandler(event:FlexEvent):void {

            blurEffect= new BlurEffect(myBlur,myUnBlur);

            listEventsResult.token=eventService.listEvent();
            blurEffect.initFilter(event);


            panels=generatePanels(panelNumber);
            var vBox:VGroup= new VGroup();


            states=statesList.toArray();

            trace("stavi sequence i sostojba e"+ states[0].toString());

            for(var i:int=0; i<panelNumber ;i++)        // get panel from list panels and set states
            {
                 addChild(panels.getItemAt(i) as Panel);    
                (states[i] as State).overrides=[ new SetProperty(panels.getItemAt(i),"x",110), new SetProperty(panels.getItemAt(i),"y",0),
                    new SetProperty(panels.getItemAt(i),"width",widthBigPanel), new SetProperty(panels.getItemAt(i),"height",heightBigPanel)
                    //,new AddChild(g2,(panels.getItemAt(k) as Panel))
                    //,new SetProperty(panels.getItemAt(i),"scaleZ",110)
                ];
                trace("vlegov override za new state");
                var yy:int=0;


                for(var k:int=0;k<panelNumber;k++)
                {
                    trace("menuvam state: yy = " + yy);
                    if(k!=i){
                        vBox.addChild(panels.getItemAt(k) as Panel);
                        (states[i] as State).overrides = (states[i] as State).overrides.concat([ new SetProperty(panels.getItemAt(k),"x",x), new SetProperty(panels.getItemAt(k),"y",yy),
                            new SetProperty(panels.getItemAt(k),"width",widthPanel), new SetProperty(panels.getItemAt(k),"height",heightPanel)
                        //,new AddChild(g1,(panels.getItemAt(k) as Panel))
                        ]);
                        yy+=110;
                    }
                }

                for(z=0; z<(states[i] as State).overrides.length; ++z){
                    var tempSetProperty:SetProperty= (states[i] as State).overrides[z] as SetProperty;
                    trace("\nname: " + tempSetProperty.name);
                    trace("target: " + tempSetProperty.target);
                    trace("value: " + tempSetProperty._value);
                }


                setCurrentState("state0");
                addChild(vBox);
            }

            //sequence.targets=panels.toArray();
            t1.targets=panels.toArray();

        }

I generate panels dynamically and put them in other states in that way so in one state you have a list of panels on the left and one big panel on the right for example in one state and when you click on the list on the left (with small panels) that panels takes the places of the big panel and the big one goes back in the place. So I have 50 panels on the left and i want to scroll them down but I don't want to big panel to go down with them I want it fixed.alt text
this is where I got and I don't know how to do that
here is my code:

enter code here

protected function canvas1_creationCompleteHandler(event:FlexEvent):void
{

            blurEffect= new BlurEffect(myBlur,myUnBlur);

            listEventsResult.token=eventService.listEvent();
            blurEffect.initFilter(event);


            panels=generatePanels(panelNumber);
            var vBox:VGroup= new VGroup();


            states=statesList.toArray();

            trace("stavi sequence i sostojba e"+ states[0].toString());

            for(var i:int=0; i<panelNumber ;i++)        // get panel from list panels and set states
            {
                 addChild(panels.getItemAt(i) as Panel);    
                (states[i] as State).overrides=[ new SetProperty(panels.getItemAt(i),"x",110), new SetProperty(panels.getItemAt(i),"y",0),
                    new SetProperty(panels.getItemAt(i),"width",widthBigPanel), new SetProperty(panels.getItemAt(i),"height",heightBigPanel)
                    //,new AddChild(g2,(panels.getItemAt(k) as Panel))
                    //,new SetProperty(panels.getItemAt(i),"scaleZ",110)
                ];
                trace("vlegov override za new state");
                var yy:int=0;


                for(var k:int=0;k<panelNumber;k++)
                {
                    trace("menuvam state: yy = " + yy);
                    if(k!=i){
                        vBox.addChild(panels.getItemAt(k) as Panel);
                        (states[i] as State).overrides = (states[i] as State).overrides.concat([ new SetProperty(panels.getItemAt(k),"x",x), new SetProperty(panels.getItemAt(k),"y",yy),
                            new SetProperty(panels.getItemAt(k),"width",widthPanel), new SetProperty(panels.getItemAt(k),"height",heightPanel)
                        //,new AddChild(g1,(panels.getItemAt(k) as Panel))
                        ]);
                        yy+=110;
                    }
                }

                for(z=0; z<(states[i] as State).overrides.length; ++z){
                    var tempSetProperty:SetProperty= (states[i] as State).overrides[z] as SetProperty;
                    trace("\nname: " + tempSetProperty.name);
                    trace("target: " + tempSetProperty.target);
                    trace("value: " + tempSetProperty._value);
                }


                setCurrentState("state0");
                addChild(vBox);
            }

            //sequence.targets=panels.toArray();
            t1.targets=panels.toArray();

        }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

自演自醉 2024-10-12 15:26:42

您可以进行常规滚动,但添加一个垂直滚动条侦听器,scroll="myScroll(event),它会在发生滚动时重新定位大面板(使用面板的原始 x,y 值和verticalScrollPosition 属性之类的内容)。

或者,您可以在第一个画布上添加第二个画布,并将其背景设置为透明。将大面板放在透明画布上,这样它就不会滚动(如果适合的话,当滚动完成时将其放回原始画布)。 。

这两者都需要大量的处理(尤其是透明画布)

You could do your regular scrolling, but add a vertical scroll bar listener, scroll="myScroll(event), that repositions the large panel as scrolling occurs (using something like the original x,y values of the panel and the verticalScrollPosition property).

Alternatively, you could add a second canvas on top of the first one, and sets its background to transparent. Place the large panel on the transparent canvas so it doesnt scroll (and put it back to the original canvas when scrolling completes if that suits).

Both of these are heavy(ish) on processing (especially the transparent canvas).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文