-
Is there some way to create custom color variable?
I'm creating a fairly complex animation frame-by-frame, but I would like to be able to change the color of certain parts of it dynamically. The only approach I can think of is changing each section into a movieclip, putting them all into an array and then looping through the array and assigning a color. However, the animation is long and since the colored shapes constantly change, I would end up with more than a hundred MCs.
A better option, if possible, would be to create a custom variable that I assign as a color in the color picker. So, instead of choosing a value like "#CCCCCC", I would be able to assign a name like "customColor", then I would dynamically change the value of "customColor" in AS3. Is that at all possible? Do you know of any extensions that add that functionallity?
-
I'd love to see that. I remember hearing about it in InDesign CS3 (which I don't have), but I don't believe it's in the other CS3 applications.
-
I've found nothing so far, so I'm considering trying to build my own panel/extension for it. Not sure how hard it would be though...
-
Palindrome emordnilaP
Are you trying to accomplish something like this:
geocities.com/dr_baboom/UniversalTileEditor.html
(click a plus sign in the library panel then select the box next to it to see what I'm talking about)
I did that color box dynamically
-
Hmmm....maybe? I had a bit of trouble figuring out how to work that application, but I think I got the gist of it. What I mean is a bit different - basically I'd like to be able to "paint by numbers".
Let's say I draw/animate a fairly complex scene in Flash and I don't want to cut up each individual color area into movieclips (which is one way to do this). Instead I have a custom panel, but when I am assigning a fill/stroke color, instead of choosing an actual color I can create a new "color variable" or assign a pre-existing one, like "backgroundColor" or "skinTone", etc.
Then in the same panel, I can at any point choose one of the variables and assign it an actual color value - and all the objects with that variable as their stroke/fill will change to the new color.
Finally, I can also dynamically change the value of that variable in AS3 and the color would change at runtime.
-
Basically he wants a color pallet.
-
trace("AKA: Biro Barna");
I found this in the help file of Flash:
PHP Code:
package { import fl.controls.ColorPicker; import fl.controls.ComboBox; import flash.display.BlendMode; import flash.display.Shape; import flash.display.Sprite; import flash.events.*; public class ColorPickerExample extends Sprite { var circle1:Shape; var circle2:Shape; var circle3:Shape; public function ColorPickerExample():void { setupCircles(); setupComboBox(); cp1.addEventListener(Event.RENDER, colorChange); cp2.addEventListener(Event.RENDER, colorChange); cp3.addEventListener(Event.RENDER, colorChange); } private function colorChange(e:Event):void { var cp:ColorPicker = e.target as ColorPicker switch (cp) { case cp1: colorCircle(circle1, cp.selectedColor); break; case cp2: colorCircle(circle2, cp.selectedColor); break; case cp3: colorCircle(circle3, cp.selectedColor); break; default: break; } } private function setupComboBox():void { cb.setSize(150,24); cb.addItem( { label: "Select BlendMode:", data:BlendMode.NORMAL } ); cb.addItem( { label: "DARKEN", data:BlendMode.DARKEN } ); cb.addItem( { label: "DIFFERENCE", data:BlendMode.DIFFERENCE } ); cb.addItem( { label: "HARDLIGHT", data:BlendMode.HARDLIGHT } ); cb.addItem( { label: "INVERT", data:BlendMode.INVERT } ); cb.addItem( { label: "LAYER", data:BlendMode.LAYER } ); cb.addItem( { label: "MULTIPLY", data:BlendMode.MULTIPLY } ); cb.addItem( { label: "SUBTRACT", data:BlendMode.SUBTRACT } ); cb.addEventListener(Event.CHANGE,blendChange); } private function blendChange(e:Event):void { var newBlend:String = cb.selectedItem.data; if (newBlend) { circle1.blendMode = newBlend; circle2.blendMode = newBlend; circle3.blendMode = newBlend; } } private function setupCircles():void { circle1 = new Shape(); circle2 = new Shape(); circle3 = new Shape(); circle1.x = 127; circle1.y = 64; circle2.x = 87; circle2.y = 130; circle3.x = 164; circle3.y = 130; colorCircle(circle1, 0xFF0000); colorCircle(circle2, 0xFF0000); colorCircle(circle3, 0xFF0000); addChild(circle1); addChild(circle2); addChild(circle3); } private function colorCircle(circle:Shape, newColor:uint):void { circle.graphics.clear(); circle.graphics.beginFill(newColor, 1); circle.graphics.drawCircle(0, 0, 50); circle.graphics.endFill(); } } }
It might not be the exact thing but it's a good start and by understanding how this works, the only thing left to do is to define a color palette. Not sure how to take at that one now, but if you sit down and plan a bit, I'm sure you'll find a way.
| Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro | WebLog: http://blog.wisebisoft.com/ |
| Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
| Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/ | By perseverance the snail reached the ark. |
-
Nice, thanks- that gives me a good start with how color is assigned. I'm going to read about custom panel creation and see where I get - I'll post back with any results.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|