Changing color of an object on stage during runtime? in Flash CS4 (AS3)

Hi,
I was wondering if there is a way to change the color of an object during runtime. any ideas?
Thank you for helping.

you can use the colortransform property of your objects transform property.  so, if you have a displayobject mc, you can use:
var t:Transform = mc.transform
var ct:ColorTransform = t.colorTransform;
ct.color = 0xff0000;
mc.transform.colorTransform = ct;

Similar Messages

  • Stage dimensions(size) in Flash CS4 (AS3)

    Hi again,
    I need to know how to get the dimensions of my stage (x,y), BUT only the stage and not all the objects that might continue off the stage included.
    For example :
         My stage is 400 x 550.
         I want to get 400 and 550 returned.
    Thank you for any help and tips!

    You can use:
    var nW:Number = stage.stageWidth;
    var nH:Number = stage.stageHeight;

  • Can I change color of all objects at ones ?

    Hello guys
    I understand that's very fundamental question, and I promise I search the forum prior to posting, but perhaps it's my bad english and wrong phrasing, that leads to poor results. So if that has been discuss, please kindly don't waste your time, just link me to the post and I will read away.
    I have very complex file, with hundreds of paths, shapes, text, outlined text,  etc... It's a brochure with graphs, scematich drawings and text.
    Last moment, the client like the reverse the colors from (current) Black on white, to all White on dark gray background.
    Problem is, I can't seem to find easy way to just change the colors, without selecting one by one, every single object. When I selest all and choose white, it start filling paths with solid fill... Editing it wastes allot of my time and I have many pages to do.
    Is there any way to simple change color of everything at once, just from black to white ? Or do I have to go object by object manually ?
    Thank you very much, for all the help so far, and I'm sincerly sorry to waste your time if that has been covered previously.
    Good day
    ciao ciao
    Monika

    Thank you both for such prompt follow up. I know it's just typing and it's easy but I sincerly mean it. Thank you.
    The INVERT work on some images.
    The "SAME" seem to work funny way. When I select STROKE COLOR, it does nothing, but when I select WIGHT then it does and in fact I'm able to change lots of strokes at once with ease. Even tho I'm left with few small bits here and there which I need to change manually, it is certainly far better than doing one by one.
    Thanks a lot for the help, it's what I was looking for.
    By the way   I not once used the SAME menu. Feel so lame, given I use AI (not daily but often) for few years now... Shame.
    Thank you and you guys have a great day
    xoxo

  • Change color randomly of object

    Hi,
    I wrote a small application simulating a road traffic. I am using threads to do the animation.
    this is the code:
    public class TestProject extends Frame implements Runnable
       public static int frame;   // int variable for frame (animation)
        int delay = 100;    // delay for animation
        Thread animator, light;    // thread name
         * Create a thread and start it.
        public void start()
            animator = new Thread(this);    // create new thread
            animator.start();               // start thread
         * This method is called by the thread that was created in
         * the start method. It does the main animation.
        public void run()
            // Remember the starting time
            long tm = System.currentTimeMillis();   // get time (ms) and store it in tm
            while (Thread.currentThread() == animator)
                // Display the next frame of animation.
                if (frame==(200*roadArrangement.size()+50)) // if object reaches "end" reset
                    frame =-50; // "reset" frame
                repaint();  // repaint object
                // Delay depending on how far we are behind.
                try
                    tm += delay;    // delay
                    Thread.sleep(Math.max(0, tm - System.currentTimeMillis()));
                catch (InterruptedException e) // catch exception for thread
                    System.out.println("error in thread interrupt!");
                    break;
                frame++;    // Advance the frame
        } // end of run
         * Set the animator variable to null so that the
         * thread will exit before displaying the next frame.
        public void stop()
            animator = null;
         * Paint a frame of animation.
        public void paint(Graphics g)
            for(int i = 0; i < roadArrangement.size(); i++)
                String tempType = roadArrangement.elementAt(i).toString();
                char roadType = tempType.charAt(0);
                g.setColor(Color.darkGray);
                if(roadType == 'r')
                    g.setColor(Color.darkGray);
                    g.fill3DRect(10+(i*210),100,210,60,true);
                else if(roadType == 'j')
                    g.setColor(Color.darkGray);
                    g.fill3DRect(10+(i*210),100,210,60,true);
                    g.fill3DRect(85+(i*210),160,60,70,true);
                    g.fill3DRect(85+(i*210),30,60,70,true);
                    g.setColor(Color.green); // traffic light color
                    g.fillOval(10+(i*210)+50,30+100,10,10); // traffic light
                    Color clr = g.getColor();
                    int red = clr.getRed();
                    if((frame == (10+(i*210)+50))&&(red==255))
                        stop(); // stop thread to stop cars
                        System.out.println("STOP");  
    }In the code I have "oval" traffic lights where I set the colours.
    Now, what I want to do is that traffic lights change independently and randomly their colour so that cars stop and drive.
    How can I do this? Will I need a second thread? If yes, how to implement that?
    thanks in advance.

    Use [url http://java.sun.com/j2se/1.5.0/docs/api/java/util/Random.html]Random class and call nextInt every time in paint method than match a color to the int you get back.

  • I cannot change color of vector object

    I bought an image from shutterstocks... But when I change a colour, it all turns in monochrome colour. My Ai (CS6) knowledge is very limited, so I do not know what to Google "How to..."
    I would say that in a moment I change colour Ai understands that I colour in borders and all lines overlaps each other... However, I do not colour borders...
    Image is very complex pattern and I believe it is somehow related with image production... The image does not appear as it looks like - everything is over layered with cut-outs of object above... But it is beyond my knowledge...
    I have tried to ungroup but with same results...
    Could you please explain how to manipulate this image? Thank you!

    If this helps, here is a print screan as I cannot uploud real image... This image consists of 1 layer that is divided in thons of paths and some Compound Paths...
    Thanks a lot!

  • Change Color of Line Object

    aLine.border.edge.color.value
    ="207,29,3";
    This doesnt work.. any suggestions?

    One last thing.
    On Initialize of the Parent Subform a Table belongs in I change the Header Fill color based on a variable.  Other instances of this Table gets added with a button click.. everything works find interms of the add.
    When I change the color though the new tables added do not take the new color of the initialize event.
    Is there a way I can do it on the add event?
    this.parent.instanceManager.addInstance(1);
    this.parent.instanceIndex< ??? >.execInitialize();

  • Changing color in JTable objects

    Hi all,
    I'm writing an application which shows tabular view of events of some outcome. Now I want to give color to each row depending on the severity of particular parameters in the table. I've written application using swings and using components JTable. Is there any way to give color to each depending on value so that I can give colors to each row Red, Blue and Green like that and all
    Waiting for your precious replies,
    With best regards,
    harry_sai

    Yes, you use a TableCellRenderer. Rather than explain further I'll just refer you to the tutorial about JTable.

  • Is it possible to change fps during runtime? in Flash CS4 (AS3)

    hi,
    I was wondering if there is a way to change fps(Frames Per Second) during run time using AS3.
    is there? if so is it recommended? or is there a way to slow down the execution of the code(like adding a pause?)
    Thank you for attributing anything related!

    You can use the stage.frameRate property to eadr or set the fps rate during run time.  The only way to really pause code from executing is to build the paused code into a function and delay calling that function using some form of a timer (like setTimeout).

  • Problem removing Objects from the stage in Flash CS4 (AS3.0)

    I have a problem with this code:
    this.addEventListener(Event.ENTER_FRAME, vanish);
    function vanish(event:Event):void{
         if(character_mc.hitTestObject(vanish_mc)){
              vanish_mc.parent.removeChild(vanish_mc);
    There are two overlapping objects on my stage: character_mc and vanish_mc.
    As soon as i start the scene[Ctrl+Enter] vanish_mc is VISUALLY removed. But the code still sees a collision somehow. How can i Entirely remove the object vanish_mc?
    Thank you for help and advice.

    Ah I think the problem is what my problem not which I proposed, my bad I was trying to keep it simple.
    the remove code in my problem actually looks like this:
    if(character_mc.hitTestObject(this["dollar_mc_"+String(i)])){
         removeChild(this["dollar_mc_"+String(i)]);
    I wanted it to be that way so I could add infinite "dollar_mc_" ' s without writing myself to death with code and or getting confused.
    Imagine it like a game where a character it picking up dollars, which would disappear once they intersect.
    And that exactly is what gives me that argument.
    Do you know a way i could write this code, or do you suggest to leave it that way...because it does run and work im just getting this argument while debugging.
    Thank you for all the help~

  • Make an object vanish in Flash CS4 (AS3.0)

    I have a question on how i can remove an object when two objects hit.
    I have two objects on the stage overlapping.
    object #1 = character_mc
    object #2 = vanish_mc
    I want to make it so that the object #2 (vanish_mc) will vanish once i run it.
    I have this code:
    this.addEventListener(Event.ENTER_FRAME, vanish);
    function vanish(event:Event):void{
         if(character_mc.hitTestObject(vanish_mc)){
              // here the code to remove vanish_mc from the stage
    ~ Thank you for help and advice ~

    you can always use:
    vanish_mc.parent.removeChild(vanish_mc);
    to remove vanish_mc from the display list.
    but, you'll need to stop all streams in vanish_mc, if there are any.  and, if you're not going to use vanish_mc anymore, you should ready it for gc.

  • How do I test if an object exists? in Flash CS4(AS3.0)

    I am trying to test if an object with an instance name of "test_mc" exists.
    How would i write the code with an if statement, i have no idear?
    ~Thank you for help tips and advice.

    Hello,
    using SPSiteDataquey, you are able to query multiple lists. if your column is only on those list, you just need to query the items and see if you get 2 elements on return.
    more info there :http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsitedataquery.aspx
    Best regards, Christopher.
    Blog |
    Mail
    Please remember to click "Mark As Answer" if a post solves your problem or
    "Vote As Helpful" if it was useful.
    Why mark as answer?

  • Is it possible to add/change a ViewContainerUIElement during runtime?

    Hi all,
    i want to add/change the content of a ViewContainerUIElement (VCUI) during runtime, but it doesn't work as expected (or hoped;). What i got working so far for an <b>already exising</b> VCUI is:
    1. Find the IWDViewContainerInfo for the VCUI
    2. If no default view usage exists, create an embedded view usage and set is as default.
    3. Set the component usage to the IWDComponentUsageInfo requested.
    4. Set the view to the IWDViewUsageInfo of the interface view, which should be the content of the VCUI.
    This doesn't work, if it's done after the wdDoInit()s of the controller hierarchy has been processed. The component, which is represented by the usage, is deleted and recreated, but the visual representation doesn't get updated (e.g. no changes on the display) if it's done in an action handler for example. Why? If i change the component usage (cloned component usage) nothing happens too.
    Even more problems arise, if i try to add a new VCUI. The steps are pretty the same as before, what is done additionally (and prior the steps above) is:
    1. Creating a IWDViewContainerInfo from the IWDViewInfo of the "parent" view.
    2. Creating a IWDViewContainerAssignmentInfo from the view usage of the "parent" view
    3. Setting the created IWDViewContainerInfo as view container in the assignment.
    4. Create the VCUI, set the view container name to the name of the created IWDViewContainerInfo and add the VCUI to an arbitrary container in the parent view.
    But this doesn't work, i'm getting:
    java.lang.NullPointerException
         at com.sap.tc.webdynpro.clientimpl.html.uielib.standard.uradapter.ViewContainerUIElementAdapter.getContent(ViewContainerUIElementAdapter.java:98)
    What is wrong? What am i missing?
    Thanks in advance.
    Stefan

    Hi,
    I had the same problem with
    "java.lang.NullPointerException at com.sap.tc.webdynpro.clientimpl.html.uielib.standard.uradapter.ViewContainerUIElementAdapter.getContent(ViewContainerUIElementAdapter.java:98)"
    when I included ViewUsages dynamically in an action handler (outside wdDoInit()).
    The code below fixed that problem.
    This code creates a new OutboundPlug for the embedding view with the embedded view as target and fires the plug.
    <i>// Create OutboundPlug
    IWDOutboundPlugInfo outboundPlug = embedderViewInfo.createOutboundPlug();
    //Create navigation link
    rootViewUsage.createNavigationTarget(outboundPlug.getName(), interfaceViewUsage, "Default");
    // fire navigation link
    wdThis.wdGetAPI().firePlug(outboundPlug, Collections.EMPTY_MAP);
    </i>
    I hope I could help you. Probably you don't need the information anymore, but perhaps anybody else has the same problem.
    Regards, Alex

  • Change Form Size during runtime

    Could someone tell me how to change the size of my VI form during runtime?
    I want the ability to click a button and have the height increase by 50 points or so, then go back to the original value after I click the button again.
    Thanks for the help!
    Angus Cattle from Pool Ranch and Steel Repairs via Joe's Welding.

    Ok, that got me on the right track.
    For some reason, though, my VI still does not change whenever I click the button.
    I have attached my VI, saved in 8.2 format.
    Does anyone see why my form doesn't grow by "98" whenever I click the "More >>" button?
    Angus Cattle from Pool Ranch and Steel Repairs via Joe's Welding.
    Attachments:
    Event Notifications.vi ‏44 KB

  • How do I Batch change color profiles in CS4?

    I need to change color profiles on hundreds of photos at a time. CS4 does not give me that option it seems, only lame options i'll never use

    Probably easiest would be recording an Action of a conversion and running that with File – Scripts – Image Processor; Batch or Droplets are other ways of using an Action.
    Scripting would be another option.
    Which options exactly do You mean with »lame options«?

  • Change SubScreen sizes during runtime

    Hello all,
    Here is another question.
    Is there a possibility to change the height of a user subscreen during runtime?
    Thank you in advance.
    Andreas

    Yes,you can.Just assign the new source to the source property of swfloader.

Maybe you are looking for

  • Problem in assigning category to an Item

    Dear All, When I create an Item in the Inventory, It is taking by default the Item category as MISC.MISC. Rather I am not able to assign the newly created Category based on the Item Categories and Item Class Category is not taking up, since it is say

  • Error Installing Yosemite

    The download is complete but it keeps giving me an error of "This disk has S.M.A.R.T. errors.  This disk has a hardware problem that can't be repaired.  Back up as much of the data as possible and replace the disk." I need to know what this means an

  • New IPod touch replacement & synching to ITunes

    Had an IPod Touch but was defective and was replaced with new one, but now error message when connecting to ITunes of "Pairing method problem". What does that mean and how do I fix it? Cannot access ITunes with it.

  • APP-INV-05447: No open period found for date entered

    Hi All I try to do Inter-Organization Transfer in OPM. But I got this error "APP-INV-05447: No open period found for date entered". What shall I do for this error? I controlled Inventory Calendar. The period is open. Thanks

  • Password got removed, need to reset it

    After getting my MacBook back from the repair shop, I noticed they removed my password for my main account. This password allowed me to install software that required password authentication. I was given the following instructions to reset it: 1. Res