Skip navigation
Purefeeder
Currently Being Moderated

[URGENT] how to control external data in fla file?

Jul 9, 2012 7:27 PM

How to make text color change according to the data recieved by javaside. In need of some references! Thanks alot

 

i tried out some line but it just didnt work

 

If (ChatClient.varfield[5] == 1)

{

      text.color= 0x000000

}

 

Been trying alot of times, Is there any solution out there?

 
Replies
  • kglad
    62,238 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 10, 2012 8:28 AM   in reply to Purefeeder

    1. make sure you're receiving the javascript data.  the most common problem with using the addCallback() method of the externalinterface class is incorrect embedding code.  either use swfobject to embed or use the embedding code in the help files.

    2. the code you showed appears to have nothing to do with retrieving and using data from javascript.  show something  that appears germane to those of us unfamiliar with your code.

     
    |
    Mark as:
  • kglad
    62,238 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 10, 2012 9:23 PM   in reply to Purefeeder

    is that your code or are you copying code from somewhere?

     
    |
    Mark as:
  • kglad
    62,238 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 10, 2012 10:19 PM   in reply to Purefeeder

    i can't understand why you would post the 1st or 2nd code snippets.  there's nothing (other than a suggestive name, receiveData) about retrieving data from javascript. 

     

    anyway, if you understand your code, you should be able to create additional textformat instances that use the colors you want and apply those to your datagrid (assuming that's the object whose text color you want to change) using setRendererStyle just like you showed in the 2nd snippet.

     

    for example:

     

        if (varfield[1] == "Link")

        {

         dispatchEvent(new Event("onLinkData"));

    myDataGridmotion.setRendererStyle("textFormat",tfor1);

        } else if (varfield[1] == "Status")

        {

    myDataGridmotion.setRendererStyle("textFormat",tfor2);

         dispatchEvent(new Event("onStatusData"));

        } else if (varfield[1] == "Motion")

        {

    myDataGridmotion.setRendererStyle("textFormat",tfor3);

    }

     
    |
    Mark as:
  • kglad
    62,238 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 11, 2012 8:16 AM   in reply to Purefeeder

    i used myDataGridmotion and you were using myDataGridemotion.  so, you should have seen an error about myDataGridmotion being undefined, not myDataGridemotion.

     

    in any case, they should be all one or the other.

     

    next, if you're trying to control the format of individual cells in your datagrid, you will need to use a custom cell renderer:  http://gourry-gabrief.blogspot.com/2009/06/how-to-customize-cell-in-da tagrid-with.html

     
    |
    Mark as:
  • kglad
    62,238 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 12, 2012 12:03 PM   in reply to Purefeeder

    i don't see where you're assigning the cellRenderer property to one of your datagrid's columns.

     

    p.s.  please mark helpful/correct responses, if there are any.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points