Solved

Control Flash stage background colour using External Text File

Posted on 2007-03-24
5
388 Views
Last Modified: 2008-01-09
Hi,

We are trying to control Flash stage background colour using External Text File.  Click on botton (see below code) the background colour changes, but we want it to load the colour from the text without clicking any botton.  But it wont work if it's changed from onRelease to onLoad.

url = new LoadVars();
url.load("myPhoto.txt");
url.onLoad = function() {
_root.clipname.loadMovie(url.location);

function nuColor(col) {
meColor=new Color(bground);
meColor.setRGB(col);
}

_root.bt1.onRelease=function(){
    nuColor(url.color1);
}
_root.bt2.onRelease=function(){
    nuColor(url.color2);
}
_root.bt3.onRelease=function(){
    nuColor(url.color3);
}

}

Thanks
0
Comment
Question by:t_rice
  • 2
  • 2
5 Comments
 
LVL 23

Expert Comment

by:Zeffer
ID: 18786575
did you try it like this..

this.onLoad=function(){
    nuColor(url.color1);
}

Z
0
 

Author Comment

by:t_rice
ID: 18786671
Hi,

Thanks for the quick response, we've just tried it and it hasn't worked.  As below:

url = new LoadVars();
url.load("colors.txt");
url.onLoad = function() {
_root.clipname.loadMovie(url.location);

function nuColor(col) {
meColor=new Color(bground);
meColor.setRGB(col);
}

this.onLoad=function(){
    nuColor(url.color1);
}

}

Help :)
0
 
LVL 37

Accepted Solution

by:
CyanBlue earned 500 total points
ID: 18787331
How about this???

url = new LoadVars();
url.load("colors.txt");
url.onLoad = function()
{
      _root.clipname.loadMovie(url.location);
      nuColor(url.color1);
}

function nuColor(col)
{
      meColor=new Color(bground);
      meColor.setRGB(col);
}

CyanBlue
0
 

Author Comment

by:t_rice
ID: 18787994
Perfect, thanks for your help.
0
 
LVL 37

Expert Comment

by:CyanBlue
ID: 18788250
You're welcome...  :)

CyanBlue
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Where to download Acrobat flash offline installer? 2 251
how can flash builder 4.X version make use of java 8 5 347
Adobe Flash Player ActionScript error 6 66
Flash Converter 8 127
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

856 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