Link to home
Start Free TrialLog in
Avatar of Adam
AdamFlag for Canada

asked on

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
Avatar of Andrew Beers
Andrew Beers
Flag of United States of America image

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
Avatar of Adam

ASKER

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.
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
Avatar of Adam

ASKER

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?
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
Avatar of Adam

ASKER

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.
SOLUTION
Avatar of Andrew Beers
Andrew Beers
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
reder == render

Type... don't want to confuse you there.
Avatar of Adam

ASKER

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 :(


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
Avatar of Adam

ASKER

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.

Avatar of Adam

ASKER

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.
Avatar of MHenry
MHenry

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
Avatar of Adam

ASKER

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.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
and did you try it?
Avatar of Adam

ASKER

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.
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
Avatar of Adam

ASKER

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