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




Changing Instance Or Object Color



does anyone know of a script that will change an object color?

eg: I have a white box, on button1 press I want it to go blue, on button2 press it will go red etc.

so is it possible?

thanks if anyone can help! would be tops!

zanga



FlashKit > Flash Help > Flash ActionScript
Posted on: 01-14-2002, 01:22 AM


View Complete Forum Thread with Replies

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

Changing A Grphic Instance Color
G'day,
I have a scene that has a series of buttons. If i clivk a button it will bring a screen that has a profile of a network that has different components and colors associated with those components. On the first screen where the buttons are i'd like to be able to have a variable associated with the corresponding profile so that if profile 1 is clicked it brings up a configuration with certain colors. If i click profile 2 it brings up a configuration with different colour representations. There are 7 profiles and 8 configurations, So rather than having to create 56 different colour configs I'd like to have it so that the depending which profile is clicked and then configuration, the colour will change. Can you change the tint of a graphic with code? If so this is what i'd like to accomplish.
thanx

Dynamically Changing Color Of An Instance?
I know that the _alpha property can be changed using code, but I need to use code to actually manipulate the color of an instance.

Is there a way to do this, or is _alpha only manipulated in terms of opacity?

Thanks,
+Q__

Changing Instance Color Of A Movie Clip
I've got a map, of those you roll over the mouse on the sections and it displays the section name.
I want to add to these code, the instance of changing the colour of the section, so sections are more visible each time you move your mouse over the map.

So, I have this code on every section (each section is a MC).


Quote:




onClipEvent (mouseUp){
myColor.setRGB(0xff9933);
}
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, false)) {
_root.ciudad.escribir("Quilmes");
tip = true;
} else if (tip) {
_root.ciudad.escribir("");
tip = false;
}
// end if
}




Somebody can help me out here on adding to these a change color?
I've tried several options but none of them worked.

Thanks a lot.

Changing An Object's Color
i have this old piece of code:

Code:
if (Number(charinline)<=Number(linelen)) {
duplicateMovieClip("/fx_" add fx add "_0", "char" add i, i);
set("/char" add i add "/letter/lettercolor:char", key);
setProperty("/cursor", _x, Number(startx)+Number(charinline*kerning)-20);
setProperty("/char" add i, _x, Number(startx)+Number(charinline*kerning));
setProperty("/char" add i, _y, Number(starty)+Number(linenum*linespace));
charinline = Number(charinline)+1;
i = Number(i)+1;
}
... which duplicates and places mc named "char[i]" on the stage based on predetermined _x & _y values, now i need to change the color of said mc. how can i do that? i've been trying to find a way but i gave up after 3 hours.

any help will be greatly appreciated

thanks much
- w

Changing Object Color With AS
hi I am trying to make a smooth color transition using AS2

the way I have now the mc changes colors just fine, but not smooth like when you use tween. I know there is a 'get Transform' function but I don't know how to apply maybe someone has an example??


Code:
function changeBG(col) {
var c = new Color(_root.bg);
c.setRGB(col);
}
changeBG(0xCC3366);

Can I Get Some Help With Changing The Color Of An Object?
I'm trying to make the following - I have 5 buttons corresponding to five sections in my Flash movie..I want to make it so, that when I click on a button it background color changes(to show that it was clicked and I'm in that section)...
The button is located inside a movieclip(not in the root timeline)...
For the purpose I converted the background of the button (which I want to change) to a movie clip, so I could use the "setRGB" command, but still I'm doing something wrong and nothing happens...
Can someone explain to me clearly the mechanism of changing the color of a movie clip?

Thanks in advance!

Changing The Color Of An Object
Hi

I want to make something like a children's paint book. The user will choose the color from a palette and when she clicks an object, that object will seem in that color.

Anyone knowing a tutorial about it, or any suggestions on how to accomplish this?

Thanks in advance

Changing The Color Of Clicked Object
Hi,

I'm looking for a way to change the color of the object that I click on. Something like a paint program where you first click to select the color and then click on the place which you want to color.

Thanks

Greg

Changing The Color Of An Object At Every Execution
I have a problem:

I have one file, template.as, this file keeps color configuration to make changes of my site.
I would like to know if it is possible to change color of an object every time of execution (run time).
I am using setRGB() function to make these changes.
The variable that defines the template that will be used is loaded with loadVariablesNum() function.
My script works only when I compile my movie clip (generate .swf)
I want to change the colors without having to "compile" my movie every time.

If someone can help me with other functions or any other way to do this, I will be very grateful.

Thanks

Changing The Color Of An Object In Actionscript
Is it possible to change the tint/color of an object in Actionscript and if so, how?

Cheers

Changing Color Of Imported Object
Hi,

i am trying to change color of imported swf file from another swf, let say i have a swf names fileparent and inside mc with instant name stage. in that stage i have some controls of color boxes i have imported another swf using AS on stage. imported swf have some layers with different objects of different colors i want to change color of every object separately. i dont know how to access that object inside imported swf.

just need to know the way to get inside imported object.

see an example here

http://www.bluecotton.com/studio.htm...175&garColor=1

thanks in advance

Gradually Changing The Color Of An Object
What I want to do is to transition the color of an object to a different color gradually. In other words, in frame 1 i have a light gray circle. In frame 30, I have a dark gray circle. I want to show a smooth transition from the light gray to the dark gray. Can this be done with a motion tween?

Changing Object Color Using ActionScript
First hello to everyone from a newbie

And now to the problem..i want to change color of an object via AS, which seems simple enough but stay with me. Id already seen http://www.kirupa.com/developer/actionscript/color.htm but here the object processed is made of multiple rectangles and my object cannot be really made of it. To be more precise, i want to create an image of an house and change it's color. I tried drawing it with lines, then making it a symbol and change it according to the tutorial but all i accomplished is changing the color of lines.

Anyone has another suggestion?

Thanks in advance

So Easy, I Can't Do It - Changing Object Color
I draw a circle on the stage.

I select it and save as symbol, i call it mc_circle and "export to action script" as my_mc_cirle

I cannot get the circle to change color using what I imagine should be a 1 liner. Very frustrated


my_mc_circle.setRGB(0x0000CC);
and
mc_circle.setRGP(0x0000CC);

are doing nothing??

Changing The Color Of An Object/movie Clip
I had an object that I wanted to be visible and invisible at my choosing... had to change it to a movie clip (this seems silly to me... you should be able to do it to objects)... but now I want to change the color of this movie clip object at the click of a color... how would I go about doing this... I tried this without success:
c=new Color(img_boy);
c.setRGB( 0x000000 );

Thank you

Instance Names...changing...or Addressing Txt Field Instance Based On Instance Of Mc
i'm creating a mail form, that has a text effect which displays the type of info to be entered in each input box. To create this effect, i had to assign the variable name txt to the input boxes as well as the instance name txtBox. each of these text fields is contained within a movieclip, each with a unique instance name. what i need to do, is somehow assign a value/variable to each text field to pass to PHP to generate an email. I have always used components for contact forms so i'm not sure how to make the switch, AND.. the script i use for my contact form is an EXTERNAL AS file. (i use a customized version of a contact form from www.actionscript-toolbox.com [which apparently is no longer Flash related site])

ok.. this is hard to explain..... so bear with me....
If my original mail form component instance names were: tiName, tiEmail, tiSubject and taMsg (ti for textInput and ta for textArea)
and my current instance names for the mc's which CONTAIN the input boxes (with txtBox textfield instance inside them) are: name_txt, email_txt, subject_txt & comments_txt...

how would i pass/convert the users input text in each movieclip's txtBox, into the original instance name for my mail form so i can continue to use the form/PHP i have been using??

OR....

how do i take the values input by the user in each txtBox (i.e name_txt.txtBox.insertedTextFromUser or name_txt.txt, email_txt.txtBox.insertedTextFromUser or email_txt.txt) and send them to a new PHP script to send mail??

please keep in mind i am PHP retarded... hence why i re-use the same form over and over..

thanks in advance for any help. it's greatly appreciated...

if you're confused about my problem, please let me know... i'm having a difficult time explaining....

Changing Fill Color And Line Color Dynamicly And Seperately
Hi community,

In this case, I am going to load a swf with a looping animation colored in black and white only. I want to change the color of the animation dynamicly so that I could have different color at each time. Here is my code:


Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import flash.display.*;
import flash.net.URLRequest;

private function init():void{
myCan.addEventListener(Event.ENTER_FRAME,capMotion);
}
private function capMotion(event:Event):void{
var bmd1:BitmapData = new BitmapData(mySwf.width, mySwf.height, true, 0x00CCCCCC);
bmd1.draw(mySwf);

var bitmap1:Bitmap = new Bitmap(bmd1);
bitmap1.x = 0;
bitmap1.name="org";
if (map.getChildByName("org") != null){
map.removeChild(map.getChildByName("org"));
}
map.addChild(bitmap1);
var bmd2:BitmapData = new BitmapData(mySwf.width, mySwf.height, true, 0xFFFFFFFF);
var pt:Point = new Point(0, 0);
var rect:Rectangle = new Rectangle(0, 0, mySwf.width, mySwf.height);
var threshold:uint = 0xFF999999;
var color:uint = 0xFFFFFF00;
var maskColor:uint = 0x00FF0000;
bmd2.threshold(bmd1, rect, pt, ">=", threshold, color, maskColor, true);

var bmd3:BitmapData = new BitmapData(mySwf.width, mySwf.height, true, 0xFFFFFFFF);
threshold = 0xFF000000;
color = 0xFF00CCCC;
maskColor = 0xFFFFFF00;
bmd3.threshold(bmd2, rect, pt, "==", threshold, color, maskColor, true);

var bitmap2:Bitmap = new Bitmap(bmd3);
bitmap2.name="dup";
bitmap2.x = bitmap1.x + bitmap1.width + 10;
if (map.getChildByName("dup") != null){
map.removeChild(map.getChildByName("dup"));
}
map.addChild(bitmap2);
}
]]>
</mx:Script>
<mx:Canvas id="myCan" x="10" y="10" width="650" height="603">
<mx:SWFLoader id="mySwf" width="100" height="250" horizontalCenter="0" verticalCenter="-7.5" source="dance.swf" complete="init()" scaleContent="false" autoLoad="true"/>
<mx:Image x="61" y="320" width="550" height="152" id="map"/>
</mx:Canvas>
</mx:Application>
It works quite fine but I afraid that it's quite resource consuming using enterframe and bitmap drawing. Is there any better method?
Thanks for help.

How Would I Go Changing Lots Of Movieclips Color And Border Color Seperatly?
I am in the making of a isometric level editor, and I have about 15 movie clips with more to come.
I want to let people change the color of tiles to what they want from a list of colors, so how can I let them change the color of a tile dinamicly with actionscript so that it changes a tile's color while preserving changes of "shadows"?
I mean I have let's say a cube and to make it look 3D I need to change each face to make a feeling of 3D and not a flat one.
thanks.

Changing Color On RollOut Then Back To Color After 2 Seconds
I am using the code below to make a shape turn color using on rollOver, then on rollOut is changes to a differant color(blue), then I want it to change back to the first color(white), either on another rollover or I perfer to make it change back to the fist color after a 2 seconds,

on (rollOver) {
var colorful = new Color("_root.shapes");
colorful.setRGB(0x006699);
}
on (rollOut) {
var colorful = new Color("_root.shapes");
colorful.setRGB(0x006688);


I want to be able to rollOver change color, onRollOut Change color again, then back to the first static color after 2 seconds.
Anyhelp would be great Thanks

[CS3] Changing Color (and Opacity Of That Color) Of Movie Clip
Hi. I have a pretty large movie clip filled with pngs. It's a sprite for a game and I want to change it's color. The setRGB method works, but I can't figure out how to set the opacity of the color. I don't want to change the alpha of the movie clip itself, just the color I'm applying to it so that it's just a shade over the normal images.

Is there any way to do this?

Changing Stage Color When Changing From Scene
Hi,
I would like to change the color of my stage when I get in my next scene, is it possible?

So when people look to the movie Scene one should be black and scene 2 white. Don't tell me to put a big white square at the button of scene 2 coz when put it online I want all my window to change from color.

Thx

Change Color For More Mcs With Color Object At A Time
This changes color of one mc:

Code:
myColor = new Color(myMovie);
myColor.setRGB(0x993366);


Is there a way if I have dozen of mcs to change color at a time for all this mcs?

Thank you

[F8] Color Swatch Or Change - Color Object?
You know how on retail sites or even a car site you can swap the color by clicking on the swatch and than the image changes the color. I wanted to do this in flash preferably with actionscripting but I have NO CLUE how to do it. Can anyone show me a tutorial or advise me o how to do this. This is just a BASIC example in flash five but this is the same concept I want. http://www.adobe.com/support/flash/i...y/colorobject/ If anyone knows of a high level example with tutorial I would appreciate it.

Turtle

Change Color For More Mcs With Color Object At A Time
This changes color of one mc:

Code:
myColor = new Color(myMovie);
myColor.setRGB(0x993366);
Is there a way if I have dozen of mcs to change color at a time for all this mcs?

Thank you

Setting The Color Of Multiple MCs Using One Color Object
Hiya I am making a movie that has to be published to Flash Player 6 and want to set a bunch of movie clips to have the same color. Here is my function:

ActionScript Code:
var fillObjs_ar:Array = [square_mc, circle_mc];function colours(array:Array, color) {       for (i=0; i<array.length; i++) {        var my_color:Color = new Color(array[i]);        my_color.setRGB(0x+color);    }}colours(fillObjs_ar, FF0000);

My problem is that I get the error message:
"Hexadecimal digits expected after 0x" referring to the 4th line of my function.
If anyone could help me out it would be really appreciated.
Thanks
Schm

Change Color For More Mcs With Color Object At A Time
This changes color of one mc:
Code:

myColor = new Color(myMovie);
myColor.setRGB(0x993366);

Is there a way if I have dozen of mcs to change color at a time for all this mcs?

Thank you

Changing Mc Instance Name
Hi folks,

Is there any way to change a movie clip instance name within the code?

Thanx in Advance.

Zoo_mann

Changing MC Instance
I have several copies of a movie clip on my stage and I want each one to start on a different frame (so they're not in-sync). With previous flash versions you could bring up the instance panel and type in the starting frame. I can't seem to find it in MX...

Thanks

Changing Instance Name
i'm using 'duplicate movie clip' on my main MC ('strip' is the instance name, and 'strip2' is the duplicated name).

there are 7 smaller MCs in the main MC ... each have their own instance names ...

my question is that when i implement the duplicateMC on 'strip' to 'strip2' i'd also like to change the 7 smaller MC names from '*' to '*2' ...

i'm working in FlashMX ... is that possible?

- Schalke04

Instance Name Changing
Hey, this is really annoying so I would really appreciate it if someone helped. I have these movie clips, that are all identical inside another movie clip. From these nested clips, I want to control another clip on the main timeline. Its instance name is "life". The nested clips, which don't have an instance name, have this code in them. :
Code:
onClipEvent(enterFrame){
if(this.hitTest(_level0.car)){
_level0.instance12.life._xscale-=5;
}
}

but each time I add another clip onto the stage, or anywhere, the "_level0.instance12.life" name changes from instance12.life to 13 to 14, and so on. Then I have to change the code in all of the nested clips for it to work. Is there an easier way to code this? Thanks in advance.

AS Changing Instance Name
Is there a posibilyty to use as and change instance name of a text field ?

Insert Instance Of Object Object
Hi
What is the actionscript to insert an instance of an object into the scene?
cheers
Ben

[F8] Problem With Changing "Shape Fill Color" Color
Hi guys,

I am having some trouble trying to figure out how to change the Shape Fill Color for the corner which is currently in #FF6600.

Can someone advise me how I can access this attribute?

See files attached.

Get Color Instance From DisplayObject
in AS2 you used to be able to say new Color(target) - it seems new Color now must be passed all the appropriate multipliers and offsets, so sans a built-in method i'm doing it manually (below). Is there a better way to do this?
ActionScript Code:
function getColor(target):Color{
    var trans = target.transform.colorTransform;
    var color = new Color();
    color.redMultiplier = trans.redMultiplier;
    color.greenMultiplier = trans.greenMultiplier;
    color.blueMultiplier = trans.blueMultiplier;
    color.alphaMultiplier = trans.alphaMultiplier;
    color.redOffset = trans.redOffset;
    color.greenOffset = trans.greenOffset;
    color.blueOffset = trans.blueOffset;
    color.alphaOffset = trans.alphaOffset;
    return color;      
        }
tyia

Change Color Per Instance
I have a MC that is basicly a star exploding. What i am trying for is for each instance of the MC to be a random color. This is the code i have.

this.createEmptyMovieClip ("canvas_mc",10);

MyInterval = setInterval(addstar,500);



function addstar() {
myColor = Math.round( Math.random()*0xFFFFFF );
myColoredObject = new Color (canvas_mc);
myColoredObject.setRGB(myColor)
var t:MovieClip = canvas_mc.attachMovie("star","stars"+i, canvas_mc.getNextHighestDepth());
i++
t._xscale = t._yscale = Math.random()*80 + 20;
t._x = Math.random()*600;
t._y = Math.random()*500;
t._alpha = random(70) + 30;

}

i can only get it to change canvas_mc but not the stars+i instance.
Anyhelp would be greatly appreciated.

Hex Color As Variable In Color Object?
im trying to do this

myColor = new Color(myMC);

myColor.setRGB(variable);

we have all of the colors we need in css info in a database but im attempting to use the same values in flash. i can load the variables in fine but when i try to set them as a hex color it just assumes the letters are hex colors.

any suggestions

Background Color With Color Object?
Hey guys, quick question, is there a way to control the background color of a flash movie using the color object or some other way? i would like the entire window (html background included) to change, so sticking a stage-size movieclip in the back wouldn't help. Thanks .

Changing Instance Colour
How can I change an instance of movie clip without actually changing the movie clip?
...Im sure its very easy if you know how.

Changing Instance Names On The Fly?
Is it possible in Flash 5 to change the name of an instance on the fly?

IE if I have "movie1" and "movie2", how do I change "movielcip1" to be called "movieclip3"

Thanks!

Rubbersharkman

Changing An Instance's Behaviour In AS?
Can this be done? Change an instance's behaviour with code?

Cheers.

Changing Symbol In Instance
I've got a movieclip-symbol (called "white_border") wich has the instance "changer".

When I click on a button I want another movieclip-symbol (called "blue_border") in place of "white_border" to play but still with the same instance.

blue_border has the same hight and weidth as white_border and has to be on the same position as white_border is on the stage.

Can someone help me ? plssssss :$

Changing The Instance Name Of A Movieclip?
hi, everyone. just a little question. how to view and change the instance name of a movieclip in actionscript?

thanks. guys.

Changing Instance Names
How do you change intance names in the middle of a movie? Or can you?

Changing Instance Names
How do you change the instance name of a movieclip with actionscript?
I have been using:
code:
mc1._name = "mc2";

But it doesn't seem to be working, and so I looked up the help document on "_name" and it only mentions it as being used in buttons.
_name (Button._name property)

What is the syntax for changing the instance names of movieclips?

Thanks
Ross

Changing Instance Names
is it possible to change the instance name of a movieclip 'on the fly'?
namely, have something like a button that changed a movieclips instance name? if so, how?

Changing Instance Of A Movieclip
Is it possible to dynamically change an instance of a "on stage" movieclip with actionscript?

eg:
I want to change my movieclip "mcBox" on the stage. The current instance of this movieclip is "box: red". I want to change it for "box: blue" dynamically, an instance from my Library.

If not, the only other way to do it is to hide/unhide movieclips?

Director users:
It's like changing the cast of a sprite on the stage. In director, we would use something like Sprite(1).member("castMember").

Thanks!

Changing Instance Names.
How do i change a instance name that i already set?

Changing Instance Brightness
Ok, don't know how to ask this without sounding like a n00b, so here it goes:

How do you change the brightness of an instance with ActionScript. I mean, what is the name of the command?

Based on the command _alpha and I guessed _brightness but it didn't go blue like it usually does with a valid command. Not sure also where to look in that + menu either, since I always get overwhelmed with the sheer number of choices there.

Please help little Al avoid sounding like a n00b :D

Changing Text On 1 Instance
Hey, I am new to Flash(as in iv'e been doing it for 3 days) and have a very basic question. I have three buttons. Each is an instance of the same button. However, when I go to edit a text field on one of them, it changes all three. Why is this? I thought that instances could have independant characteristics no?

TIA

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