English 中文(简体)
将数据网的头目与AS3.0转换。 Marquee数据网电池的变化内容
原标题:Change the headers on a datagrid in flash with AS3.0. Change content in Datagrid cells for a Marquee

Hello有同学教授,

我一直在努力定制数据网组成部分。 到目前为止,我已经能够利用定制的手机对囚室进行定制。 我也想改变主人的态度,利用一名习俗负责人,但从我试图做不到工作的所有人来看。

这是我的现任校长。

package { 
    import fl.controls.dataGridClasses.HeaderRenderer; 
    import flash.text.TextFormat; 
    import flash.filters.BevelFilter; 
    import flash.text.TextField;
    import flash.display.Sprite;

    public class PlayListHeaderRenderer extends HeaderRenderer { 
        public function PlayListHeaderRenderer() { 
            var format:TextFormat = new TextFormat("Arial", 12);
            format.color = 0xffff00;
            format.bold = true;
            var upSkinBg:Sprite = new Sprite();
            upSkinBg.graphics.lineStyle(0.1,0x999999);
            upSkinBg.graphics.beginFill(0x666666);
            upSkinBg.graphics.drawRect(0,0,10,10);
            upSkinBg.graphics.endFill();
            var downSkinBg:Sprite = new Sprite();
            downSkinBg.graphics.lineStyle(0.1,0x999999);
            downSkinBg.graphics.beginFill(0x0000cc);
            downSkinBg.graphics.drawRect(0,0,10,10);
            downSkinBg.graphics.endFill();
            var overSkinBg:Sprite = new Sprite();
            overSkinBg.graphics.lineStyle(0.1,0x999999);
            overSkinBg.graphics.beginFill(0x0000ff);
            overSkinBg.graphics.drawRect(0,0,10,10);
            overSkinBg.graphics.endFill();
            var selectedUpSkinBg:Sprite = new Sprite();
            selectedUpSkinBg.graphics.lineStyle(0.1,0x999999);
            selectedUpSkinBg.graphics.beginFill(0x0000cc);
            selectedUpSkinBg.graphics.drawRect(0,0,10,10);
            selectedUpSkinBg.graphics.endFill();
            var selectedDownSkinBg:Sprite = new Sprite();
            selectedDownSkinBg.graphics.lineStyle(0.1,0x999999);
            selectedDownSkinBg.graphics.beginFill(0x0000cc);
            selectedDownSkinBg.graphics.drawRect(0,0,10,10);
            selectedDownSkinBg.graphics.endFill();
            var selectedOverSkinBg:Sprite = new Sprite();
            selectedOverSkinBg.graphics.lineStyle(0.1,0x999999);
            selectedOverSkinBg.graphics.beginFill(0x0000ff);
            selectedOverSkinBg.graphics.drawRect(0,0,10,10);
            selectedOverSkinBg.graphics.endFill();
            setStyle("textFormat", format);
            setStyle("upSkin", upSkinBg);
            setStyle("downSkin", downSkinBg);
            setStyle("overSkin", overSkinBg);
            setStyle("selectedUpSkin", selectedUpSkinBg);
            setStyle("selectedDownSkin", selectedDownSkinBg);
            setStyle("selectedOverSkin", selectedOverSkinBg);
        } 
    }
}

在我的实际方案中 我这样说:

dgPL.setStyle("headerRenderer", PlayListHeaderRenderer);

尝试和确定我为数据网名称dgPL创建的头盔。 但它没有工作。 从我在互联网上发现的情况来看,头脑放大人同细胞放大人一样在设计和执行方面采取行动。 我找不到使用习惯头盔人员班的人的任何例子,也找不到如何做到这一点的例子。 因此,请让我知道,在设计我的班级或将这一班子纳入我的方案方面,我有错之处,会得到任何帮助。

此外,我还试图说明如何在同一个数据网的囚室添加一个Marquee,这样,如果囚室内的内容太长,那么,当用户对数据gids内容清单进行滚动时,该囚室将在整个囚室中排。 我所担心的那部分是,如何获得分配给该囚室的新护法,而不永久地压倒数据网中该特定行的数据提供人的内容。

从我对互联网的看法来看,我找到了一种办法,为文字现场创造跳板。 我可以列举的是,如何将其应用于数据网本身。

The Code for the marquee is as follows:

var tf:TextField = new TextField();
tf.defaultTextFormat = dtf;
tf.text = dgPL.getItemAt(evt.rowIndex.toString()).Artist + "                    ";
tf.x = tf.y = 300;
addChild(tf);
var t:Timer = new Timer(200);
t.addEventListener(
    TimerEvent.TIMER,
    function(ev:TimerEvent): void
    {
        tf.text = tf.text.substr(1) + tf.text.charAt(0);
    }
);
t.start();

Right now the marquee works by creating a textField and doing the marquee that way but that isn t the most effective way of doing it at all due to allignment issues when scrolling the content in the datagrid.

我知道Marquee是如何运作的,我只看不出如何将这一 mar子应用于数据网格。 我知道,如何把我的囚室的内容看上去,没有任何问题,如何重新定义,让骑士去工作,我不敢肯定,如何在不永久地压倒数据提供人的情况下将其重新分配给牢房。

对这两个专题的任何帮助都将受到高度赞赏。

Sincerely, Tim

问题回答

对您的第一个问题。 你们需要使用不作为理由的等级来打造苯。 因此,你需要根据《标准》开设4个班级,并在《标准》内通过。

关于你的文本问题,我提议这样小类:

    package  {
    import fl.controls.listClasses.CellRenderer;
    import flash.events.MouseEvent;
    import flash.events.Event;

    public class ScrolledDataGridCell extends CellRenderer{

        private var mOver:Boolean=false;
        private var active:Boolean=false;
        public function ScrolledDataGridCell() {
            addEventListener(MouseEvent.ROLL_OVER,over);
            addEventListener(MouseEvent.ROLL_OUT,out);

        }
        private function over(e:Event):void{
            mOver=true;
            if(!active&&textField.maxScrollH>0){
                active=true;
                addEventListener(Event.ENTER_FRAME,frame);
            }
        }
        private function out(e:Event):void{
            mOver=false
        }

        private function frame(e:Event):void{
            if(mOver){
                textField.scrollH++;
            }else{ 
                if(textField.scrollH>0){
                    textField.scrollH--;
                }else{
                    if(active){
                        active=false;
                        removeEventListener(Event.ENTER_FRAME,frame);
                    }
                }
            }
        }
    }
}




相关问题
WPF: Adding Button Column to Datagrid

How can I add a Button column to a Datagrid programmatically? I want to do this through code in the code-behind file. Also i want to selectively enable or disable this button based on record (If ...

Silverlight Datagrid RowEditEnded

I have a SL DataGrid that has two columns. I need to be able to catch any change to the a row and save it into an undo stack. I setup the event RowEditEnded and tried to add to the undo stack there. ...

WPF Keep column sorting with Datagrid

I have several datagrid where I need to update the informations. Things is, since more than one person works on the system at the same time, the datagrid need to be refreshed on a regular basis. When ...

热门标签