Solved

Control Flash stage background colour using External Text File

Posted on 2007-03-24
5
382 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
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.

929 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now