delphi programming forums mysql charset mget recursive synonimos
free ventrilo servers hosting cs javascript delay python find in list
Back Forum New
abstract:

How can I change the movie's background color with actionscript?


How can I change the movie's background color with actionscript?

TOP

Not directly, but in Flash MX you could use the drawing methods, to draw a colored rectangle to the dimensions of the movie.
PHP Code:
function
changeBG
(
col
) {
_root
.
createEmptyMovieClip
(
"bgClip"
,
0
);
bgClip
.
beginFill
(
col
,
100
);
bgClip
.
lineStyle
(
1
,
col
,
100
);
bgClip
.
moveTo
(
0
,
0
);
bgClip
.
lineTo
(
Stage
.
width
,
0
);
bgClip
.
lineTo
(
Stage
.
width
,
Stage
.
height
);
bgClip
.
lineTo
(
0
,
Stage
.
height
);
bgClip
.
endFill
();
}
changeBG
(
0xCCCCCC
);

TOP

Thanks, that is a good function that got me pretty close.
The problem is the bgClip is overlapping the other frames in z-index.
Can I put the bgClip below the other frames? I checked the reference material on createEmptyMovieClip and it looks like the second parameter should be 0.
I tried putting the bgClip on another layer and putting that layer at the bottom but it didn't work.
I also had to set the dimensions with hard-coded numbers because Stage.width and Stage.height didn't give me the dimensions of the movie.
Code:
  1.     bgClip.lineTo (125, 0);
  2.     bgClip.lineTo (125, 125);
  3.     bgClip.lineTo (0, 125);
Copy Code
Well, you can tell I've only been doing flash for a few days!
Do you recommend any actionscript/flash books? I'm looking for a book that doesn't cover programming basics like loops, conditionals, et c, but rather one that explains how to do simple stuff in flash with simple examples.

TOP

Okay so the other otpion is to make a new movie clip with a 1 x 1 black square in it and call it lets say bgClip. Put an instance of it on the stage at pos 0,0 and give it an instance name of bgClip. Put it in the bottom layer. Then you can adjust the width and height of it and change the color all with actionscript.
See my attached file.

TOP

abstract:

How can I change the movie's background color with actionscript?


This must sound incredibly stupid. I cannot figure out how to name the instance.

TOP

Drag the movie clip to the stage, and open the properties panel. Select the clip on the stage. In the properties panel on the right side below the drop down that says Movie CLip, there is an input box, thats where the instance name goes.

TOP

freddydoesphp -
That worked perfectly, thanks.
I thought that text field was disabled because it had grey text in it. Since I didn't know what it was for, I just ignored it for a disabled text field.
I'm going to use this to:
1) grab a <param>
2) set the bgClip to the value of the param
The param is generated dynamically.



How can I change the movie's background color with actionscript?

TOP

Back Forum