Flash Datagrid last time!!! :)

Posted on 2009-02-23
Last Modified: 2013-11-12
Hello all,

So, I've already posted this issue 4 times now so but due to my stubbornness, I'm trying one last time :)

I am using the default datagrid component in Flash CS3 (using Actionscript 2.0) and am in someway trying to modify the component so that when a user rolls over a particular cell, the individual cell highlights rather then the whole row (which is the default).

Now, as I've mentioned, I have posted this question a number of times over the past month. Just to clarify a few things based on previous posts:

- I have looked over the Livedocs for the datagrid component and have played around with classes and styling but have yet to find a solution
- I have purchased the TuFat datagrid extension which definitely has a lot of customizing ability but I still can't seem to get what I need
- I am using the datagrid component with Actionscript 2.0 - not 3.0. The component is different between the two and some of the customizing options are not available to both.
- I have looked in countless forums regarding this issue. A lot of people have tried to accomplish what I am asking but I have yet to have found someone who has posted a solution

So, with all that said, if anyone has any idea on how I can pull this off, you will be a king (or queen) amongst men (or women). One small note, the main purpose of the what I am trying to accomplish is to distinguish one cell from the next when a user interacts with the datagrid. So, if anyone has an alternative on how to accomplish this (i.e. maybe just have the font color change of the rolled-over cell) I am open to ANYTHING!!!

Thanks in advance! Cheers!

P.S. I've attached an image which I hope will clarify what I've trying to achieve.
Question by:Adam
    LVL 18

    Accepted Solution

    Well, I haven't used AS2 in a while so instead of messing with some of the built in classes, I did some workaround to get that effect... hope it's something similar to what you need:

    You can download the source *.fla from here:

    And here's the code:


    dg.addItem({Value1:"Test 1",Value2:1,Value3:"abc"});
    dg.addItem({Value1:"Test 2",Value2:2,Value3:"def"});
    dg.addItem({Value1:"Test 3",Value2:3,Value3:"ghi"});
    var colorizedItems:Array = new Array();
    var currentSelectedIndex:Number = -1;
    var dgListener:Object = new Object();
    var mouseListener:Object = new Object();
    dgListener.itemRollOver = function(event:Object) {
    	var currentIndex:Number = event.index;
    	currentSelectedIndex = currentIndex;
    dg.addEventListener("itemRollOver", dgListener);
    mouseListener.onMouseMove = function() {
    	var dgInstance = dg;
    	var currentIndex:Number = currentSelectedIndex;
    	var currentCell;
    	if(currentIndex!=-1) {
    		currentCell = getCell(dgInstance.rows[currentIndex],dgInstance.headerCells.length,dgInstance);
    function getCell(currRow:Object,len:Number,dgInst):Object {
    	var tempItem:MovieClip;
    	var retItem:MovieClip;
    	var currWidth:Number = 0;
    	for(i=0;i<=len-1;i++) {
    		tempItem = dgInst.content_mc.header_mc["fHeaderCell"+i];
    		currWidth += tempItem._width;
    		if(dgInst._xmouse < currWidth) {
    			retItem = currRow["fCell"+i];
    	return retItem;
    function decolorize():Void {
    	var filter:Array = new Array();
    	for(i=0;i<=colorizedItems.length-1;i++) {
    		colorizedItems[i].filters = filter;
    	colorizedItems = new Array();
    function colorize(obj:Object,col:Number):Void {
    	import flash.filters.DropShadowFilter;
    	var dsFilter:DropShadowFilter = new DropShadowFilter(0,0,col,100,10,10,7,7,true,false,false);
    	var filter:Array = new Array();
    	obj.filters = filter;

    Open in new window

    LVL 1

    Author Comment

    Thanks so much Volturous! The sample you sent seems to work just as I need it to. I will try to implement what you've done with my code. I think I will need to play around with it a bit but I'm pretty sure I've got what I need.

    Thanks again.
    LVL 1

    Author Closing Comment

    Thanks for your help.
    LVL 18

    Expert Comment

    by:Antonio Estrada
    Glad to help.


    Expert Comment

    I m also facing the same issue difference is that i m using Asctionscript 3.0 datagrid component, flash cs3. problem is as it is  user press the mouse button a particular cell, the individual cell highlights rather then the whole row (which is the default).

    any body help me out??

    thanks in advance

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Suggested Solutions

    Title # Comments Views Activity
    Timer 6 71
    Google Autocomplete API 2 66
    2012 Domain With 350 Machines All Running Windows 7 7 97
    Google Maps 7 59
    While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
    When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure ( It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
    The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
    The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now