滚动“太快”时Horizo​​ntalList崩溃

时间:2011-04-29 00:17:58

标签: actionscript-3 flex4 horizontal-scrolling

我在Flex(Flash Builder 4)中遇到这个奇怪的问题,在Horizo​​ntalList中,只要我滚动到快速,它会崩溃,任何人都有了想法? 这是我的自定义项目渲染器

package
{
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.text.StyleSheet;
    import flashx.textLayout.container.ScrollPolicy;
    import mx.containers.VBox;
    import mx.controls.Image;
    import mx.controls.Label;
    import mx.core.FlexGlobals;

    public class CustomItemRenderVBox extends VBox
    {
        private var track:Object = null;
        private var img:Image = new Image();
        private var lbl:Label = new Label();
        [Embed(source="gfx/noArt.png")]
        [Bindable]
        private var noArt:Class;


        override public function set data(value:Object):void
        {
            trace(value);
        if(value.c3 != "" )
        try{
            addChild(img);
            addChild(lbl);

            horizontalScrollPolicy = ScrollPolicy.OFF;
            verticalScrollPolicy = ScrollPolicy.OFF;
            setStyle("verticalAlign", "top");
            setStyle("horizontalAlign","left");
            track = value;
            trace("Art: " + value.Art); 

            if(value.Art == "" || value.Art =="-" )
            img.source = noArt; else    
            img.source = value.Art;  // << when I remove this part it works fine
            trace("GAY");   
            img.height = 60;
            img.scaleContent = true;
            img.autoLoad = true;

            lbl.text = value.c3;
            lbl.width = 67;
            lbl.height = 20;
            trace("WAY");
            img.useHandCursor = true;
            img.buttonMode = true;

            lbl.useHandCursor = true;
            lbl.buttonMode = true;
            trace("NAY");
            img.addEventListener(MouseEvent.CLICK,arClick);
            lbl.addEventListener(MouseEvent.CLICK,arClick);


        }catch(E:Error)
        {
        }
        }


        private function arClick(event:MouseEvent):void
        {
            FlexGlobals.topLevelApplication.albumSearch("/album " + track.c3);
        }
    }
}

1 个答案:

答案 0 :(得分:1)

我有同样的问题。在谷歌浏览器中,我们可以看到:“0x00000000”处的指令引用了“0x00000000”处的内存。内存无法“写入”。 解决方案:我试图在我的滚动条实例上设置cachePolicy =“on”。你应该将它设置为列表组件(或滚动皮肤部分)