Changing MovieClip Colors
I have a simple mc of a rectangle in a library with linkage
that I bring to the stage with an attachMovieClip. I want to change
the fill color of the rectangle. All the examples I have seen look
like you have to draw an object line by line with a beginfill
before the first line and an endfill when your done. Isn't there an
easier way?
I did the setRbg and it worked, but it killed the bevel on
it. No problem, I just broke the mc into two separate mcs and used
a knockout on the bevel, so I didn't have to mess with the bevel
filter programatically. thanks kglad.
Similar Messages
-
Change movieClip color or size based on player score
Hello Everyone,
My students and I worked throught a nice tutorial on a basic pong game that keeps score (http://as3gametuts.com/2011/03/19/pong-1/). But now we are trying to figure out how to modify a movieclip's color and/or size based on the score. This idea was suggested by one of my students, the tutorial does not provide instructions for the color and/or size change so I figured I'd ask for help here.
The symbol we want to change is named "paddle" with the instance name of "playerPaddle" and we want to change it based on the value of a var named "playerScore".
Thanks for your help and have a great day,
ToddNed,
Thanks for the reply.
I want to reduce the playerPaddle by 20% when the playerScore reaches 5.
also
I want to change the playerPaddle color to red when the playerScore reaches 2.
Thanks again for your help,
Todd
var ballSpeedX:int = -3;
var ballSpeedY:int = -2;
var cpuPaddleSpeed:int = 3;
var playerScore:int = 0;
var cpuScore:int = 0;
init();
function init():void
stage.addEventListener(Event.ENTER_FRAME, loop);
function calculateBallAngle(paddleY:Number, ballY:Number):Number
var ySpeed:Number = 5 * ( (ballY-paddleY) / 25 );
trace(ySpeed);
return ySpeed;
function updateTextFields():void
playerScoreText.text = ("Player Score: " + playerScore);
cpuScoreText.text = ("CPU Score: " + cpuScore);
function loop(e:Event):void
if( playerPaddle.hitTestObject(ball) == true ){
if(ballSpeedX < 0){
ballSpeedX *= -1;
ballSpeedY = calculateBallAngle(playerPaddle.y, ball.y);
} else if(cpuPaddle.hitTestObject(ball) == true ){
if(ballSpeedX > 0){
ballSpeedX *= -1;
ballSpeedY = calculateBallAngle(cpuPaddle.y, ball.y);
if(cpuPaddle.y < ball.y - 10){
cpuPaddle.y += cpuPaddleSpeed;
} else if(cpuPaddle.y > ball.y + 10){
cpuPaddle.y -= cpuPaddleSpeed;
playerPaddle.y = mouseY;
//check if top of paddle is above top of screen
if(playerPaddle.y - playerPaddle.height/2 < 0){
playerPaddle.y = playerPaddle.height/2;
//check if bottom of paddle is below bottom of screen
} else if(playerPaddle.y + playerPaddle.height/2 > stage.stageHeight){
playerPaddle.y = stage.stageHeight - playerPaddle.height/2;
ball.x += ballSpeedX;
ball.y += ballSpeedY;
//because the ball's position is measured by where its CENTER is...
//...we need add or subtract half of its width or height to see if that SIDE is hitting a wall
//first check the left and right boundaries
if(ball.x <= ball.width/2){ //check if the x position of the left side of the ball is less than or equal to the left side of the screen, which would be 0
ball.x = ball.width/2; //then set the ball's x position to that point, in case it already moved off the screen
ballSpeedX *= -1; //and multiply the ball's x speed by -1, which will make it move right instead of left
cpuScore++; //increase cpuScore by 1
updateTextFields();
} else if(ball.x >= stage.stageWidth-ball.width/2){ //check to see if the x position of it's right side is greater than or equal to the right side of the screen, which would be 550
ball.x = stage.stageWidth-ball.width/2; //and set the x position to that, in case it already moved too far of the right side of the screen
ballSpeedX *= -1; //multiply the x speed by -1 so that the ball is now moving left
playerScore++; //increase playerScore by 1
updateTextFields();
//now we do the same with the top and bottom of the screen
if(ball.y <= ball.height/2){ //if the y position of the top of the ball is less than or equal to the top of the screen
ball.y = ball.height/2; //like we did before, set it to that y position...
ballSpeedY *= -1; //...and reverse its y speed so that it is now going down instead of up
} else if(ball.y >= stage.stageHeight-ball.height/2){ //if the bottom of the ball is lower than the bottom of the screen
ball.y = stage.stageHeight-ball.height/2; //reposition it
ballSpeedY *= -1; //and reverse its y speec so that it is moving up now -
Hi.. How r u all..?
I'm doing a small program to change the color of those sections of an image which are having the same color, according to the color selected from the colorpicker..
Say we have selected a color from the colorpicker, and then the mouseclick event on the image changes the color of those parts in the image which are having the same color as the clicked portion (or pixel) to the selected color.. If we've selected FF0000 from the colorpicker, then clicked on 3300CC coloured pixel in the image. This should change the color of all the 3300CC coloured pixels in the image..
I've a colorpicker [colpickr] and a movieclip [mc] of the image on the stage. I created a bitmap of that same same image (imag1) using code. Selecting the color from the colorpicker and a mouse click on the movieclip (here I used getPixel) will change that color in the bitmap to the selected color (with setPixel). So here I've two images; one is a movieclip (inorder to add listener for click event) and one is a bitmap (inorder to set the property setPixel). But I need only a single image.
Please help me regarding this.. Given below is my (horrible) code..
import flash.events.MouseEvent;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.net.URLRequest;
import flash.display.Loader;
var c = 0;
var myBitmapData:BitmapData;
var bm:Bitmap;
colpickr.selectedColor = 0xffffff;
var preLoader;
var urlReq;
var preloader_img:MovieClip;
preLoader =new Loader();
preLoader.unloadAndStop();
urlReq = new URLRequest("imag1.jpg"); // i've selected the same image as that of movieclip mc
preLoader.load(urlReq);
preLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,preLoaderComplete);
//creates a bitmap image of mc..
function preLoaderComplete(loadEvent:Event) {
myBitmapData = new BitmapData(mc.width,mc.height);
myBitmapData.draw(mc);
bm = new Bitmap(myBitmapData);
addChild(bm);
bm.width = mc.width;
bm.height = mc.height;
mc.addEventListener(MouseEvent.CLICK, _onMouseClick);
//gets the color of mc and sets the color to bitmap
function _onMouseClick(event:MouseEvent):void {
var myColor:uint = myBitmapData.getPixel(mc.mouseX,mc.mouseY);
c = myColor.toString(16);
for (var i=0; i<bm.width; i++) {
for (var j=0; j<bm.height; j++) {
if (myBitmapData.getPixel(i,j).toString(16) == c) {
myBitmapData.setPixel(i,j,colpickr.selectedColor);try this:
import flash.events.MouseEvent;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.net.URLRequest;
import flash.display.Loader;
var c=0;
var myBitmapData:BitmapData;
var bm:Bitmap;
colpickr.selectedColor=0xffffff;
var preLoader;
var urlReq;
var preloader_img:MovieClip;
preLoader =new Loader();
preLoader.unloadAndStop();
urlReq=new URLRequest("z_bitmaps/image1.jpg");// i've selected the same image as that of movieclip mc
preLoader.load(urlReq);
preLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,preLoaderComplete);
//creates a bitmap image of mc..;
function preLoaderComplete(loadEvent:Event) {
bm = Bitmap(loadEvent.target.loader.content);
addChild(bm);
stage.addEventListener(MouseEvent.CLICK, f);
function f(e:MouseEvent):void{
if(bm.hitTestPoint(mouseX,mouseY) && !colpickr.hitTestPoint(mouseX,mouseY)){
_onMouseClick(e);
//gets the color of mc and sets the color to bitmap
function _onMouseClick(event:MouseEvent):void {
c=bm.bitmapData.getPixel(bm.mouseX,bm.mouseY);
for (var i=0; i<bm.width; i++) {
for (var j=0; j<bm.height; j++) {
if (bm.bitmapData.getPixel(i,j)==c) {
bm.bitmapData.setPixel(i,j,colpickr.selectedColor); -
Hello,
I am building a Smile Face application.
Where you choose a menu item and an object or "movieclip" is
placed on the stage. You can drag and drop the object, take it to
the trash and change the color on any of the objects on the stage
at any time.
I have 2 problems that I am looking for guidance on.
1. The code I use to change the color of the object is bulky.
As it is, depending upon the amount of objects you have in
the menu,
the code could grow to a painful amount making it difficult
to manage.
I am looking for a way to better my existing code, by
upgrading it to a more advanced method.
I have attached my code here.
If anyone could help steer me in the right direction, I would
appreciate it.
Thanks,
MatthewThanks for the answer Rob.
It works perfect.
I apologize for my last tread not making much sense.
I have one question, that I would like to find the answer to.
Is there anyway to create this function.
for (j in partsList) {
partsList[j].onPress = choosePart;
Without it being an onPress, onRelease, onRollOver or
onRollOut function?
I ask, because I am incorporating
the "GreenSock transform manager"
which is already using the onPress and onRelease function for
the partsList.
http://blog.greensock.com/transformmanageras2/)
Hope that makes sense,
Thanks. -
Can I change the color of an image to a specific color code?
Since I was unable to do this in Photoshop, I was wondering if there was a way in Flash to simply change the color of an image to a speciifc color code. The image is more or less a simple line with rounded corners. It is only composed of 1 color. Does anyone know if it can be done with Flash?
Shouldn't be a problem to do it in Photoshop or Flash. Since you couldn't do it in PS, I'm guessing that there is more to it than you are making obvious here.
But in Flash you would import it, make it into a movieclip or graphic. Then apply a tint from the color effect portion of the properties panel. -
I can't change property Color of the component Movie Clip in my program? Compiler didn't found the error but when my program run color Movie Clip doesn't change. Help me, please
if you have a movieclip with instance name or reference name mc, use:
var ct:ColorTransform = mc.transform.colorTransform;
ct.color = 0x9999cc;
mc.transform.colorTransform = ct -
My Excel with PowerPivots acts weird, it hangs when i try to change font color
Hi
I am facing a weird issue using PowerPivot in my workbook, there is a worksheet named Charts in my workbook and all the charts i am using resides in that worksheet. Whenever i try to change the font color in that sheet, my excel's color palette goes blur
and then everything just freezes and turns black. This problem is happening only with Charts worksheet, when i try to change the color in other sheets, it works just, the problem is only with Charts sheet. File
size is 16 MB, there are just 10 pivot tables with some calculations and some calculated fields. There are no add-ins other than PowerPivot.
Thanks,
ShankerHi,
In regarding of the issue, please provide us more information to assist you better.
Do you receive any error message?
Which Excel version are you using? Excel 2013 or other?
Which workbook format are you using? XLS or XLSX?
Are you performing any specific task?
According to your description, this issue seems only occur with the special worksheet "Charts".
Firstly, I recommend we copy all of the content to a new/blank Excel file to test.
If it works fine, this issue might be caused by the "Charts" workbook itself. We'd better check the "Charts" workbook. Or re-build the file with a new workbook.
If it still makes Excel hang with a new file, this issue might due to the content. Please check the content first.
Secondly, we could follow below KB to troubleshoot this issue:
https://support2.microsoft.com/kb/2758592/en-us?wa=wsignin1.0
Thirdly, if the issue still exists, we may try to collect the Event log and App crash dump file to do advanced troubleshooting.
Event log:
http://windows.microsoft.com/en-US/windows7/Open-Event-Viewer
App crash dump file:
First enable app crash dump collection by copying following words into notepad, saving it as dump.reg and importing
it:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\localdumps\EXCEL.EXE]
"DumpFolder"=hex(2):63,00,3a,00,5c,00,63,00,72,00,61,00,73,00,68,00,64,00,75,\
00,6d,00,70,00,73,00,00,00
"DumpCount"=dword:00000010
"DumpType"=dword:00000001
"CustomDumpFlags"=dword:00000000
Then, open Excel
to repro the issue. If crash issue appeared, please find the crashdump file under c:\.
To further help you, please upload this file into Skydrive and shared the link here.
Also, you can try to analyze dump by yourself if you would like to:
How to analyze app crash dump file:
http://blogs.technet.com/b/askperf/archive/2007/05/29/basic-debugging-of-an-application-crash.aspx
Hope it's helpful.
Regards,
George Zhao
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. -
Change the color of the outer line of a shape
Hello I'm trying to create a rectangle with a red border and no inside fill. It's only to highlight some text of a bank form.
I know i have to right click the layer and choose blending options and stroke. But I've tried to change the color so many times and no matter what I do, the outer line remains gray and with rounded corners.
I want the corners of the rectangle to be squared, not rounded but I'm having a hard time changing this.
Please help
I'm using Photoshop CS3
thank you
Could anyone please show a picture of where to change the color of the outer line? I've tried everything.Hi,
With Ps CS3, you'll probably want to define a Layer Style for a Stroke and then use that with the Square Shape Layers.
This is a Stroke of 4 px, 'Centered' (so a very slight corner rounding on the outside edge. 'Inside' will give you square corners for both inside and outside edges). To change the color of the stroke, go to Layer> Layer Style> Stroke and change the color by clicking on the color bar.
regards,
steve -
Unable to change text color (from Black)
For the next person who blunders into this and searches for an answer...
If you have a Condition Code whose decoration is a custom color, and you delete the color, the text goes to Black, and you cannot change the color of text bearing that CC - with local color override, or a Character Format that applies a color (I didn't try Paragraph format).
I am copying formatted content in from an older document that doesn't conform to current templates. I had deleted unused colors in the source, but not unused Condition Codes, one of which rode in with some text. What was controlled by the CC in the old doc is now controlled by a color Character format, except that when applied, the text stayed stubornly black (until I nuked the CC).Dear FrameMaker 7.1/Unix user,
This does not surprise me. As long as the condition is applied and "Show Condition Formats" is active FrameMaker will show the Condition Color (now: Black) and not any underlying text colors.
- Michael -
When I receive, reply or compose email. I no longer am able to see or change the color of text. I select to change the text from black to Red (or any other color) and the text just stays black, The color seletor box will show the last select color, but never actually changes the text color in an email. Also in received email, when the sender has indicated their replies to me are in another color, All the text only appears as black. I never had this problem in the past, not sure what has happened. I did restart Thunderbird with add-ons disabled and this did not change the problem.
Hello, maybe the question need to move by a moderator to thunderbird support ?
https://support.mozilla.org/en-US/questions/thunderbird?owner=all
thank you
[moderator note: question thread has been moved from Firefox queue to Thunderbird queue] -
Why am I unable to change text color from black in LR5 book module?
Why am I unable to change text color from black in LR5 Book Module?
I'm assuming you clicked on the color patch besides the word <Character> to open the color picker window.
At the right side of this window there is a vertical bar that has 2 horizontal black lines at the bottom.
This is actually a slider. Pull it upwards with the color picker and color will appear in the window. -
Hello Everyone,
I am working with the Green Grocery Newsletter Template, and I am trying to substitute the text. As an example of my issue, when I highlight the title text and start typing, it turns blue, even though the text color box still shows green. Actually, any text I try to replace turns blue! If I try to change the color of my blue text, the text color box shows the new color, but the text on the template is of course, still blue.
Please help:)! So frustrated and on a deadline.
Thank you:)!
KindraJust wondering, when you pull up the inspector, is the writing that is coming up blue a hyperlink (when you click on it, will it take you to a web page or an e-mail)?
-
How to change text color in CS4
Hey everyone. I know I'm not fluent in Dreamweaver, but had DW8 before upgrading to CS4 and I'm pretty handy with it. In version 8, if I wanted to change a text color, I simply highlighted the text and picked a color. No worries.
However in CS4, I seem to be only have that ability in my CSS properties, (not HTML properties). Then when I try to change the color, it gives me a dialogue box asking questions such as "new CSS", "for this page only", etc. and I don't understand what I'm supposed to do.
Can someone tell me in a user-friendly way (step-by-step), how to simply change a text color on a page? I went to the help topics and it said to use the 'color-picker', but that takes me back to my original problem.
I'm either doing something terribly wrong, or ADOBE has made a simple task into brain surgery!
Thanks in advance for assistance!
MarkBeginning with CS3, DW became more compliant with W3C web standards which call for content (HTML) being separate from style (CSS). Thus you now have two properties boxes: one for HTML content and another for CSS styles.
Create a few CSS classes using the CSS style panel.
CSS:
.red {color: red}
.blue {color: blue}
.green {color: green}
Highlight a word or sentence on your page and apply the appropriate class to your HTML.
HTML:
<p class="red"> this is red text</p>
<p class="blue"> this is blue text with <span class="green">GREEN WORDS</span> in the middle</p>
Nancy O.
Alt-Web Design & Publishing
Web | Graphics | Print | Media Specialists
http://alt-web.com/
http://twitter.com/altweb
http://alt-web.blogspot.com -
No longer have a question about editing the Bookmarks Toolbar. I may be dense, but I have not discovered how I may change the text (font) color when using View, Bookmarks, Custom. I see the capability to choose to use text and image, but not to change the color of the text. The ability to "bold" the text would probably be sufficient. I will revisit the Getting Started page and select other background colors to try and alleviate the problem. Persona or thema colors conflict with black text (for my older eyes - I have a vision problem.).
You can make such a change with code in userChrome.css
Add code to [http://kb.mozillazine.org/UserChrome.css userChrome.css] below the @namespace line.<br />
See http://kb.mozillazine.org/Editing_configuration#How_to_edit_configuration_files
<pre><nowiki>@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
#personal-bookmarks .toolbarbutton-text {
color: black !important;
background-color: -moz-dialog !important;
font-size: 11pt !important;
font-weight: bold;
</nowiki></pre>
You can adjust the values or leave out things that you do not want to change. -
How to change the color in "blocks" effect
Hi,
I've got a problem with Motion.
I use a "behaviour" effect on my text that is called "blocks".
When I set parameters to default, I see a blue effect with some red blocks in backgroud.
I want to turn this effect into a green effect.
The problem is that when I change the color into green, there is still a strange orange color on some blocks.
I've added all the color parameters (face, shadow...)that I thought it could be due to but nothing changes. I still have this strange color on some blocks.
The strangest thing is that it sometimes becomes ok when I make the changes but when I save and re-open my file in FCP or Motion, it isn't ok.
Has anyone already used this effect and seen that problem?
Thanks for your help...
Sand
Mac OS X (10.4)
Mac OS X (10.4)Text behaviors work by sequencing the Text's parameters.
Try changing the color of your text's outline.
Select the Text tab in the Inspector
Go to the Style sub tab
change the Outline color to green
Hope that helps.
Maybe you are looking for
-
Hi, I have performed test upgrade from 11.5.10.2 to 12.1.1.It was successful. The American English Upgrade patch driver had taken 20 hours time to complete. Now i am doing a second test run by following the same steps, but now the same patch is takin
-
Burning a MUSIC DVD Possible?
Is is possible in iTunes to burn a MUSIC DVD that will play in any DVD Player? Burning a MUSIC CD works fine but I would like to use a DVD because of the greater capacity. The only instructions I've found are how to burn a DATA DVD - for back-up I gu
-
Add Material No. and Serial No. to Component of IBase and also add warranty
Hi Gurus, Can any of you tell me how to add a "Material No." and "Serial No." to the component of an IBase and also add warranty to this component. It is manually done through IB52 by changing the values on-screen for the components attached to the I
-
Hello, I have the opportunity to purchase an iPhone5 neverlocked from Dubai. I am living in Romania and I want to use my iPhone in to the Orange GSM network. The GSM frequencies are: 2G > 900, 1800; 3G > 2100! Is the iPhone5 purchased from EAU workin
-
Updating application to use Application.cfc
I have an application that is using the older style application.cfm for setting up configuration varibles like DSN and what not. Of course this way i can just use the varibles as is like #dsn#. I am wanting to change my application over to utilize Ap