[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3996
  • Last Modified:

Flash Datagrid Cell Highlight issue

Hey everyone,

I apologize for my overly desperate title but I was left with no choice. I've posted this issue a bunch of time now with no luck. I am somewhat pressed for time now so I can really use the help. Anyway, enough complaining from me; here is my issue:

Does anyone know how I can modify the datagrid component in Flash CS3 so that individual cells highlight on rollover instead of the default where the entire row highlights (I am using Actionscript 2.0 - and I've come to notice that there is a difference between the datagrid component with AS2 and AS3).

To help clarify, I have attached an image to demonstrate what I am trying to accomplish. I have searched on forums and have played around with different classes but have had no luck.

If someone can please help me out, I would greatly appreciate it. Please let me know if you need any more info from me. Thanks.
cell-highlight.jpg
0
Adam
Asked:
Adam
  • 9
  • 5
  • 4
  • +1
2 Solutions
 
Andrew BeersCommented:
instead of using the default mouse over use a cell based mouse over for the element.  You can do this by binding an event to individual cell components on item databind.

Don't have time to post code but should be easy enought to google.

~Aqua
0
 
AdamAuthor Commented:
Thanks for the reply Aqua.

I've searched "mouse over" and "cell" (as well as a bunch of other terms) within the Flash help document as well as in Google but haven't found a solution to my problem.

I know that the cell highlight on mouse over can be done with Actionscript 3.0, but have yet to find a class or anything that would help me with Actionscript 2.0.

If you do have time to elaborate on your post, I would really appreciate it.
0
 
Andrew BeersCommented:
Ok...

http://livedocs.adobe.com/flex/1/asdocs/

Easiest way is to assign a custom item renderer for the cell component, from there you can attach your even to the cell itself depending on the type of cell... so on and so forth.

Your event would be attached to your list item and then checked in the rendered.

~Aqua
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
AdamAuthor Commented:
Thanks again aqua9880. However, the link you provided was for Flex. I know a little about Flex but I didn't think it was possible to use Flex code/syntax in Flash. Am I wrong?
0
 
Andrew BeersCommented:
http://www.actionscript.org/resources/articles/501/1/Flex-2-and-Flash-9-Together/Page1.html

They can be set-up to play nicely.  Takes a bit of leg-work but of the 2 code lines Flex is the more powerful and flexible.

What Datagrid object are you using?  I'm not aware of any out of the box Flash datagrid component other than the Flex / MX object which the documentation I provided will address.

~Aqua
0
 
AdamAuthor Commented:
I am using the built-in Flash datagrid component (with AS2) so it's not out-of-the-box.

I appreciate your help Aqua, although I'm not sure if I'm advanced enough with my programming to get both Flash and Flex to work in sync with the Flash datagrid component. I will take a look around and play around with it a bit. Hopefully I can get something out of it. If not though, if you or anyone else has any other suggestions, I'm still open to anything. Thanks again.
0
 
Andrew BeersCommented:
Wow... You're making me dig wayyyyyyy back:

http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=00002232.html#3141024

and

http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=00002262.html#3141891

You can set a custom cell renderer on the datagrid as a whole.  You'll need to ignore the table row highlighting and do this yourself through the cell reder function.  Those two links should be able to help out a bit.

Sorry for the massive confusion on my part.  Not too many people are using MX2k4 anymore.  I would reccomend learning Flex when you get some downtime.   It has a lot more info online and a lot more power.

For future help try to dig around on Adobe's live docs a bit more.  They keep a fairly extensive API reference.

~Aqua
0
 
Andrew BeersCommented:
reder == render

Type... don't want to confuse you there.
0
 
AdamAuthor Commented:
Thanks Aqua. But to clarify, I am actually using Flash CS3, not MX2004 (not sure what I may have said that would imply MX2004). I am however using Actionscript 2.0 and not Actionscript 3.0.

I have looked into the Cell Render class through the Flash livedocs but haven't been able to find anything that would allow me to customize the datagrid and allow for individual cell highlighting (but it could just be that I'm not looking in the right places). I think this link is essentially the same as the one you provided but for CS3:

http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00002724.html

"You can set a custom cell renderer on the datagrid as a whole.  You'll need to ignore the table row highlighting and do this yourself through the cell reder function."

I really appreciate you continuously replying and trying to help me out and I hope you are still willing to help me out. I hope it's not too much to ask but can you possibly elaborate a bit more on how I can accomplish what you stated above?

As I mentioned, I have a well-rounded understand of Actionscript by my abilities can only take me so far. I have posted this issue a number of times over the past month or so and most people point me to the Flash livedocs which unfortunately hasn't helped me solve my problem yet. I don't want to imply to anyone that I am hoping they figure it out for me, I guess I am just hoping for a little more clarification on how I can accomplish my task.

Once again, thanks Aqua. I really do appreciate the help but any more clarification or guidance would be greatly appreciated. I am trying to meet a deadline for a project and unfortunately, no one I know is overly familiar with Flash. Woe is me :(


0
 
blue-genieCommented:
my goodness you're special :-)
i got a mail requesting specific help for you but i'm afraid its not great news.
my goodness - i've never worked with the cell renderer before but i've been trying this and that and i've written my class and the only thing that will change is the specific cell's text color and not its background.

i know its urgent but at this point in time i couldnt' find a solutions. I was reading some Adobe docs and it seems doable but not advisable - the comment said expensive - not sure what that means - maybe memory or CPU usage.

i found a site that was selling datagrid extensions - not sure if it works, the guy claims it does - it was $5.
if all else fails and you're desperate .

http://www.tufat.com/script.php?id_num=5
0
 
AdamAuthor Commented:
Thanks for the reply blue-genie.

At this point, even if it's just the text-color changing, that should be good enough for now. Can you please direct me on how you managed to accomplish that?

BTW, one thing that I found in an old forum with a posting similar to mine was someone managed to use row and column highlighting. When the two colors from each highlight were on the same cell, that cell combined those colours - which in turn gives that cell its own background colour. Not the greatest solution but it is another possibility. The only thing is, I didn't know it was possible to have a column highlight in addition to a row highlight.

Anyway, if this sparks any ideas, I'm curious to hear your take on it. Otherwise, the text color change would be fine.

Thanks again.

0
 
AdamAuthor Commented:
Due to my desperation, I decided to buy the TuFat datagrid extension. It does allow you a number of options to customize the datagrid component however after playing around with it and searching on a number of forums, it doesn't appear to have the ability to highlight individual cells on roll over. You can give particular cells different background colours, but I'm not sure if you can use that along with any sort of rollOver function.

I could be wrong but that seems to be the case. Anyway, I would still be interested in the font color change you had mentioned Aqua. When you have a spare moment, any details would help.

Thanks.
0
 
MHenryCommented:
furio13,

Not trying to butt in for points or anything. The others have done all the work so give them the points, but it looks to me like the extension you bought does exactly what you want.
This is Demo #2: http://demo.tufat.com/datagrid/flash7/index.html

Look what it's doing in the header. That's what you're after, right? If so, contact them for support. I think you already have your answer.

Best,
MH
0
 
AdamAuthor Commented:
No worries MHenry, you aren't butting it. Thanks for the reply.

The highlighting that is going on in the header from that example is something that the Flash datagrid does by default (even without the extension). It will highlight each individual header but it won't do the same thing for individual cells within the table. You can check out an example here that doesn't use the extension but does the same thing:

http://www.kirupa.com/developer/flash8/datagrid.htm

I have continued to play with the extension and have looked on quite a few forums for a potential solution. A number of people have asked for the same thing but no one seems to have followed up with a response.

Once again, if anyone has any suggestions, I am still open to anything.
0
 
blue-genieCommented:
yeah based on the website for that extension it does hightlight - i think that one is on select though and not on rollover but you should be able to modify it.
okay see the code snippet below. this is for changing the textcolor.
only thing it only kicks in as you change the rows.
i'm sure you'll see what i mean.
i modified it from a flex solution i found online.

where grid is the name of your datagrid.
this.grid.onRowRollOver = function(rowIndex:Number){
	this.selectRow(rowIndex,true,true);
 
	if (!this.enabled) return;
	var len : Number = this.columns.length;
 
	var row = this.rows[rowIndex];
 
	for (var i=0; i<len ; i++) {
		var col : mx.controls.gridclasses.DataGridColumn = this.columns[i];
		var delta : Number = row._xmouse - row.cells[i]._x;
 		if (delta>=0 && delta<col .__width) {
			row.cells[i].setColor("0x99CC99");
			return;
		}
	}
}

Open in new window

0
 
blue-genieCommented:
and did you try it?
0
 
AdamAuthor Commented:
Sorry for the late reply blue-genie. I have been trying to get it to work with what I have but seem to be having some difficulty. For some reason my cell-highlighting seems to stop working all together.

I will continue to play around with it today and hopefully get it to work. Sorry to bug you again but by any chance, do you have a working sample of this? Or, do you have the sample that got from Flex that I can have a look at? I just want to compare the code when it interacts with populating the datagrid just as a reference.

Thanks again for your help. It is much appreciated. If I can't get it to work in the next day or so, I will award you the points anyway.
0
 
blue-genieCommented:
didn't i upload it - hmm i'm losing my mind -  remember this is the change text color only.
its cs3 file
tes2.fla.txt
0
 
AdamAuthor Commented:
Thanks blue-genie.

I tested it out and I got it to work. I see what you mean about it only working when you change rows. Oh well.

Coincidentally enough, someone replied to another posting a gave a similar solution. This one seems to have the text change color even on the same row. However, it seems a bit glitchy when you are highlighting the top row. I am probably going to create another post to have that fixed.

Anyway, I've attached the file if anyone is interested. Thanks again.

P.S. Just so it doesn't seem like I'm taking credit, the sample file was created by 'Vulturous'

Dg.fla.txt
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 9
  • 5
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now