A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: How to change the dynamic textbox background color through text file

  1. #1
    Member
    Join Date
    Jul 2002
    Posts
    61

    How to change the dynamic textbox background color through text file

    I would like to change the dynamic text box background color through external text file like displaying the contents from text file by loading in flash movie.

    Is it possible. Pls give idea to solve my problem

    thx
    sathish

  2. #2
    Senior Member
    Join Date
    Nov 2000
    Posts
    275
    Assuming that your text field has the name myText, and that the variables contained within your external text file read something like:

    myTextColour = 0xFF0000 & myTextBGColour = 0xCCCCCC

    You could use something like this:

    Code:
    	myText.textColor = myTextColour;
    	// changes the text color to red
    	
    	myText.background = true;
    	// sets the background visibility to true
    	
    	myText.backgroundColor = myTextBGColour;
    	// changes the background color to grey
    Hope this helps...
    Please follow the Flash Kit Forum Footer Guidelines or FKFFG found here.

  3. #3
    Member
    Join Date
    Jul 2002
    Posts
    61

    Hai John Davey

    Thx for ur reply

    I worked on ur code, still its not working first simply i placed ur code in text file and flash and Text box background color displayed in dark grey color, after changing color in text file also displaying the same color in my movie. I think some problem with loading so i worked in another format. Still Its not working and nothing displaying.

    Can u download this file and see what i've done mistake.

    Pls kindly help me to do this stuff.

    thx
    sathish
    Attached Files Attached Files

  4. #4
    Member
    Join Date
    Jul 2002
    Posts
    61

    hi

    can u download my sample file and pls take a look. I've to finish this task asap, so pls kindly help me

    thx
    sahtish

  5. #5
    Senior Member
    Join Date
    Nov 2000
    Posts
    275
    Before giving you the answer, pls remember, we all have tasks we have to complete asap, which means that taking time out for your task takes time away from our own. Impatience on the forums normally leads to no help at all.

    I am not creating a new file for you, zipping it, uploading it to my FTP space etc, it takes too long. So follow these steps:

    New text file with this in it (no carriage returns at the end of the line):
    Code:
    myTextColour=0xFFFFFF&myTextBGColour=0xFF0000&content=Hello World
    New .fla with this in it:
    Top layer:
    Text Field as you had it named myText

    Second Layer (bottom layer) code:
    Code:
    myData = new LoadVars();
    myData.onLoad = addItems;
    myData.load ("bg.txt");
    function addItems () {
    	myText.textColor = myData.myTextColour;
    	myText.background = true;
    	myText.backgroundColor = myData.myTextBGColour;
    	myText.text = myData.content;
    }

    Hope this helps...
    Please follow the Flash Kit Forum Footer Guidelines or FKFFG found here.

  6. #6
    Member
    Join Date
    Jul 2002
    Posts
    61

    hai John

    thx alot its working fine.

    thx again
    sathish

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center