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




Inverting The Colors Of Graphics



Is there a simple way through actionscript to invert the colors of everything on the stage?



KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 02-19-2006, 05:49 PM


View Complete Forum Thread with Replies

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

Inverting Colors Of Graphics
Is it possible to invert the colors of a graphic(like, movieclip) using actionscript?

thanks

Inverting Colors.
is there any way to invert colors in flash mx?

Inverting X And Y Values
Hi, I'm making a game (bear with me- this sounds silly) where there's an egg in the centre, and a contaceptive cap spins around the egg. Sperm fly in from the top/bottom/sides and you have to bounce them away with the cap.

I've got the actionscript to work, except for the bit where the sperm actually bounce off. Part of the actionscript of this bit (the sperm) is this:

myRadians = Math.atan2(_root.egg._y-this._y, _root.egg._x-this._x);
myDegrees = Math.round((myRadians*180/Math.PI));
_root.yChange = Math.round(_root.egg._y-this._y);
_root.xChange = Math.round(_root.egg._x-this._x);
if (this.hitTest(_root.cap.hit)) {
_root.cap.play();
_root.xMove *= -1;
_root.yMove *= -1;
} else {
_root.xMove = Math.round(_root.xChange/5);
_root.yMove = Math.round(_root.yChange/5);
}
this._y += _root.yMove/10;
this._x += _root.xMove/10;
this._rotation = myDegrees+90;


The problem here is that the sperm only rebounds when it's actually touching the cap, so therefore instead of being bounced off, it's just kind of 'blocked' by the cap. Is there any way of making it reverse and bounce back?

If you can help, i'll be really really thankful!

Cheers,

Matt!

Inverting Values For Pan Box
I've been on at this all day and I just can't get it. I need some help with my maths. I'm making a photoshop-style zoom/pan navigator for an image gallery. Here's the script I have ....
code:
xInitBar();
xInitSlider();
var zoomUpperLimit:Number = 100;
function xInitBar() {
nMinX = 0;
nMaxX = zoomSlider_mc.bar_mc._width;
}
function xInitSlider() {
zoomSlider_mc.slider_mc.onPress = function() {
initZoom = content_mc._xscale;
this.startDrag(false, nMinX, 0, nMaxX, 0);
this.onMouseMove = function() {
updateAfterEvent();
newZoom = initZoom+(zoomUpperLimit-initZoom)/100*(Math.floor(zoomSlider_mc.slider_mc._x/nMaxX*100));
if (newZoom != nZoom) {
nZoom = newZoom;
xSetZoom(nZoom);
}
};
};
zoomSlider_mc.slider_mc.onRelease = zoomSlider_mc.slider_mc.onReleaseOutside=function () {
this.stopDrag();
delete this.onMouseMove;
};
}
function xSetZoom(zoom) {
content_mc._xscale = content_mc._yscale=zoom;
//pZoom = PAN BOX SCALE FACTOR CALCULATION HERE
nav_drag._xscale = navDragXscale*pZoom;
nav_drag._yscale = navDragYscale*pZoom;
}

My image zoom is working fine. The problem I'm having is getting the scale factor for the pan box (nav_drag). Content_mc is being automatically scaled on image load, so I have to have a different initial value for zoom (initZoom). The navigator area is also being automatically scaled so those initial values (navDragXscale, navDragYscale) are different for each image too. So for example, if an image is automatically scaled to 36% on load, the value for zoom coming into xSetZoom runs from 36 to 100 depending on the slider position. What I need is to convert this so that I have a fraction to multiply the initial pan box scale with. For an image with initial scale (zoom) of 36%, pZoom should be 1 at the beginning (actually it should always be 1 at the beginning), and when the zoom for that image is 100, I expect the pZoom factor should be 0.36?

Please help me with the maths.

thanks
mark
flash8

Inverting Values For Pan Box
I've been on at this all day and I just can't get it. I need some help with my maths. I'm making a photoshop-style zoom/pan navigator for an image gallery. Here's the script I have ....

ActionScript Code:
xInitBar();
xInitSlider();
var zoomUpperLimit:Number = 100;
function xInitBar() {
    nMinX = 0;
    nMaxX = zoomSlider_mc.bar_mc._width;
}
function xInitSlider() {
    zoomSlider_mc.slider_mc.onPress = function() {
        initZoom = content_mc._xscale;
        this.startDrag(false, nMinX, 0, nMaxX, 0);
        this.onMouseMove = function() {
            updateAfterEvent();
            newZoom = initZoom+(zoomUpperLimit-initZoom)/100*(Math.floor(zoomSlider_mc.slider_mc._x/nMaxX*100));
            if (newZoom != nZoom) {
                nZoom = newZoom;
                xSetZoom(nZoom);
            }
        };
    };
    zoomSlider_mc.slider_mc.onRelease = zoomSlider_mc.slider_mc.onReleaseOutside=function () {
        this.stopDrag();
        delete this.onMouseMove;
    };
}
function xSetZoom(zoom) {
    content_mc._xscale = content_mc._yscale=zoom;
    // pZoom =  PAN BOX SCALE FACTOR CALCULATION HERE
    nav_drag._xscale = navDragXscale*pZoom;
    nav_drag._yscale = navDragYscale*pZoom;
}
My image zoom is working fine. The problem I'm having is getting the scale factor for the pan box (nav_drag). Content_mc is being automatically scaled on image load, so I have to have a different initial value for zoom (initZoom). The navigator area is also being automatically scaled so those initial values (navDragXscale, navDragYscale) are different for each image too. So for example, if an image is automatically scaled to 36% on load, the value for zoom coming into xSetZoom runs from 36 to 100 depending on the slider position. What I need is to convert this so that I have a fraction to multiply the initial pan box scale with. For an image with initial scale (zoom) of 36%, pZoom should be 1 at the beginning (actually it should always be 1 at the beginning), and when the zoom for that image is 100, I expect the pZoom factor should be 0.36?

Please help me with the maths.

thanks
mark
flash8

Bitmap Anomalies (inverting)
Hey Guys,

Im sure its been answered before, but got a weird thing happening where dynamicall loaded JPG's are rendering oddly with inverted/yellow colors. Tried saving it as different qualities etc without success.

Any hints?

Cheers.

Mask Is Inverting With Multiple Objects
I have a movie clip being used as a mask, that contains movie clips. each movie clip is an animation of a flower shape expanding. They are supposed to bleed into each other and eventually show an image underneath.

the problem is that for SOME reason, the masks aren't acting additively. They start inverting where they overlap. So where they overlap, the mask is still present.

I have done this bleeding mask effect before and have not had this problem.... is there a way to set the way the mask behaves?? maybe additive/subtractive or something like that?

thanks for the help in advance!

Good Inverting Sprite Algorithm?
Hello,
I 'd like to turn around a sprite object, so I use a new Matrix (-1, 0, 0, 1, sprite.x, sprite.y) to do this.
But by Xscaling -1 it turnalso from the width of the Object.
Explanation : My Sprite is at 0,0 with width of 100. when I use my matrix it's again at pos 0,0, but with width -100.
You can say that it's easy, you just have to add the sprite.width to the sprite.x in the matrix transform, but as my objects are ruled with a Timer object, it'll add 100 at each tick of clock..So the object will move itself at each tick of clock..

Anyone you have a good idea to submit ?..oh, and for some 'technical reasons' the sprites must stay at (0,0) in the librairy and not at (-50,0)..yes it would be too easy

Forgot to tell :
the invert() Matrix method isn't good for me because I don't have a way to tell the x & y coordinates to the function, if I use Invert(), it'll place the sprite at (0,0) on the stage

Inverting Number Values In Action Script
Hello fellow flashers,

I have a slide bar type button that delivers values of -50 to +50 based on an _y position.
I have two line animations that are controlled by the same switch. However, what I want to happen is to have the animations to have an opposite reaction to the slider bar.

The first line animation changes it's _y position based on the slider bar _y position, this works great, no problem.
The second line animation has the same properties and is connected in the same way, what I want to happen is for this animation to invert the input values. (i.e. when line one goes up on the _y position, the second goes down on the _y position.
Here's the line of code in question:

/*this.onEnterFrame = function() {
rspot = _parent.slider_mc.vertFader._y/2;
}*/
the value of the vertFader _y is the -50 to +50
Anyone have any insight, I would be truly greatful for any help here.

Thanks,
Robert

Setting Colors With .setRGB (myColor); What Is The Code To Set The Colors 0xRGBB?
sliderColor = new Color(sliderButton);
trackColor = new Color(track);
arrowColor = new Color(arrows);
sliderColor.setRGB(myColor);
trackColor.setRGB(myColor);
arrowColor.setRGB(myColor);

hmm...i got a scroller that i want to turn white and black
this is what it is set to..
what is the code ? is it hex color code? this is weird

help would be appreciated thanks.

Flash Colors Vs. HTML Colors
I'm having a issue with the colors on a client site we created matching up. I think this is a pretty unique problem. Here is the url: URL I created the flash to appear as if it was under the swoosh, but to give the masking effect of the images are appearing from under the swoosh I had to include part of the swoosh in my flash movie. By doing that I have a color issuse on monitors using 16 bit color. My boss is getting on my case to try and find an answer for this problem and he is the type that doesn't take no for an answer. He wants it fixed and that's the way it is! If anyone could ge me an advice that would be greatly appreciated!

Inverting Color "Dynamically"
I have red image with white text and i want to invert the image with actionScript instead of a motion tween. What should I be looking for and does as1 have this functionality?

Colors In JPG And Colors In Flash
Hi, I recently made a website and I have images that I want to transfer seemlessly from JPG to Flash. My website is http://www.Sergprotector.com/2. However you will notice that the JPGs along the borders are not the same as the flash image. Is there any way I can avoid this? Flash blunder? Thanks

How To Get The Inbetween Colors Between Two Colors?
Howdy...

I was just wondering if anybody know effective ways to get the inbetween values between two color values... I am trying to create a function that changes the backgroundColor of the text field from one color to another, for example...

For example, 0x000000 and 0xFFFFFF... Say I want 4 inbetween colors... Then it will be 0x333333, 0x666666, 0x999999, 0xCCCCCC, right???

What about 0xFF0000 and 0x0000FF??? Or, what about 0x000000 and 0x0000FF??? What would be the logic behind it??? I just can't get my brain working... What would be the logic behind it???

Inverting Colours Or Replacing Colours
is it possible to use AS to replace a certain colour with a another one?

To explain, I have a large number of fla's with text in them, and most of the text is black, but some of it is multi-coloured. I would like to be able to change the background to black and the black text to white, while keeping the coloured text the same. The fla's are pretty complex, with most of the text in movieClips, so to try and select onlt the black text and make it white is way to complex...plus, I want to give the user the option of either black background white text, or white background black text...

SOO,
as per my original question, is there a replace colour function, or any way of making ONLY the black text white?

thnx
irf2k

Help Colors
HI

I'm not too familiar with the swatches that come with Flash, I went to a page on the net where this company took their time to put together a websafe palette organized by colors so is easier for designer to use.

Could you take a look to this page http://www.lynda.com/hex.html and tell me what do you think about this palette.
Tell me if you think is worth to go through all the trouble of adding color by color into a Flash swatch or if is not worth it becuase the web safe color swatch that come with flash 5 are better and if is so witch of the color palette that come witch Flash 5 should I use for the net?.

Thanks

Alex

[Edited by QBA on 10-10-2001 at 03:38 PM]

Colors...
I need help. if anyone knows how to change the color of an object in the middle of a movie, can you please tell me. I'm not sure how to use the color actions...

I'm Seeing Colors
For some reason when I set the RGB of a movie clip to one color in flash and set it to the same value in actionscript (setRGB(0x000066)) the colors don't match. Could someone shed some light on this issue. I thought that maybe flash converts your colors to websafe colors but cannot do the same for colors set by actionscript at runtime but this is really just a wild guess. Thanks in advance.

Colors
Hi
When stack colors (a movie clip on another) the colors don't mix, it is a slight darker. Thing that doesn't happen in flash 5.
Is there any transparency factor that I should rule somwhere.
Please help

BG Colors... Plz Help...
Hey all,
I was just wondering how to set a color for rhe BG of your movie... I use Modify > Movie > Background Color. But from there I can only use a limited amount of colors. I need a color that isn't in the choices so I waas wondering how I could set that up. Any help would be greatly apreciated... Thanks alot... Later

Because I Need The Pic First With The Colors
and after click on the mouse the colors need to be change to only Black & White colors.

To import 2 pics ,one with colors and another without colors it's not good because i have many pics to import.

Thank's

Colors
Dear Flashers
I have 7 buttons with 7 colors, (red, green, yellow,..etc)

and i have a movie clip

i want that when i click the red button the mc should fade to red, then when i click yellow, i want it to fade from red to yellow, then when i click green, it should fade from yellow to green ... etc.

how is that done?
(flash 5)
Thanks

RGB-HSB Colors
Hi,
Is there any method in flash available to convert RGB - HSB color values and Vice versa.

Using Non Web Colors
I was wondering what would happen if I don't use "web colors" for my vector graphic in the flash movies, what would happen if someone's monitor has only 256 colors? Is it up to the internet browser or the monitor, how many colors does the browser contain anyways.

thanks.

Colors
How can I paint a color that gradually shifts into another, like blue to orange?

Colors
How can I get the exact code from each channel (color+offset+alpha) from a object and then assign each code to different variables?
I really really need help to solve this one.

ColorS
Hey hey!!!!!!

Is there a function that returns the color value at a certain coord. ?

I am trying to make a color selector, and the user and just click on the color wheel, and whatever color is under the _xmouse and _ymouse is stored in a variable.

Thanks!

Colors Help
I am making a website for my father's restaurant. I am really really bad with colors. Can someone help with the background color of flash, background color of the html thingy and the text color? I am looking for something green.

Bg Colors In Pop-up
When opening new window with .jpg via Flash button, how to make the background color of that window different and how to make the picture to be centered?

Colors
Ok lets say I have a square divided into four parts. One part is say "0x400320" etc... How can I change that part of the square by identifying what color it is and what to set it to? I cannot seperate it into different mc's either.

Colors
How do you change the transparency of a color?

Colors
What I am about to say may shock you. It's a really really really really REALLY stupid question. You might think I'm retarded for asking it. Maybe I'm just lazy. But I'm asking it anyways.

How do I add color to text. Can I do that? In flash? I'm sure theres a way....I've done it before...Maybe...

Thats right. Told you it was a stupid question.

so..very...dark and..and...noobish...

Hex Colors?
Hey guys!! Its been a while,

Just wondering how to control a MCs color using HTML hex codes....

I have tried loads of methods but havent been able to get em to work!

Cheers

Rob

[F8] Colors Via AS
hi,

i have amovie, and i want it to change collors smoothly, what i have it's a script which is changing the colors, but it changes it emediatly.

how can i delay that?


Code:
myCol = new Color(myMovie);
ra1 = 0;
for (i = 0; i < 255; i++) {
ra1++;
myTransform = {ra: ra1, rb: 20, ga: 100, gb: 245, ba: 12, bb: 90, aa: 40, ab: 70};
myCol.setTransform(myTransform);
}


or maybe there is another way to do it?

No Colors
hey,

ive got a problem; if i make a circle or set a background or whatever, i can not see the chances immidiatly... if i press crtl + enter, i do see the color, but i can not see any color when im editing the flash document

see the example:


the crtl + enter is shown in color, but the place where i edit is without colors :S



anyone knows how to fix this?

Colors From XML
I am creating a shaded map and really don't want to assign colors to each country in longhand. I created a function to color my MCs.

function colorMe(obj:Object, clr:uint):void
{
var colorTransform:ColorTransform = obj.transform.colorTransform;
colorTransform.color = clr;
obj.transform.colorTransform = colorTransform;
} //end function colorMe

I store the needed color in the XML as something like <clr>0XE5ACEA<clr>.

Shouldn't this work:

var b:Number = 0;
function loadXML(e:Event):void
{
var xml = new XML(e.target.data);
var a:Number = xml.country.length();

while (b<a)
{
colorMe(xml.country[b].title,xml.country[b].color);
b = b+1;
} // end while
} // end function colorMe

Instead, I get this error: TypeError: Error #1034: Type Coercion failed: cannot convert XMLList@2ac36821 to flash.geom.ColorTransform.

Colors
how come the colors arent the same as html.

example:

the table color is green.

the .swf is green.

put them together and they don't blend.

why?

Colors While Using TAB
Hello

When i use the tab key to go from one field to a ohter i get a green 'glow' around my selection. the textfield and not arounfd my text that is just plane black. What is going wrong ?
I do not want this glow.

Help With Colors
hey guys
im making a retro theme for my website and i was woundering if you have any ideas on what i should put, and if any of you know some funky color codes that match. plz help

Bad Colors
I'm using hexadecimal color codes (#6699CC) to define the background color of my flash movie, and the background color of the table it sits in.

Even though both hex colors the same, the flash background is slightly lighter in color.

This makes the site look 'less-cool'... anyone know why it does this, and preferably how to fix it?

You can see the site i'm workin on here

thanks

Flash 5 Colors
HI
I need to know how can I created my own color palette in Flash 5. I cleared the default color palette and I want to add my own color one by one, I got the colors numbers codes and the R G B numbers as well, the palette I want to add was put together by a company, is a web safe color palette and is order by Hue, here is if some one want to use it http://www.lynda.com/hexh.html

Can some one tell me please how can I add the each colors into a new flash palette for my self?

thanks

Alex

Websafe Colors
HI

I have 2 questions, the first one is about something that some one posted "I use (1px) background images in stead of background colors, when another color than websafe is needed."

Can you please tell what he means by using 1px image as a background instead of color when he is not using web safe colors?

And the second question is; If make a websafe color lighter or darker stop from being websafe?


Thanks

Alex

[Edited by QBA on 10-12-2001 at 11:04 AM]

Gradiant Colors
haven't been able to find this in my two hundred gigazillion kagillion page flash bible so...

Can you change the colors of gradient fills? or do I have to use psp for that?

Changing Colors?
I've downloaded some samples of text writing from this site, but they're all white letters on a black background. Is there an easy way to inverse this? I want black letters on a white background.

DO I have to change each component and effect? Or is there an easier way to do this?

Also, the sample text writing effect I liked has a font I don't like. Is there an easy way to change the font in these files?

Ok, any help is appreciated, thanks!

Background Colors
How can i allow the user to change background colors as seen on http://www.conkerco.com/. I have searched everywhere

Please Help someone?

Choosing Colors
anyone got a link that chooses contrasting colors for your web page?

Changing Colors Please Help...
I have made a script that should constantly and seamlessly change color of an object. But it does not work as it should. It starts out allright but then it gets into a loop or something and it doesn't at all look good... Anyone know what is wrong with the following script?

--------------------------------------
Frame 1:
//Back is the name of the object
color = new Color(Back);
color.setRGB(random(1677215));
--------------------------------------

--------------------------------------
Frame 2 (Label: One):
//newcolor is a local variable...
newcolor = random(16777215);
--------------------------------------

--------------------------------------
Frame 3 (Label: Two):
if (color.getRGB() < newcolor) {
color.setRGB(get.getRGB()+1);
}
else if (color.getRGB() > newcolor) {
color.setRGB(get.getRGB()-1);
}
else if (color.getRGB() == newcolor) {
gotoAndPlay("One");
}
--------------------------------------

--------------------------------------
Frame 4:
gotoAndPlay("Two");
--------------------------------------

I guess it has something to do with hex and dec values?! Wish one could set formatflags as in C++ ... =)

Gradient Colors?
I've seen many movies that use transparent colors in gradients, but I have no clue how to get these colors. I know how to do Effects>Transparent but how do you make colors themselves transparent? I know there are not Gifs and I just cannot figure how to make them transparent.

Thanks,
John S.

Button Colors
Hi folks:

Is it possible to programmatically change the color of a button? I tried this but it didn't work:

on (release) {

if (areaOverlay == "off") {

buttonName.setRGB(255x666666);
areaOverlay = "on";

} else if (areaOverlay == "on") {

buttonName.setRGB(255xFF0000);
areaOverlay = "off"

}
}

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