Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Dynamic Color Change That Doesn't Work In Some Browsers



I just finished a mini-site:
http://www.priscillabistoen.be/commercial/

Under the image you have a submenu with numbers. The number of the active image changes to red. This is done by the following function:

function setSubButtonOn(nr) {
color = new Color(eval("_root.submenu.button"+nr));
color.setRGB(0xcc0000);
}

This works fine in IE, but the numbers don't change in Opera, Netscape or on Mac.

Any ideas?



FlashKit > Flash Help > Flash ActionScript
Posted on: 09-07-2004, 11:30 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Old Color Change Code Doesn't Work In 7, 8
in older versions of flash, to change colors i used:


Code:
onClipEvent (load) {
colorObj = new Color(_root.player);
}
onClipEvent (enterFrame) {
colorOBJ.setTransform({ra:100, rb:(_root.colrb), ga:100, gb:(_root.colgb), ba:100, bb:(_root.colbb)});
}
where _root.colrb are variables that change.

it seems in flash 7 and 8 this doesnt work for some reason. I've noticed that some things such as hitTest, are case sensitive in 7 and 8, but not in 5, where i often wrote it just as hittest. is there something im missing here in terms of case? or do i just have to write the code completely different in 7, 8.

[CS3] Simple Color Change Code Doesn't Work.
i'm using AS3....i'm trying to change the color of a movie clip after i select a color from the color picker component. when i uncomment the two added lines i get errors. am i just really bad at syntax? i have no idea. this is the ONLY code in the file....i'm close to a deadline on this and i'm at a wall. if someone could guide me i'd REALLY appreciate any help i can get.

i uploaded the flash file here just in case:
http://www.zshare.net/download/929868106ef550/

the code is as follows:

import fl.events.ColorPickerEvent;

var tempColor = "0x003366";
var aBox:MovieClip = new MovieClip();
drawBox(aBox, 0xFF0000); //draw a red box
addChild(aBox);



aCp.addEventListener(ColorPickerEvent.CHANGE,chang eHandler);

function changeHandler(event:ColorPickerEvent):void {
drawBox(aBox, event.target.selectedColor);
tempColor = aCp.selectedColor.toString();
trace("- " + aCp.selectedColor);
trace("+ ", event.target.hexValue);
//testXc = new Color(_root.testX);
//testX.setRGB("0x" + event.target.hexValue);
}

function drawBox(box:MovieClip,color:uint):void {
box.graphics.beginFill(color, 1);
box.graphics.drawRect(0,0,50,50);
box.graphics.endFill();
}

Simple Color Change Code Doesn't Work.
i'm using AS3....i'm trying to change the color of a movie clip after i select a color from the color picker component. when i uncomment the two added lines i get errors. am i just really bad at syntax? i have no idea. this is the ONLY code in the file....i'm close to a deadline on this and i'm at a wall. if someone could guide me i'd REALLY appreciate any help i can get.

i uploaded the flash file here just in case:
http://www.zshare.net/download/929868106ef550/

the code is as follows:

import fl.events.ColorPickerEvent;

var tempColor = "0x003366";
var aBox:MovieClip = new MovieClip();
drawBox(aBox, 0xFF0000); //draw a red box
addChild(aBox);



aCp.addEventListener(ColorPickerEvent.CHANGE,chang eHandler);

function changeHandler(event:ColorPickerEvent):void {
drawBox(aBox, event.target.selectedColor);
tempColor = aCp.selectedColor.toString();
trace("- " + aCp.selectedColor);
trace("+ ", event.target.hexValue);
//testXc = new Color(_root.testX);
//testX.setRGB("0x" + event.target.hexValue);
}

function drawBox(box:MovieClip,color:uint):void {
box.graphics.beginFill(color, 1);
box.graphics.drawRect(0,0,50,50);
box.graphics.endFill();
}

Preloader Doesn't Work On All Browsers
Flash MX

The preloader is in the main timeline of the top movie.
When a link is clicked (bikes, parts, home) the preloader runs and the loading movie (load_content) plays frame 2 when it is loaded.

This works fine on my windows XP machine using IE 6.

Doesn't seems to work (very well) on:
Netscape Nav 7 - Windows XP
Netscape Communicator 4.7 - Mac OS 9.2.2

Doesn't work at all on:
IE 5.1 - Mac OS 9.2.2

Preloader Script:

Preloader Script:

Frame 1:
play();

Frame 2:
loadedbytes = _root.load_content.getBytesLoaded();
totalbytes = _root.load_content.getBytesTotal();
loadedkbytes = Math.ceil(loadedbytes/100);
totalkbytes = Math.ceil(totalbytes/100);
frame = int(loadedbytes/(totalbytes/100));

Frame 3:
_root.preloader.loader.gotoAndStop(frame);
if (loadedbytes == totalbytes) {
_root.load_content.gotoAndPlay(2);
gotoAndStop("stop");
}

Frame 4:
gotoAndPlay(1);

Frame 5:
stop();

Please take a look at my site (currently under development) and report on how it performs on your os/browser. Any suggestions on how to make this script more compatibale accross all browsers/platforms are welcome.

It seems that the
loadedbytes = _root.load_content.getBytesLoaded();
totalbytes = _root.load_content.getBytesTotal();
in frame 2 of the preloader are not returning the variables (on all browsers).

Thanks.

View working flash here:
http://www.50ccmotocross.com/flash
(only home, bikes, and parts are currently active.)

Preloader Doesn't Work Right In All Browsers But Safari
I have this preloader that takes a long time to start moving. It stays stuck on 0% for a long time, and then starts moving. The browsers that I tested this in are Firefox (win and mac), IE (win), mozilla (win), camino (mac) and the only one that works, Safari (it also works correctly in flash when testing the movie but that doesn't really count). I attached all of the code that's on the first frame of my movie. You can also see it in action here.

I'm not sure what else to say. Thanks for any help.







Attach Code

stop();

//music
_root.createEmptyMovieClip("music_mc", 1);
music_mc.music1 = new Sound(music_mc);
_root.music_mc.music1.loadSound("music1.mp3", true);
_root.music_mc.music1.stop();
music_mc.music2 = new Sound(music_mc);
_root.music_mc.music2.loadSound("music2.mp3", true);
_root.music_mc.music2.stop();

_root.music_mc.music1.onSoundComplete = function()
{
_root.music_mc.music2.start();
}

_root.music_mc.music2.onSoundComplete = function()
{
_root.music_mc.music1.start();
}


//game
var gameLoader:MovieClipLoader = new MovieClipLoader();
//used to laod clip and broadcast events
var gameListener:Object = new Object();
//generic object that will listen to movieClipLoader events

gameLoader.addListener(gameListener);
//any events from the MCL are sent to the addListener function
_root.createEmptyMovieClip("container_mc",this.getNextHighestDepth);
gameLoader.loadClip("ship.swf", "container_mc");


var percent:Number = 0;
var total:Number = 0;
var loading:Number = 0;
var percent:Number = 0;

gameListener.onLoadProgress = function()
{
loading = container_mc.getBytesLoaded();
total = container_mc.getBytesTotal();
percent = int((loading/total) * 100);
percent_txt.text = percent + "%";
_root.loadBar_mc._width = percent;
if (loading >= total)
{ _root.gotoAndPlay(2); }
}

[MX04] Preloader For JPGs Doesn't Work In Browsers.. Please Help (new To Flash)
Hi everyone,

I am having a problem getting my preloader to work correctly in browsers. It works fine when I test the movie in Flash but breaks when I upload the site to the server. I am pretty new to actionscripting so I have no idea why this is not working. The code below is an example of one button of many that has this preloader on it. There is an empty movieClip called imageHolder_mc into which I am loading the images. Any help would be greatly appreciated!

The code I am using to load the individual images is:

_root.fineArtSelectionBox_mc.fineArtMiniBoxD1_btn. onRelease = function(){
_root.dynamicText._visible = true;
_root.imageHolder_mc.loadMovie("field-of-transformers.jpg", 1);
_root.onEnterFrame = function() {
jpgLoaded = _root.imageHolder_mc.getBytesLoaded();
jpgTotal = _root.imageHolder_mc.getBytesTotal();
percentage = Math.floor(jpgLoaded/jpgTotal*100);
dynamicText.text = percentage + " %";
if(percentage >= 100){
_root.dynamicText._visible = false;
delete this.onEnterFrame;
}
}
_root.imageHolder_mc._x="80";
_root.imageHolder_mc._y="80";

Loading External HTML File Doesn't Work With All Browsers
I'm loading an external HTML file (it's valid and all, has doctype, and meta tags if that matters) into flash. I've attached the code that does the loading. When it's loaded locally, it always works, but when it's loaded from the Internet, it doesn't always work in all browsers. Safari seems to work all the time, Firefox can be a bit fussy about it, and Opera seems to have problems. When I say it doesn't work, I mean the text doesn't get loaded, so the area where it should be is left empty. Is there any other way I can do this? It seems that if I put the text in flash, it has to be on one line, which is very annoying. The formatting gets screwed up if I do this too.









Attach Code

var loadVarsInstructions:LoadVars = new LoadVars();
loadVarsInstructions.onData = function(htmlInstructions:String):Void
{
instructions.htmlText = htmlInstructions;
}
loadVarsInstructions.load("instructions.html");

MovieClip Doesn't Change Color
I've created a new MovieClip with the instance name "box".

Now, when I like to change its filling color with "box.beginFill(0xFF0000,100);" nothing happens.

Shouldn't that usually be a very simple thing to implement ?

Thanks. Thomas

Color Object - Why Doesn't This Work?
Hi,

I've got a movieclip of which I want to change the color. I want to start from black then jump to blue and from there I want to change to green, to yellow, to red. Using steps of - or + 51 in the RGB-scale.

This is the code on the clip:

onClipEvent (load) {
//Mouse.hide();
// maak kleurobject voor deze clip
clip_kleur = new Color (this);
}

onClipEvent (enterFrame){
// check de kleur van deze clip
get_clip_kleur = clip_kleur.getRGB();
}

onClipEvent (mouseDown) {
hexColor = get_clip_kleur.toString(16);
trace(hexColor);
// als deze clip zwart is
if (get_clip_kleur == 0x000000){
// spring naar blauw
clip_kleur.setRGB(0x0000FF);

} else if (get_clip_kleur > 0x00FFFF && get_clip_kleur < 0x00FF00) {
//anders maak mc groener
_root.actie_groen();
updateAfterEvent();

} else if (get_clip_kleur > 0x00FF00 && get_clip_kleur < 0xFFFF00){
// maak mc geler
_root.actie_geel ();
updateAfterEvent();

} else if (get_clip_kleur >= 0xFFFF00){
// maak mc roder
_root.actie_rood ();
updateAfterEvent();

} else {
// anders maak mc blauwer
_root.actie_blauw ();
updateAfterEvent();
}
}

These are the functions on the main timeline that are being called:

function actie_blauw(){
actie_clip = new Color("_root.ball");// moet nog dynamisch gemaakt
actie_kleur_trans = new Object();
actie_kleur += 51;

actie_kleur_trans.rb = 0;
actie_kleur_trans.gb = actie_kleur;
actie_clip.setTransform(actie_kleur_trans);
}

function actie_groen(){
actie_clip = new Color("_root.ball");// moet nog dynamisch gemaakt
actie_kleur_trans = new Object();
actie_kleur -= 51;
actie_kleur_trans.rb = 0;
actie_kleur_trans.gb = 255;
actie_kleur_trans.bb = actie_kleur;
actie_clip.setTransform(actie_kleur_trans);
}

function actie_geel(){
actie_clip = new Color("_root.ball");// moet nog dynamisch gemaakt
actie_kleur_trans = new Object();
actie_kleur += 51;
actie_kleur_trans.bb = 0;
actie_kleur_trans.gb = 255;
actie_kleur_trans.rb = actie_kleur;
actie_clip.setTransform(actie_kleur_trans);
}

function actie_rood(){
actie_clip = new Color("_root.ball");// moet nog dynamisch gemaakt
actie_kleur_trans = new Object();
actie_kleur -= 51;
actie_kleur_trans.rb = 255;
actie_kleur_trans.bb = 0;
actie_kleur_trans.gb = actie_kleur;
actie_clip.setTransform(actie_kleur_trans);
}

The problem is that only the blue to green functions works, the hexColor gives this output:
0
ff
33ff
66ff
99ff
ccff
ffff

After that it should shift to diminishing the green but it jumps to yellow, this is the output:
132ff00
ffff00
ffcc00
ffff00
ffcc00
ffff00
ffcc00
etc.
Example here: http://home.wanadoo.nl/d.roberts/stuff/kleur_test.html

Can someone please give me a clue where things are going wrong?

Thanks very much for your time.
Regards, Danielle.

Return MC To Original Color After Dynamic Color Change
How is it done? All I've seen on the web is how to change the color. Well how about going back. I'm talking about a MC with many colors. I can't just change back to a single hexadecimal color.

I can accomplish the change as it passes over a frame, but I can't get it to change back.

In the frame is this:


ActionScript Code:
cHurtColor = new Color(_root.compMC);cHurtColor.setRGB(0x00FF33);

Trying to keep this simple....

Return MC To Original Color After Dynamic Color Change
How is it done? All I've seen on the web is how to change the color. Well how about going back. I'm talking about a MC with many colors. I can't just change back to a single hexadecimal color.

I can accomplish the change as it passes over a frame, but I can't get it to change back.

In the frame is this:


ActionScript Code:
cHurtColor = new Color(_root.compMC);cHurtColor.setRGB(0x00FF33);

Trying to keep this simple....

My Color Transition/Fade Doesn't Work... Can Someone Tell Me Why? Please?
ok.. here's the set up... just a large mc that's a solid block of color (doesn't matter which color...you can use your favorite) That mc has the instance name "bg_cLIP" (it's just the background)

now.. Just trying to get it working, I was using an onMouseUp() to get the mc's color to change... but I'm getting nothing. The proper color is tracing to the output window fine, but no change takes place. The new color to fade/transition to comes from an array, which is randomly shuffled with each onMouseUp(). Can someone take and tell me where i'm screwing up?

Thanks in advance... here's the code:
Code:
MovieClip.prototype.fADE_cOLOR = function(eNDcOLOR) {
var v1 = this;
var v2 = _root;
v1.pERC = 0;
var endALPHA = 100;
var sPEED = 0.1;
clearInterval(v1.fadeINT);
v1.tMPcOLOR = new Color(v1);
v1.deltaALPHA = endALPHA-v1._alpha;
v1.startALPHA = v1._alpha;

v1.fade = function(target_MC) {
var v1 = target_MC;
if (v1.pERC>=1) {
v1.sTARTcOLOR = eNDcOLOR;
v1._alpha = endALPHA;
clearInterval(v1.fadeINT);
} else {
v1.pERC += sPEED;
v1.tMPcOLOR.bLEND_RGB(v1.sTARTcOLOR, eNDcOLOR, v1.pERC);
if (v1.deltaALPHA != 0) {
v1._alpha = v1.startALPHA+v1.deltaALPHA*v1.pERC;
}
}
};
waited = 1;

v1.waitFADE = function() {
var v1 = _root;
if (waited == 1) {
v1.bg_cLIP.fadeINT = setInterval(v1.bg_cLIP.fade, 10, v1.bg_cLIP);
clearInterval(wait_fadeINT);
}
waited = 1;
};
wait_fadeINT = setInterval(v1.waitFADE, 500);
};
ASSetPropFlags(MovieClip.prototype, 'fADE_cOLOR', 1, 0);
/*
*/
Color.prototype.bLEND_RGB = function(c1, c2, t) {
var v1 = t;
var v2 = c1;
var v3 = c2;
if (arguments.length == 2) {
v1 = v3;
v3 = this.getRGB();
}
if (v1<-1) {
v1 = -1;
} else {
if (v1>1) {
v1 = 1;
}
}
if (v1<0) {
v1 = 1+v1;
}
v2 = v2.HEXtoRGB();
v3 = v3.HEXtoRGB();
var ct = v2.rb+(v3.rb-v2.rb)*v1 << 16 | v2.gb+(v3.gb-v2.gb)*v1 << 8 | v2.bb+(v3.bb-v2.bb)*v1;
this.setRGB(ct);
return ct;
};
/*
*/
Number.prototype.HEXtoRGB = function() {
var v1 = this;
return {rb:v1 >> 16, gb:v1 >> 8 & 255, bb:v1 & 255};
};
/*
*/
Array.prototype.rANDOM = function() {
var lEN = this.length;
var tEMP = new Array();
for (var i = 0; i<lEN; i++) {
var rAN = Math.round(Math.random()*(this.length-1));
tEMP[i] = this[rAN];
this.splice(rAN, 1);
}
for (var j = 0; j<lEN; j++) {
this[j] = tEMP[j];
}
};
//
// ------------------- >> COLOR ARRAY AND MOUSE UP
//
var cLR_array = ['57521D', '373226', '715D0B', '401C02', '3B3B39', '243A19', '482626', '710B0B', '9DAABA', '0C487B'];
//
_root.onMouseDown = function() {
newCLR = '0x'+cLR_array[0];
this.bg_cLIP.fADE_cOLOR(newCLR);
trace(newCLR);
cLR_array.rANDOM();
};


hopefully you can understand what's going on and what i'm trying to do... which is basically, to change the BG color to a random color pulled from an array. I just want it to have a gradual transition between colors.

Actionscript Color Change Code, It Needs A Lil Work, Please HELP
Code:
///////////////////////////////////////////
//What i'm trying to do is get the rgb
//Change it by a small random amount
//Aplly the change to the clip "square"
///////////////////////////////////////////

//Code on clip
onClipEvent(load){
var rgb=;
var RGBReturn=;
var red=;
var green=;
var blue=;

var redReturn=;
var greenReturn=;
var blueReturn=;
}

onClipEvent(enterFrame){
getRGB();
editRGB();
returnRGB();
}

//Code on main timeline, frame 1
function getRGB(red,green,blue){
var rgb= square.getRGB();
var red=(rgb >>16) & 0*FF;
var green=(rgb >>8) & 0*FF;
var blue=rgb & 0*FF;
}

function editRGB (redReturn,greenReturn,blueReturn) {
redReturn = red+ Math.floor(Math.random() * 10);
greenReturn = green+ Math.floor(Math.random() * 10);
blueReturn = blue+ Math.floor(Math.random() * 10);
}

function returnRGB (redReturn,greenReturn,blueReturn) {
RGBReturn= (redReturn<<16) |(greenReturn<<8) | blueReturn;
return RGBReturn;
}

Dynamic Color Change
I am trying to make the color of a movie change dynamically. If i enter either rgb or hex values... I want it to smoothly change from the previous color to the entered value.

If someone has an ex of such code and would like to share, that would be great, but just an idea to get me starte would also be apreciated.

Thanks

Dynamic Color Change
is it possible to make a mc fade from a blue tint to a red tint with action-script? the fade should be about 10 keyframes and just like a motion tween. it has to be done with actionscript, cause i want to be able to fade it into different colors and i cant make every animation (green to purple, purple to orange, organge to green, etx.)
anyone? thanks!

Dynamic Color Change
Hello,

I really need someone to point me in the right direction.

I would like to create a number of invisable buttons each one that change a single mc to a different color and display the color's name- sounds simple !

Can it be done through actionscript ?

Something like -

on(rollOver) 'invis_btn_01' change 'color_mc's' rgb value to #FFF and add this name to mc's dynamic text field "white"

on(rollOver) 'invis_btn_02' change 'color_mc's' rgb value to #000 and add this name to mc's dynamic text field "black"

I'd like to keep file size to min and everything nice and clean

cheers !

Dynamic Color Change
Does anyone know how to dynamically change the color of something by using actionscript having it fade into that color instead of it just becoming that color? I know you need to use an array to store the colors and then you can pull them up when lets say a button is clicked. But how would you make it fade into that color and not just change.

Dynamic Color Change?
i work at this place that does tons of partner sites for our main company, that all the same site, just with different color schemes and logos. i'm in the middle of redoing a lot of the elements and making them flash based. i realized if i can have a way of maybe dynamically loading the colors on the page from an exteral php or xml document, that i would save myself and other much work in the future.

does anyone know if a way to do this? to load the color of something from an external document? i'm taking about fill colors here. i think i've seen it done with componients, but is there a strictly actionscript method?

Dynamic Color Change
Is there a way of tweening colour using actionscript. Like you would using an alpha fade but using color instead.

Say I have a button that once pushed it turns a square from orange to blue, but gradually fading.

I would much appreciate any help, thanks.

Dynamic Color Change?
i work at this place that does tons of partner sites for our main company, that all the same site, just with different color schemes and logos. i'm in the middle of redoing a lot of the elements and making them flash based. i realized if i can have a way of maybe dynamically loading the colors on the page from an exteral php or xml document, that i would save myself and other much work in the future.

does anyone know if a way to do this? to load the color of something from an external document? i'm taking about fill colors here. i think i've seen it done with componients, but is there a strictly actionscript method?

Dynamic Change Car Color
It's not a new function.

You can find the effect I am talking about by clicking "Color Options" from the main menu button "Gallery".

http://mazda.be/subsites/rx8/_nl/start.htm

Dynamic Text That Doesn't Change Size?
Hello!

Is there a way to make it so that dynamic text does not change with the size of the flash movie? I published a movie using "Percent" and not "Match Movie", so the flash movie changes with the size of the browser window. But I do not want certain text to change size...

I tried loading the text through a *.txt file and then setting the font size <font size = "12">, however, the font size still changes with the movie...

Can anybody help me?

Dynamic Text Doesn't Stay When Change
my unit's btns will change what will display in the dynamic text. But the changed text doesn't stay but revised back to what was set initially!

please refer to my .fla.

How do i dynamically change the text if i want to affect change from another _level? i try setting my currentUnit.text = to a _global variable but it didn't effect the change.

erm, the external.swf is unnecssary ...cos the main thing is getting the text to display correctly, trigger but the drop down 5 bottns.. .

Dynamic Text Doesn't Stay When Change
my unit's btns will change what will display in the dynamic text. But the changed text doesn't stay but revised back to what was set initially!

please refer to my .fla.

How do i dynamically change the text if i want to affect change from another _level? i try setting my currentUnit.text = to a _global variable but it didn't effect the change.

erm, the external.swf is unnecssary ...cos the main thing is getting the text to display correctly, trigger but the drop down 5 bottns.. .

Dynamic Color Change...been Dane?
I need a function that can receive the RGB values that I feed to it and then it would programmatically fade the current RGB (tint) values of the target MC to the new values. creating a color shift (not snap) that I could trigger dynamically. has anyone seen anything like this? this must have been done. Thanks!

Random Dynamic Color Change
Hi! At some point in my movie I duplicate an mc (a simple ball) several times and I want each duplicated ball to have a different color chosen at random.
How can I go about it?
Thanks very much for any help.

[F8] Change Dynamic Text Color
I have a dynamic text field (title_txt) it is populated through a XML file that defines most of my body elements. I am trying to get my title_txt to change to the color of the secondary color which is also defined in the xml file, but for some reason I cant to get it to work. Here is my code check the //header section to see where I am ahving problems


Code:
function getMenuNode ()
{
var xmlin = new XML ();
xmlin.ignoreWhite = true;
xmlin.onLoad = function ()
{
headerNode = xmlin.childNodes[0].childNodes[0]
bodyHeader = headerNode.attributes.header;
backgroundColor = headerNode.attributes.bgColor;
primaryColor = headerNode.attributes.primaryColor;
secondaryColor = headerNode.attributes.secondaryColor;

//header
//problem starts here
titleFormat= new TextFormat();
titleFormat.color = secondaryColor;
title_txt.setTextFormat(titleFormat);
// works fine below this
title_txt.text = bodyHeader;


//primary color
var colorPrimaryTrans:ColorTransform = new ColorTransform();
var transPrimary:Transform = new Transform(contentBody_mc);
transPrimary.colorTransform = colorPrimaryTrans;
colorPrimaryTrans.rgb = primaryColor;
transPrimary.colorTransform = colorPrimaryTrans;
//background color
var colorBGTrans:ColorTransform = new ColorTransform();
var transBG:Transform = new Transform(background_mc);
transBG.colorTransform = colorBGTrans;
colorBGTrans.rgb = backgroundColor;
transBG.colorTransform = colorBGTrans;
//logo
createEmptyMovieClip("logo_mc",getNextHighestDepth());
logo_mc._x = 10;
logo_mc._y = 5;
loadMovie("bodyElements/logo.jpg","logo_mc");
}
xmlin.load ("data.xml");
}

Change Dynamic Text Color
So I have this typewriter script that looks like this:
frame 1:
Code:
firstname = "Tom";
_root.strText = "Hi "+firstname+". Allow me to introduce myself.";
_root.counter = 1;
frame 2 (labeled "loop"):
Code:
_root.text1 = _root.strText.substr(0,_root.counter);
_root.counter++
frame 3:
Code:
gotoAndPlay("loop");
I'm looking to get 'firstname' to be a different color than the rest of the text. How can I do this?

Change Dynamic Textbox Color
Hi, how do I change the color of a Dynamic Textbox? Thanks!

Change Color Of Dynamic Button
I created buttons using this code(from the library)

_root.lines.attachMovie("Button", "button"+i+p1+p2,i+p1+p2);
_root.lines["button"+i+p1+p2]._height = 10;
_root.lines["button"+i+p1+p2]._width = 10;
_root.lines["button"+i+p1+p2]._x = posx[i];
_root.lines["button"+i+p1+p2]._y = posy[i];
// _root.lines["button"+i+p1+p2]._RGB=(0x00ff00);
//_root.lines["button"+i+p1+p2].color= "#176C34";
_root.lines["button"+i+p1+p2].backgroundColor = 0xFF0000;
_root.lines["button"+i+p1+p2].color = 0x0000FF;
_root.lines["button"+i+p1+p2].textColor = 0xFFFFFF;
I am not able to figure out how I can change the coor of the button dynamically
Can anyone help please?

Random Dynamic Color Change
Hi! At some point in my movie I duplicate an mc (a simple ball) several times and I want each duplicated ball to have a different color chosen at random.
How can I go about it?
Thanks very much for any help.

Dynamic Text Change Color?
Hi all,
First of all i would like to thank all of you, I've been around allready for a while. looking ,reading but most of all learning allot from all of you.
and now what i would like to learn.
I saw the menu over at designcharts and was wondering how that was made.
I expect it gets its content dynamicly, xml or php that i can understand, but how would you make that rollover effect with dynamic text?
i never thoughed it was possible to mask dynamic text.
If there is somebody out there that knows how to build it please share it,
thanx in advance!

G

Dynamic Color Change Function
Hey gang. I'm making a thing where I need the color of several different things to change gradually and dynamically (on certain item clicks).

I setRGB so I can the getTransform to subsequently color.rb +=, so I can transition the colors fine. My "problem" is that i'm trying to develop it as a function so I can simply call the function for each item that needs to color change rather than repeating the same code a bunch of times for each item.

I tried making a Color.prototype, no luck, I tried making a MovieClip.prototype, no luck. I basically need a way to pass the color of an item to a function and then onEnterFrame it into changing. So function? Prototype? Something else?



Code:
oldColor = grass_color.getTransform();
//to get starting colors
arby = oldColor.rb;
gebe = arby;
bebe = gebe;
//Grayscale transition so R G and B all the same
n = 30+Math.round(Math.random()*30);
//random number of frames (between 1 and 2 seconds at 30FPS);
c = Math.round(Math.random()*100);
//new target color;
i = 0;
changer = holder.createEmptyMovieClip("changer", 1);
changer.onEnterFrame = function() {
if (i<n) {
i++;
oldColor.rb -= (arby-c)/n;
oldColor.gb -= (gebe-c)/n;
oldColor.bb -= (bebe-c)/n;
grass_color.setTransform(oldColor);
} else {
removeMovieClip(this);

Dynamic Color Change Problem Please Help.
Hey Guys, Code is provided below. I have an example or what works and what doesn't. I am about to throw my computer out the window.


This code works:

function paCountyHighlight(targetCounty) {
var myColor:Color = new Color(this.usa.pa_counties.Washington);
myColor.setRGB(_root.hoverColor);
_root.countyLabel = targetCounty+", PA"_root.displayCountyLabel();



When I change it to support my needs it does not work! I have tried hours on end to get this going:


function paCountyHighlight(targetCounty) {
var countyColored = this.usa.pa_counties.targetCounty;
var myColor:Color = new Color(countyColored);
myColor.setRGB(_root.hoverColor);
_root.countyLabel = targetCounty+", PA";
_root.displayCountyLabel();
}


You should be able to see what I am trying to do. I am trying to use the parameter rather than the hard-coded county name. I tried a million different ways to call this county to change color. I even tried the setTransform method. PLEASE shed some light on this for me.

Dynamic Change Of Color For Graph
i tried duplicating a movie clip of a bar with animation that tweens upwards and changes colors from red to green when it reaches it's last keyframe.

however, duplicating the movieclip only duplicates the first frame of the movieclip and not the rest of the animation.

so i'm looking for a way to dynamically change the color of the movieclip based on it's _y position instead, however i don't know how to dynamically change the color from red to green using only actionscript.

here's the code i used


Code:
stop();
this.onEnterFrame = function(){
/* creates bars */
for(counter=0;counter<=10;counter++){
duplicateMovieClip (_root.bar, "bar" + counter, counter);
}
/* this places the bars in their places */
for (counter=0;counter<=10;counter++){
this["bar"+counter]._x = 42+this["bar"+(counter-1)]._x ;
this["bar"+counter]._y = this.bar._y;
}

colorshift = new Color("_root.bar");
colorshift.setRGB(0x006699);
}
i also would like to know how to preserve the image gradient within the movieclip
or is there a way to just change the percentage of the RGB (like in properties>color>advanced option) because my current code changes it into a single color and makes the image look flat.

Dynamic Text Color Change
Anyone know why this isn't changing the text color on release?

newLetter.onRelease = function() {
var matchFound:Boolean = false;
var clickedLetter:String = this._name.charAt(this._name.length-1);
for (var j:Number = 0; j<chosenWord.length; j++) {
if (chosenWord.charAt(j) == clickedLetter) {
_root.guess_txt.text = displayedText.substr(0, j)+clickedLetter+displayedText.substr((j+1));
matchFound = true;
this._visible = true;
myFormat_fmt = new TextFormat();
myFormat_fmt.color = 0xbbbbbb;

}

Dynamic Color Change + Tint?
I have a shape whose color is changed when this button is pressed:

new Color([shape_selected]).setRGB(0xff0000);

I would also like this shape to have a rollover effect since eventually I'm going to have a ton of shapes and it will be hard to differentiate between them when selecting one. Tint seems to work the best visually, but I'm using this thing:

http://proto.layer51.com/d.aspx?f=143

and it resets the color of the shape back to what it was originally, so it undoes what the button does.

Any help? I would be pummmped! thanks!

Did MX Come Out With A Dynamic Text On Mouse Over Cursor Doesn't Change
That thing that changes to a >>> I <<<< shaped thing when you roll over a dynamic text field. did MX come out with a function to not do that so it stays an arrow like how the static text field works??

Change Color Of Text In A Dynamic Textbox
hi everyone,

does somebody know how to change the color of text in a dynamic textbox via actionscript?
i want to set the text at runtime but also the color, so converting the text to a symbol is not an option (as long as you can'7 convert it at runtime).

any ideas are highly appreciated ...

tia

eman

How To Change Dynamic Text Color With ActionScript ?
Can somebody tell me how to change dynamic text color
using ActionScript or in the other way????

It has to be change during the movie playing...

ZeroIQ

How Do You Change The Background Color Of A Dynamic Text Box?
Hi. I was wondering how you change the background color of a dynamic text box. Also, can you make it a different shape? For example, can you make the corners rounded etc?
Thanks for any help.

Mouserover/color Change In A Dynamic Textfield
First.. a fantastic page here: http://www.weworkforthem.com/wwft.html

Me and a couple of friends have been wondering, how they do that color change on the links(mouse over) effect.. iwe been speaking with one of the designers at wwft, who told me that they loaded the txt from a .txt file into a dynamic txtfield.. and then used a script on the txtfield that changed the color effect on each link when the mouse was over!

(due to © he wasnt allowed to make the script public!)

Anyone have any idea how? or experience with making this?
Alive@4b4.dk

Kasper

Change Dynamic Text Color/size?
Hello, I was wonder how you change the color and size of text that appears in a dynamic text field. I tried selecting it and changing it in the "characture" panel, but that doesn't seem to do anything. how would I go about this?

How To Change Color Of A Mc W/ Dynamic Text With Script?
Cannot figure out how to do it.
Since the mc contain a dynamic text box, the color of the text seems to be dominated by the text box color.

I have tried to use setRGB or setTransform but none seems to be working.

But i know i can cgange the color with the tint setting in the property pane, but how can i do it w/ scripts?

Dynamic Color Change With Alpha On Tint
is it possible to apply a dynamic color change with alpha tint to an mc using actionscript, i would use this to chnage it normally:

code:
myColor = new Color(this);
myColor.setRGB(0xFFFFFF);


can this also incorporate tint so that i could specify an RGB and alpha value?

thanks.

Dynamic Text Mouseover Color Change?
So, I have a dynamic menu drawing its info from an external as file. The menu contents are loaded in a textfield inside a movieclip
The question is, can I have that text change color as I put the mouse over it?

- K

Change Dynamic Text Background Color
For some reason I can't get my background changed

ccText_txt.backgroundColor = 0xcccccc;

I have a dynamic text box with instance name of ccText_txt that starts on frame 1 and spans 30 frames. On a separate layer I have functions that are in frame one and that frame goes across all 30 frames as well. The function layer turns the text box on/off.

Any reason the background won't show? I am using MX 2004 pro and publishing as player 6.

Change Movieclip Color & Text Through Dynamic Txt
Ok, I am developing an interface for a client (to display in their office, not web based). I need to include a way to let the client (not Flash or programming savvy) to update part of the interface saying whether or not property has been available, pending or sold. This will change a circle's color and a word (for example, "Sold!" and the circle would now be red). I can make this work through a dynamic txt file, but I have to use 2 txt files (one for the color and one for the text). My questions are these: How can I make this as simple as possible for the client? I would like to change the txt file so they just input "red" rather than "0xCC0000", and not have two txt files. (when I try to integrate them, the circle turns black rather than the color I specify). Lastly, how would I integrate a database if necessary?

My code on the frame:


Code:

// *************************** //
// MovieClip.setRGB() method //
MovieClip.prototype.setRGB = function(newColor) {
(new Color(this)).setRGB(newColor);
};
// end MovieClip.setRGB()
// *************************** //
var a = new LoadVars();
a.load("properties.txt");
a.onLoad = function(success) {
if (success == true) {
trace("Text file load successful");
// variable representing hex number
circle = new Color("lot1");
nColor =_root.a.lot1;
circle.setRGB(nColor);

} else {
trace("Error: text file did not load properly!");
}
} // end onLoad()
loadVariablesNum("propertiestext.txt", 0);



And my color txt file (properties.txt):

&lot1=0xCC0000


And the word txt file (propertiestext.txt):

&lot1status=Sold!
&textloaded=OK


All help is appreciated! Thanks!!!

Change Color Of Dynamic Text Via Code?
how can i change the color of a dynamic text box via actionscript? i can't seem to find it anywhere.

thanks

Copyright © 2005-08 www.BigResource.com, All rights reserved