Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 有人能告诉我如何在actionscript3中将滚动条添加到sprite中吗?_Actionscript 3 - Fatal编程技术网

Actionscript 3 有人能告诉我如何在actionscript3中将滚动条添加到sprite中吗?

Actionscript 3 有人能告诉我如何在actionscript3中将滚动条添加到sprite中吗?,actionscript-3,Actionscript 3,我正在使用flash player,我想在播放机上添加精灵列表(大约:10),但我没有太多的空间来这样做,所以为了解决这个问题,我只想在其中添加滚动条。有人能告诉我如何将滚动条添加到精灵吗?查看滚动条组件: 您需要将精灵放入一个组中,该组实现Scroller所需的IViewport接口 下面是我从一个旧测试项目中提取的一个快速示例: <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns

我正在使用flash player,我想在播放机上添加精灵列表(大约:10),但我没有太多的空间来这样做,所以为了解决这个问题,我只想在其中添加滚动条。有人能告诉我如何将滚动条添加到精灵吗?

查看滚动条组件:

您需要将精灵放入一个组中,该组实现Scroller所需的IViewport接口

下面是我从一个旧测试项目中提取的一个快速示例:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
           xmlns:s="library://ns.adobe.com/flex/spark" 
           xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
           applicationComplete="run()">
    <fx:Script>
        <![CDATA[
            function run():void
            {
                var s1:Sprite = new Sprite();
                var s2:Sprite = new Sprite();

                s1.x = 100;
                s1.y = 100;
                s1.graphics.beginFill(0x00cc55);
                s1.graphics.drawRect(0, 0, 100, 100);
                s1.graphics.endFill();

                s2.x = 300;
                s2.y = 300;
                s2.graphics.beginFill(0x4400dd);
                s2.graphics.drawRect(0, 0, 20, 20);
                s2.graphics.endFill();

                display.addChild(s1);
                display.addChild(s2);
            }
        ]]>
    </fx:Script>

    <s:Scroller id="theScroller" width="200" height="200">
        <s:Group id="theGroup">
            <s:SpriteVisualElement id="display" width="500" height="500"/>
        </s:Group>
    </s:Scroller>
</s:Application>

在我使用此自定义滚动条之前。它是您项目的良好选项。
您可以在

中找到源文件,该问题没有标记为Flex,因此不确定这是否有用。我打赌他没有使用Flex。。。这是一个初学者的问题。