Changing the bg colour of a flash site with actionscript

hi, is there anyway to change the background colour of a flash site with actionscript. like when you press a button?

so, in this case http://www.cartoonfox.hostrocket.com/cartoonfox-v4.html when you press a button, the WHOLE of the red changes to what ever colour?

thanks.

You can change the colour of a movieclip by using the Color object.


yourColor = new Color(yourmc);
yourColor.setRGB(0x000000);
//where 000000 is your hex colour value
// you can also use setTransform for more control:
yourColor.setTransform({ra:100,ga:100,ba:100,aa:100})
// ra is the amount of red on a scale of 100, ba is the same for blue, ga the same for green and aa the same for alpha

More info: http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary142.html

hmmm, is there no other way than to use a movieclip? other wise i’ll have to make the movieclip the perfect size to prevent scrolling, but different browsers have slightly different sizes (due to browser tool bars etc)

thanks :slight_smile:

And you can also change the background color of the HTML document through Java****Script:

var hex = 0xFFFFFF;
getURL("java****script:void(document.bgColor="+hex+")");

hey cool, thanks :slight_smile:

except it doesnt change the colour right :confused:

i put FF33CC which is a pink, but it came out darkish green!!

thanks

It’s working fine here … don’t forget to use 0xFF33CC as hex value.

yeah i had 0xFF33CC, and it comes up as a darkish green, strange :confused:

That’s weird - have you got it online somewhere so we can check it out ?

don’t forget, there are only 216 safe web colors.

all the others may not look the same on Windows as they do on other Operating Systems…

Rev

FF33CC is a web safe colour. and i’m using a mac, IE.

i’ll put it online and see what happens.

here we go. press the pink text button.
http://www.cartoonfox.hostrocket.com/cartoonfox-v4.html

now i need to figure out how to change the swf bg colour… and help?

thanks :slight_smile:

you’ll have to use a mc, then change that…

unless you want to use transparent bg in Flash via HTML… only works in Macs w/player 7 installed, Windows Netscape/Mozilla w/player 7, and of course, all windows IE since IE4…

Then the javaScript will change the bg for all, since the Flash bg is transparent…

just had this issue with a site, and the client is on Mac OS9 AOL…

Rev

hmmm, i have flash player 7, but i can only publish in 6. i tried changing the publish settings for html to transparent window, but nothing changed when i tested it.

maybe i should not bother.

thanks :slight_smile:

either use an HTML editor (dreamweaver, etc) or ask someone to write it for you…

I think the saturation #'s are pretty hi on the player 7…

Rev