ActionScript 3.0 :: Color Manipulation Class Of A Series Of Objects

May 1, 2009

I am trying to make a class that will allow me to manipulate the color of a series of objects and I�ve gotten this far with ColorMod.as which does this manually. I would like to be able to somehow generate a series of ColorTransform objects such that I can manipulate their parameters (particularly redOffset, greenOffset and blueOffset) while I am generating them, and then push them into an array that can be accessed by another class. I can do this manually as per the code below, but I would like to be able to do it using a for loop as per the pseudocode I put in the constructor below.

[Code]...

View 2 Replies


Similar Posts:


C# :: Collection Of Various Color Matrices For Bitmap Manipulation?

Feb 6, 2011

I've been messing around a bit with some low-level bitmap manipulation and having been creating some various color matrices to apply to bitmap data to add "filters" (for lack of a better term).I have seen a number of tutorials online in C# and AS3 about applying various color matrices to bitmaps, but was curious if anyone simply had a collection of these color matrices that map to specific filter styles (black and white, sepia, etc.).

View 1 Replies

ActionScript 2.0 :: Multiple Sound Objects Manipulation

Aug 24, 2004

i have a problem manipulating multiple sound objects in MX. i have a main background loop object and a button rollover object (which plays on specific buttons). i then have a volume slider which will set the volume of only the main bg loop object. but when i tested it, it seems that the volume of the button rollover object is also the same with the main bg loop object's volume. meaning, if my main bg loop's volume is down to 50, the button rollover sound volume is also 50.

here're my codes:

//code on 1st frame
mainLoop = new Sound();
mainLoop.attachSound("mainLoop");
mainLoop.start();
mainLoop.onSoundComplete = function(){
mainLoop.start();
}

hoverSound = new Sound();
hoverSound.attachSound("hoverSound");


//code on slider MC
onClipEvent(enterFrame){
if(drag){
_root.mainLoop.setVolume(this._x); //this._x is between 0-100
}
}


//code on sample button
on(rollOver){
hoverSound.start();
}


thanks!

View 3 Replies

ActionScript 2.0 :: Multiple Sound Objects Manipulation?

Aug 24, 2004

i have a problem manipulating multiple sound objects in MX. i have a main background loop object and a button rollover object (which plays on specific buttons). i then have a volume slider which will set the volume of only the main bg loop object. but when i tested it, it seems that the volume of the button rollover object is also the same with the main bg loop object's volume. meaning, if my main bg loop's volume is down to 50, the button rollover sound volume is also 50.

here're my codes:
//code on 1st frame
mainLoop = new Sound();
mainLoop.attachSound("mainLoop");

[code]...

View 3 Replies

ActionScript 3.0 :: Layer Manipulation - Game-engine, Which Will Add Objects To Itself As Symbols?

Jul 8, 2009

I'm creating a game-engine, which will add objects to itself as symbols, and I want to be able to choose how they are "layered". For example, say I decide to model things in a type of 3D, and the Z co-ordinate is used for depth (distance from front), how would I translate this into an object 1 unit away rendering in front of an object rendering 2 units away? The engine programming I've done fine in terms of calculating the values etc., as I have a strong javascript background so that was the easy what with actionscript's neat OO syntax, but getting it to do things visually is a bit problematic know, heh. So far all I've really managed is a nice little loading bar, which isn't really that hard =D
 
Also, the symbols I create are actually going to be comprised of multiple parts; a base-layer, a detail-layer, and a colour-layer. What is the easiest way to do this? Ideally I'd create the symbol with multiple layers of its own, and simply toggle the detail and colour-layers on/off as required, and tint the colour-layer independently of the rest of the symbol. Is this possible? Or will I need to use multiple symbols and move them in tandem myself?

View 4 Replies

Flex :: Set Background Color Of Line Series Chart?

Nov 22, 2009

I have a Line Series Chart in Flex with values from 0 to 90. I would like to set the background of the chart in such a way that, 0 - 30 is in green, 31 - 60 is in red and 61 - 90 is in blue.

View 2 Replies

ActionScript 2.0 :: Color Picker And Changer For Series Of Pictures

Dec 18, 2010

"I have a series of pictures, there'll be a color palette by the side of the pictures. A user can select a colour from the palette and the picture will take on that colour".

View 3 Replies

Flex :: Charts - Color Fill In Column Series In Conditional

Jul 8, 2011

I want to create a daily build chart with 1 column as 1 build, 1 build will have 3 series for eg feature 1, feature 2, feature 3. Now i need to fill the color of the series dynamically based on the feature is pass or fail. for eg if in a particular build feature 1: Pass, feature 2: Fail, feature 3:Fail then the color sequence of the column will be green, red, red. how to implement this logic and where? (if in fillfunction)

View 1 Replies

ActionScript 3.0 :: Using One Series Of Conditional Statements For Several Different Objects?

Mar 13, 2012

-Let's say you have several doors on stage for a game.
 
-Each door has the ability to change color.
 
-When any two doors are the same color, a player can move between those two doors.
 
To do this, I use code similar to the following:
   
doorThree.addEventListener(MouseEvent.CLICK,dooraction);
function dooraction(event:MouseEvent){
if ("Blue") {

[Code]....
 
Is there a way to use this one series of If statements for all doors, or must I copy and paste the same instructions for each door instance? In the game I'm planning, each door actually has more than two dozen states, so if I can use just one series of if statements, I'd like to do that.

View 3 Replies

ActionScript 2.0 :: Changing Color Objects - Stay The Same Color That User Selected After Going To Another Scene?

Aug 5, 2004

i'm doing a school project of mine and i am having trouble doing the changing color objects. here is an axample of the script that i;m using:

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

For this script it does change color, but how do i make it to stay the same color that user selected after going to another scene?

View 2 Replies

Flex :: Objects Drawn By Flash Graphics Class Exist As Objects?

Jan 16, 2011

Internally Flash obviously keeps a list of the primitives drawn using Graphics so I wondered if you have many such primitives in a Sprite, can you re-position/remove/alter individual items rather than clear and re-draw everything? Or is this deeper into the bowels of Flash than you're allowed (or recommended) to go?

View 4 Replies

ActionScript 3.0 :: Objects Class Find And Change Another Objects Xy Properties?

Oct 13, 2010

What I have is a game with a Level object, inside the Level is a Player object, and they don't have instance names given, what I'm trying to figure out is how to do is make it so that the player can change the x or y properties of the Level object.
 
To be more precise, I'm making it so that when the player moves in a certain direction, he either moves accross the stage, or he starts moving the Level object around the stage, it'd be in an Event kind of function, now I can easily make the Player move, but I don't know how to make the Level object move which the player is inside of.

View 3 Replies

Creating Loop To Set Color Objects?

May 8, 2009

I'm trying to create a for loop to set the color objects outlineColor1...100 to the value defined in variable _root.outlineCol. Everything works fine when I set the color to these objects via 100 lines of code but I'd like to replace them with a for loop of course. I suspect the syntax in the first part of the second line is incorrect but I'm not sure.

for (var i:Number = 1; i <= 100; i++) {
outlineColor[i].setRGB(_root.outlineCol);
trace(i);
}

View 2 Replies

ActionScript 2.0 :: Change Color Of Api Objects?

Apr 13, 2004

i've got a function (a 'for' loop) that creates 20 movie clips on the fly. in each movie clip i dynamically draw an object with the api tool and all these objects follow a path.

what i want is that when the mouse is in the frame of the piece, i want the colors to change. i'm not sure if i can even do that. i've attached the .as file.

View 10 Replies

ActionScript 2.0 :: Possible To Changing Color Objects?

Aug 5, 2004

i'm doing a school project of mine and i am having trouble doing the changing color objects. here is an axample of the script that i;m using:

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

For this script it does change color, but how do i make it to stay the same color that user selected after going to another scene?

View 2 Replies

ActionScript 3.0 :: Removing Instantiated Objects - VideoPlayer Class From Main Class

Nov 8, 2009

I have question regarding removing instantiated objects. Let's say i have a main class in which i instantiate a custom video player (or whatever) class:

Code:
...
var videoPlayer = new VideoPlayer(...);
addChild(videoPlayer);
...

And inside VideoPlayer class i have of course dozens of objects (movie clips, sprites representing different parts of VideoPlayer) and dozens of event listeners attached to them. My question is, if i want to remove this VideoPlayer class from my main class is it enough to just do:

[Code]...

View 2 Replies

ActionScript 3.0 :: Color Objects Without Instance Names?

Feb 2, 2010

I've got a world map with an instance name of map_mc. Inside map_mc, every country is a movieclip object. So for example, the United States is a movieclip. I'm using the GreenSock tint plugin (TweenPlugin.activate([TintPlugin]) to color transition the countries from white to red.

Here's my goal:

I want to randomly color transition (using Tint) every country from white to red over 20 seconds.

Here's my issue:

Is there a way to do this without having to give each movieclip an instance name, creating an array and randomizing the array. Is there a simple loop I could create that color transitions every movieclip object inside map_mc?

View 2 Replies

ActionScript 2.0 :: Create Color Objects With A For Loop?

Apr 29, 2010

I have this code to change the colors of some movie clips[code]...

Since I have lots of buttons, I wanted to consolidate this code into a For loop.

View 0 Replies

ActionScript 2.0 :: Change A Text Objects Color?

Nov 2, 2006

Is there a way you can change a text objects color with AS? For example Giving the text object the instant name: my text. Then changing the color of that instant name??? The way I have been doing this in the past is by making the text object a movie clip and just making a second key frame with the second color. However this means I now have a lot of movie clips floating around.

View 1 Replies

ActionScript 3.0 :: Shift Color(s) Of All Nested Objects

Apr 28, 2011

Say I have a video tutorial. This tutorial is one MovieClip we'll call oneMC (with text, movieclips, and sprites within it).I have a color picker that allows the viewer to change the background color.Any ideas on how to shift the color(s) of all the nested objects once this happens? I need everything to contrast with the background color. (hence black text wouldn't disappear on a black background).Changing the blend mode of oneMC to Invert. This works except ALL nested clips then have the same color. No good.I changed the .color attribute of oneMC to a tint of the background color's opposite (for anyone curious as to how you get it, subtract the user's selected hexadecimal color from 0xFFFFFF). This is ok, but not ideal. Colors appear washed out.Changing the hue. This works on everything but black objects/text.I don't want to resort to colorTransforming each individual child because the EnterFrame requisite is too cumbersome. I really need an elegant solution to keep processes down.

View 4 Replies

ActionScript 3.0 :: Class Creating Multiple Objects Of Another Class?

Feb 12, 2009

I have a class that represents a turret in the center of my screen.When I hold down SPACE, I want it to create a "bullet"-object that moves in the direction of the turrets cannon, every frame the SPACE key is held down. I am having problems with this cause I am getting this error when I am trying to create the object:

Error #1009: Cannot access a property or method of a null object reference.

This is where the error occurs:

ActionScript Code:
public function chaingun(x_:int, y_:int, rot:int, cd:Number, spd:Number, sprd:Number, life:Number) {
this.Cooldown = cd;
this.Speed = spd;

[code]....

PS: What happens is that when I press the SPACE key, the "turret" class event handler runs the function "Shoot_Chaingun" and that function creates a new Chaingun-object (which actually is a bullet), that inherits the x, y, and rotation of the turret, along with some additional varaibles, including lifetime. Then upon creation, I use "addChild(this)" to add it to the main stage, and "removeChild(this)" once it's lifetime is up.

EDIT: And also, I just realized I don't have a MovieClip linked to this chaingun class. How do I make sure that every time a chaingun object is made, the MovieClip is also loaded?

View 4 Replies

ActionScript 3.0 :: Color Objects That Are Flying Around In Space Game?

Jul 5, 2011

trying to color objects that are flying around in my space game.When I shoot and hit them - the affected enemies shall blink. The graphics are pre-rendered (i.e. there's an rotation array and function where the degrees and their appropriate rotation for the objects are stored / calculated for better performance).

So - my idea was to enhance that rotation function with a functionality for additional coloring; but the colored AND rotated objects shall be stored apart of the normal rotated objects. To accomplish this I made a nested array:in row one there are 360 rotated graphics of one object and in row two there are 360 graphics of a rotated and colored object.

Problem: Coloring works but they are not rotated (always at 0 degrees).

Code:
public function createRotationWithColorBlitArrayFromBD(sourceBitmapData:BitmapData, inc:int, offset:int = 0):Array
{
trace("sourceBitmapData.width=" + sourceBitmapData.width);

[code]....

View 4 Replies

ActionScript 3.0 :: Merge Two Display Objects Using Color From One, Alpha From Other?

Feb 12, 2010

I'm trying to merge two display objects into a single new BitmapData object, when it uses the color from one and the alpha channel from the other. The concept seems straight forward enough but I'm getting lost in the BitmapData APIs. I've been trying to use the Alpha blendmode with draw() but that doesn't seem to work.

View 2 Replies

ActionScript 3.0 :: Color Picker Affects Only Objects With A Certain Name + Only When Double Clicked?

Apr 14, 2011

ActionScript Code:
import fl.controls.ColorPicker;
import fl.events.ColorPickerEvent;
import flash.geom.ColorTransform;

[code]....

I was going to use this code and modify it to work with the previous code.

ActionScript Code:
var OBJECTcolorInfo:ColorTransform = OBJECT.transform.colorTransform;
cpOBJECT.addEventListener(ColorPickerEvent.CHANGE, colorChange);

[code]....

A quick note, the OBJECT is there to show it's supposed to refer back to the "["bg"+String(i)]" bit is. I just don't know how to tell the code to look for it.My main goal is to have an object, for instance a rectangle, be draggable (and placeable). You would then set a series of color pickers to said rectangle, changing areas of it's colors once you double click it.However, the rectangle must move as a whole and not have to have each individual color part be repositioned along with it.

View 1 Replies

ActionScript 3.0 :: Referencing Class Objects From Class?

Jun 19, 2010

I have an enemy on the stage that reads whether it's being hit by a bullet by a hittest. There's a for loop inside the enemy's class that looks for all the bullets and names the bullet that's hitting it "hitBullet". What I'd like to do have an easy way of seeing what type of bullet is hitting the enemy. I'm basically looking for something like

if (hitBullet == RegBullet) {
//do regular bullet dying
}else if (hitBullet == ClusterBullet) {
//do clusterbullet dying
}

, where RegBullet and ClusterBullet are classes. But I have no idea what hitBullet is equal to when a ClusterBullet or RegBullet hits it. I traced hitBullet to see what it would return and got "[object ClusterBullet]", but I'm not sure what that would be in the actual code.

View 2 Replies

ActionScript 2.0 :: Changing Objects - When Move Mouse Over A Colored Box The Movie Clip Changes To The Corresponding Color?

Dec 7, 2004

I have been playing about with the "Changing colors with Actionscript" FLA found on this site. Basically, when you move your mouse over a coloured box the movie clip changes to the corresponding color. This is the AS

[Code]...

View 1 Replies

ActionScript 3.0 :: Buildin Class - DataTable Or Matrix - "xml Class" Cannot Store Objects?

Jan 5, 2010

I have some data (preferably objects, insteads of string) in the flash which I want to store as table format. So that I can query them. It is not datagrid as I do not have to show them. Currently, I am use "xml class" because of the query function. However, "xml class" cannot store objects.

View 1 Replies

ActionScript 2.0 :: File Manipulation With PNG's And JPG's?

Oct 3, 2006

Using AS2 or 3, is there a way to create my own file format? I would like to create a game.And when users play the game, they can create a GAME-SAVE-FILE.So, let's say that player 1 is playing... He get's to level 22 and has to sign off.He clicks save my GAME-SAVE-FILE to my computer.He names the file MyGame and saves it to his desktop.So now on his desktop he has MyGame.gsf. Next time he visits, he can click on UpLoad My Saved Game.He selects his previously saved MyGame.gsf And bammo... all the information was stored in his file and now he can play on.

I need to know how I would put together the format for my own file-type / extension.I need to know how I would access, write, and edit my own file-type / extension.Since Flash can do this type of File Manipulation with PNG's and JPG's.So surely it can be done with any desired custom format.

View 2 Replies

ActionScript 3.0 :: A Color With Decimals Class?

Jul 20, 2009

I have made a class for handling colors with decimals.It's not really impressive i think, but i made it because i needed something like this in my game: in the normal interpolateColor function of Color if you do: color1: 0xFFFFFE color2 0xFFFFFF and progress = 0.8, then the tint will be 0xFFFFFF, whereas with my class it will be 0xFFFFFE, and store a value of 0.8 for blue, so that the next time it is interpolated, that 0.8 will be taken into account.it then only needs a 0.2 to jump to 0xFFFFFF.Look especially at the last function, thats what the class is about.[code]....

View 2 Replies

ActionScript 3.0 :: Why There Is A Color Class In The LiveDocs

Mar 29, 2010

If the old color class was gone, why in the online documentation it is still standing ?http:[url]....What does this class do?

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved