[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Flash Datagrid Cell-Highlight....one last time!!! :)

Posted on 2009-02-23
5
Medium Priority
?
668 Views
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.
cell-highlight.jpg
0
Comment
Question by:Adam
  • 2
  • 2
5 Comments
 
LVL 18

Accepted Solution

by:
Antonio Estrada earned 1500 total points
ID: 23717994
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: http://vulturous.110mb.com/eefiles/Dg.fla

And here's the code:

<code>

-V
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);
		colorize(currentCell,0xFF0000);
	}
}
 
Mouse.addListener(mouseListener);
 
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];
			break;
		}
	}
	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();
	decolorize();
	filter.push(dsFilter);
	obj.filters = filter;
	colorizedItems.push(obj);
}

Open in new window

0
 
LVL 1

Author Comment

by:Adam
ID: 23734069
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.
0
 
LVL 1

Author Closing Comment

by:Adam
ID: 31551072
Thanks for your help.
0
 
LVL 18

Expert Comment

by:Antonio Estrada
ID: 23752110
Glad to help.

-V
0
 

Expert Comment

by:shardul_bartwal
ID: 33054980
Hi,
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
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
Suggested Courses
Course of the Month19 days, 13 hours left to enroll

872 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