How to change alpha of an array?

It's me again.
I am trying to dynamically change the alpha value of a set of movieclips on a timer.  The timer works but I get an error message from the function.     
This is the error:
TypeError: Error #1010: A term is undefined and has no properties.
at piedacoulisse_timer_fla:MainTimeline/zoom/piedacoulisse_timer_fla:onTime()[piedacoulisse_ timer_fla.MainTimeline::frame1:124]
at flash.utils::Timer/flash.utils:Timer::_timerDispatch()
at flash.utils::Timer/flash.utils:Timer::tick()
This is the code:
  var txt:Array = ["txt1","txt2","txt3","txt4","txt5"];
  var flashTimer:Timer = new Timer(3000,5);
  flashTimer.addEventListener(TimerEvent.TIMER, onTime);
  flashTimer.start();
  var frame:int = 0;
  function onTime(evt:TimerEvent):void{
   zoomIn.slider_mc.txt[frame].alpha = 1;  \\ line 124
   frame ++;  
Can anyone tell me what the problem is and how to fix it?

Sorry guys, no luck.  I tried all three suggestions and got the same error.  I ended up using timeline animation to change the alpha of my movieclips.  That worked but I am getting the error again when I try to stop some of the mc's from playing.  Here's the error:
TypeError: Error #1010: A term is undefined and has no properties.
at piedacoulisse_timer3_fla:MainTimeline/zoom/piedacoulisse_timer3_fla:onTime()[piedacouliss e_timer3_fla.MainTimeline::frame1:136]
at flash.utils::Timer/flash.utils:Timer::_timerDispatch()
at flash.utils::Timer/flash.utils:Timer::tick()
Here's the complete code, in case there is something I am not seeing elsewhere in the program:
slider_mc.tickMark_mc.stop();
slider_mc.stop();
var myRectangle:Rectangle = new Rectangle(9,9,125, 420);
var slideRectangle:Rectangle = new Rectangle(body_mc.x + 24.5,body_mc.y + 1,219.5,.01);
var startSlide:Number;
var deltaSlide:Number = 0;
var startMoveX:Number = 0;
var startMoveY:Number = 0;
var endMoveX:Number = 0;
var endMoveY:Number = 0;
var contactTop:Boolean = false;
var contactBottom:Boolean = false;
var contactPoint:String;
body_mc.addEventListener(MouseEvent.MOUSE_DOWN,pickUp);
body_mc.addEventListener(MouseEvent.MOUSE_UP,dropIt);
body_mc.addEventListener(MouseEvent.MOUSE_OUT,dropIt);
slider_mc.addEventListener(MouseEvent.MOUSE_DOWN,beginSlide);
slider_mc.addEventListener(MouseEvent.MOUSE_UP,stopSlide);
slider_mc.addEventListener(MouseEvent.MOUSE_OUT,stopSlide);
topMask.addEventListener(Event.ENTER_FRAME,moveMask);
botMask.addEventListener(Event.ENTER_FRAME,moveMask);
bodyMask.addEventListener(Event.ENTER_FRAME,moveMask);
stage.addEventListener(Event.ENTER_FRAME,zoom);
//  blockIt stops the draggable mc's when they hit the phone_mc
function blockIt(event:Event):void{
if(topMask.hitTestObject(phone_mc) == true){
  reply.text = "top hit";
  contactTop = true;
  event.currentTarget.stopDrag();
  contactPoint =  "top";
  nudgeIt(null);
}else if(botMask.hitTestObject(phone_mc) == true){
  reply.text = "bottom hit";
  contactBottom = true;
  event.currentTarget.stopDrag();
  contactPoint = "bottom";
  nudgeIt(null);
}else if(bodyMask.hitTestObject(phone_mc) == true){
  reply.text =  "body hit";
  event.currentTarget.stopDrag();
  contactPoint = "body";
  nudgeIt(null);
//  drags the hit-detection objects - I needed to do this to allow for a U-shaped object to surround another object.
function moveMask(event:Event){
topMask.x = body_mc.x+19;
topMask.y = body_mc.y+108;
botMask.x = slider_mc.x+32;
botMask.y = slider_mc.y+108;
bodyMask.x = body_mc.x+100;
bodyMask.y = body_mc.y+38;
//  drags the movable mc's
function pickUp(event:MouseEvent):void{
event.currentTarget.startDrag(false,myRectangle);
slider_mc.addEventListener(Event.ENTER_FRAME,followMe);
body_mc.addEventListener(Event.ENTER_FRAME,blockIt);
startMoveX = event.currentTarget.x;
startMoveY = event.currentTarget.y;
contactTop = false;
//  drops the movable mc's
function dropIt(event:MouseEvent):void{
event.currentTarget.stopDrag();
slider_mc.removeEventListener(Event.ENTER_FRAME,followMe);
endMoveX = event.currentTarget.y;
endMoveY = event.currentTarget.y;
contactBottom = false;
//  moves the slider with the body when it is dragged
function followMe(event:Event) {  
     slideRectangle.y = body_mc.y;
  slideRectangle.x = body_mc.x + 24.5;
  slider_mc.x = slideRectangle.x + deltaSlide;
  slider_mc.y = body_mc.y;
//  drags the slider along the body
function beginSlide(event:MouseEvent):void{
event.currentTarget.startDrag(false,slideRectangle);
deltaSlide = slider_mc.x - slideRectangle.x
contactBottom = false;
// drops the slider
function stopSlide(event:MouseEvent):void{
event.currentTarget.stopDrag();
// adjusts the postion of the draggable mc's to just butt up against the phone_mc - I did this so the mc's can be dragged again.  Without it, they are
locked in place by the hitTest.
function nudgeIt(event:Event):void{
if(contactPoint == "top"){
  body_mc.x = body_mc.x - 1;
}else if(contactPoint == "bottom"){
  slider_mc.x = slider_mc.x + 1;
}else if(contactPoint == "body"){
  body_mc.y = body_mc.y - 1;
// "zooms" in on the image and adds text commentary.  tickMark and oval mc's animate and then stop
//  This is where the error messages started appearing
//  Lines 136 137 and 138 all throw the same error
function zoom(event:Event):void{
if(contactTop == true &&contactBottom == true){
  body_mc.removeEventListener(MouseEvent.MOUSE_DOWN,pickUp);
  slider_mc.removeEventListener(MouseEvent.MOUSE_DOWN,beginSlide);
  var zoomIn:MovieClip = new MovieClip;
  zoomIn.addChild(phone_mc);
  zoomIn.addChild(body_mc);
  zoomIn.addChild(slider_mc);
  zoomIn.scaleX = 2.5; zoomIn.scaleY =2.5;
  addChild(zoomIn);
  zoomIn.x = -150; zoomIn.y = -350;
  slider_mc.tickMark_mc.gotoAndPlay(2);
  var flashTimer:Timer = new Timer(2000,8);
  flashTimer.addEventListener(TimerEvent.TIMER, onTime);
  flashTimer.start();
  var frame:int = 2;
  function onTime(evt:TimerEvent):void{
   slider_mc.gotoAndPlay(frame);
   slider_mc.stop();
   frame ++; 
   if(frame == 3){zoomIn.slider_mc.tickMark_mc.gotoAndStop(1);}   // line 136
   if(frame == 5){zoomIn.slider_mc.oval1_mc.gotoAndStop(1);}        // line 137
   if(frame == 7){zoomIn.slider_mc.oval2_mc.gotoAndStop(1);}        // line 138

Similar Messages

  • How to change alpha of a "container"

    I want to change alpha like when we change pages, but only for a container named:contain
    I have 4 btn (text1, text2, text3, text4) in the "left_side" and each of those change "contain1" to "contain4".
    (contain1, contain2, ... are all in my library and my btn
    that's the code:
    import fl.transitions.*;
    import fl.transitions.easing.*;
    // claim MCs from library to use on stage when needed using addChild
    var c1:contain1 = new contain1;
    var c2:contain2 = new contain2;
    var c3:contain3 = new contain3;
    var c4:contain4 = new contain4;
    left_side.addChild(c1);
    var pageMoveTween:Tween = new Tween(left_side, "y", Elastic.easeOut, 300, 110, 2, true);
    left_side.text1.addEventListener(MouseEvent.CLICK, btn1Click);
    left_side.text2.addEventListener(MouseEvent.CLICK, btn2Click);
    left_side.text3.addEventListener(MouseEvent.CLICK, btn3Click);
    left_side.text4.addEventListener(MouseEvent.CLICK, btn4Click);
    function btn1Click (event:MouseEvent):void {
    var btn1Outro:Tween = new Tween(left_side, "alpha", Strong.easeOut, 1, 0, 1, true);
    btn1Outro.addEventListener(TweenEvent.MOTION_FINISH, runBtn1Transition);
    function runBtn1Transition (event:TweenEvent):void {
    left_side.removeChildAt(1);
    left_side.addChild(c1);
    var btn1Intro:Tween = new Tween(left_side, "alpha", Strong.easeOut, 0, 1, 1, true);
    function btn2Click (event:MouseEvent):void {
    var btn2Outro:Tween = new Tween(left_side, "alpha", Strong.easeOut, 1, 0, 1, true);
    btn2Outro.addEventListener(TweenEvent.MOTION_FINISH, runBtn2Transition);
    function runBtn2Transition (event:TweenEvent):void {
    left_side.removeChildAt(1);
    left_side.addChild(c2);
    var btn2Intro:Tween = new Tween(left_side, "alpha", Strong.easeOut, 0, 1, 1, true);
    function btn3Click (event:MouseEvent):void {
    var btn3Outro:Tween = new Tween(left_side, "alpha", Strong.easeOut, 1, 0, 1, true);
    btn3Outro.addEventListener(TweenEvent.MOTION_FINISH, runBtn3Transition);
    function runBtn3Transition (event:TweenEvent):void {
    left_side.removeChildAt(1);
    left_side.addChild(c3);
    var btn3Intro:Tween = new Tween(left_side, "alpha", Strong.easeOut, 0, 1, 1, true);
    function btn4Click (event:MouseEvent):void {
    var btn4Outro:Tween = new Tween(left_side, "alpha", Strong.easeOut, 1, 0, 1, true);
    btn4Outro.addEventListener(TweenEvent.MOTION_FINISH, runBtn4Transition);
    function runBtn4Transition (event:TweenEvent):void {
    left_side.removeChildAt(1);
    left_side.addChild(c4);
    var btn4Intro:Tween = new Tween(left_side, "alpha", Strong.easeOut, 0, 1, 1, true);
    thank's for your help!

    Make it easy on yourself if you're going to keep synchronized numbering and loop it.
    var maxButtons:Number = 4;
    var currentSection:Number = 1;
    for (var buttonNumber:Number = 1; buttonNumber <= maxButtons; buttonNumber++)
        left_side.getChildByName('text'+buttonNumber).addEventListener(MouseEvent.CLICK, _buttonHandler);
    function _buttonHandler(e:MouseEvent):void
       var buttonPressed:MovieClip = MovieClip(e.currentTarget);
       var indexPressed:Number = Number(buttonPushed.name.substr(4,1));
       if (indexPressed != currentSection)
          currentSection = indexPressed;
          var content:MovieClip = MovieClip(left_side.getChildByName('content'));
          var fadeTween:Tween = new Tween(content,"alpha",Regular.easeOut,1,0,1,true);
          fadeTween.addEventListener(TweenEvent.MOTION_FINISH, _loadContent);
    function _loadContent(e:TweenEvent):void
        // remove old content
        left_side.removeChild(left_side.getChildByName('content'));
        var content:MovieClip;
        content.name = 'content';
         if (currentSection == 1)
            content = new content1();
         else if (currentSection == 2)
            content = new content2();
         else if (currentSection == 3)
            content = new content3();
         else if (currentSection == 4)
            content = new content4();
         content.alpha = 0;
         left_side.addChild(content)
         new Tween(content,"alpha",Regular.easeOut,0,1,1,true);
    I hate switches in general, opt for ugly if blocks. If you really want to do it right then get all your content in easily synchronized indexed arrays as references so you don't need to do any string comparison work.. This is just quick and dirty to give you an idea that you can re-use functions as well as loops to make things less tedious.

  • How to change alpha of textfield

    Forum Members,
    I have looked around, and not really found an answer to this
    question. It seems it can be done, but I am
    not sure how to do it.
    I would like to emulate Powerpoint in flash, in the sense of
    having text appear on the stage.
    In one case I have created a textfield,
    var myTextField:Textfield = new Textfield();
    I am able to assign a format to the textfield using the
    TextFormat class.
    and tween it around, etc.
    I am reading an xml file to set another textfield's text
    value.
    I would like to change the alpha of this textfield (var
    subText:TextField = new TextField();)
    to zero, and then tween it up to 1 (using tweenlite).
    I do not seem to be able to set the alpha on the textfield.
    Is this possible? I do not want to convert it to a MovieClip or
    Sprite, but if that is what I need to do to get the ability to
    change the alpha, I will do it.
    Thanks,
    Eholz1

    you can assign its alpha property like any display object.
    you just need to embed its font.

  • How to change alpha to numeric on keypad

    HP officejet J4680. how do I change (on keypad) alpha to numeric?

    Hi,
    You should use the keys on the device, keep clicking the using the numeric keypad's button till the number will appear (similar to SMS typing)
    Say thanks by clicking the Kudos thumb up in the post.
    If my post resolve your problem please mark it as an Accepted Solution

  • How to change alpha value in pixel

    I am trying to alter the alpha values in a pixel array. I can change the RGB values, but changing the alpha seems to have no effect. Hope you can help. Thanks.
    import java.awt.*;
    import java.awt.image.*;
    import java.io.*;
    import com.sun.image.codec.jpeg.*;
    import java.util.Random;
    import java.awt.Toolkit;
    public class alterImage extends Component {
    public FileOutputStream fos = null;
    public File fc = null;
    private static Frame window;
    public void paint (Graphics g){
      Toolkit theKit = window.getToolkit();
      Image img = theKit.getImage("originalImage.jpeg");
      img = img.getScaledInstance(100,100,1);
      MediaTracker mtracker =  new MediaTracker(this);
      mtracker.addImage(img, 0);
      try {
      mtracker.waitForID(0);
      } catch (Exception e) {}
      int w = img.getWidth(this);
      int h = img.getHeight(this);
      int[] pixels = new int[w * h];
      PixelGrabber pixs = new PixelGrabber(img, 0, 0, w, h, pixels, 0, w);
         try {
         pixs.grabPixels();
         if (pixs.getColorModel().hasAlpha())
         System.out.println("hasAlpha");
              } catch (InterruptedException e) {
                System.err.println("interrupted waiting for pixels!");
                return;
    // alter pixel values
    for(int i = 0; i < pixels.length; i++){
         int alpha = (pixels[i] >> 24) & 0xff;
         //System.out.println("alpha " + alpha);
         int red   = (pixels[i] >> 16) & 0xff;
         //System.out.println("red" + red);
         int green = (pixels[i] >>  8) & 0xff;
         //System.out.println("green" + green);
         int blue  = (pixels[i]      ) & 0xff;
         //System.out.println("blue" + blue);
         green /= 2;   // green is effected
         alpha /= 2;   // alpha is not effected
         pixels[i] = (alpha << 24) | (red << 16) | (green << 8) | blue;
    // create new image with altered pixel data
    BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    image.setRGB(0, 0, w, h, pixels, 0, w);
    // write new image to file
    try {
    fc = new File("newImage.jpeg");
    fc.createNewFile();
    fos = new FileOutputStream(fc);
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(fos);
    encoder.encode(image);
    fos.flush();
    fos.close();
    // show image in window
    Image img2 = theKit.getImage("newImage.jpeg");
    g.drawImage(img2, 0, 0, 100, 100, this);
    } catch(IOException e) {}
    // end paint
    public static void main (String arg[]){
         window = new Frame ("Alter Image");
         window.add(new alterImage());
         window.pack();
         window.setSize(100,100);
         window.show();
    // end class
    }

    It only makes sense to apply transparency in respect of another image that this one is to appear 'on top of'; this is done by performing a comparison on the pixel value for each of the two images, altering in favour of the 'on top' image if transparency for that pixel is low, or for the 'underneath' image if transparency for that pixel is high.
    Although tricky (for me at least, perhaps not for you!), using the WritableRaster from BufferedImage's GetWritableRaster() method lets you accomplish this. Look here for more:
    http://java.sun.com/j2se/1.4.2/docs/api/java/awt/image/WritableRaster.html
    Once you have created a composite image of the two source images, that can then be saved as a separate JPG, GIF or whatever. Look here too:
    http://java.sun.com/docs/books/tutorial/2d/display/compositing.html
    Good luck!
    Chris.

  • How to change alpha of overlapping section of Movieclips

    Hello Forum,
    I am working with Flash CS3, and using Action script 2.0.
    I use attachMovie to add 5 clips on the stage each in a
    different layer (can I have two mcs on one layer?). Three of these
    clips are filled circles. One large yellow circle is on layer 1
    (depth 1), a smaller circle (blue) is added on layer 2, and then a
    different instance of the blue circle is added on layer 3. I then
    tween the two blue clips in toward the big yellow circle, one on
    the left side, and one on the right side. Each blue circle
    partially overlaps the yellow circle. I would like to change the
    alpha of each blue circle where it overlaps the yellow circle. Just
    the overlapping sector, not the whole circle. This is like a venn
    diagram. I have looked at the blendMode, but this seems to have no
    effect at all. I think it is due to the fact that I tween the clips
    and am using attachMovie in AS2 on an actions layer. If I just drag
    two clips on the stage, and set the blendMode of the top clip, I
    see an effect, but it changes the entire clip, not just the
    overlapping part. I suspect this is due to the fact that I have a
    white background on the stage. Is there a way I can set the alpha
    just where the clips overlap? Maybe using some sort of mask layer?
    I have looked around for a solution on the internet, and have
    not quite found what I am looking for. This is for AS2, not AS3.
    Thanks,
    eholz1

    Well the first thing is there are no "layers" in
    actionscript. So I'll assume you mean you've added them at
    different depths?
    The next bit is that you could probably come up with some
    very complex masking way of doing this, but I don't think you need
    to. The trick is that you can't tell that there is a blending mode
    over the white -- at least I can't -- until you move the item over
    something else. So the trick is to keep your cirlces from moving
    over things you don't want them to move over.
    I used the code below and it worked like I think you are
    describing.

  • How to change the frequency of pulse train on the fly using an array of values?

    Hi all!
    First I want to thank U for the great job you are doing for this forum.
    Iam still busy trying to control a stepper motor, by sending pulses from my E-series 6024 to a compumotor s6- stepper Driver. I've managed to get it working. I desperately need to control the motor using the values from an array. I believe we can use two approaches for that:
    1st - I can get an array of the "numbers of pulses". Each element must run for 10 milliseconds. Using that we can calculate the array of frequencies to send the number of pulses within 10 milliseconds for each specific element. Could we use the arrays of "number of pulses" and frequencies in a "finite pulse train " and up
    date with each element every 10 millisecond?
    2nd - Or Could we use of the frequency array in a "continuous pulse train vi" and update it every 10 milliseconds?
    Please note that I must use the values as they are.
    Can someone please built a good example for me? Your help will be appreciated.
    Regards
    Chris
    Attachments:
    number_of_steps.txt ‏17 KB
    frequency.txt ‏15 KB

    Tiano,
    I will try to better explain the paragraph on LabVIEW. The original paragraph reads ...
    "While in a loop for continuous pulse train generation, make two calls to Counter Set Attribute.vi to set the values for "pulse spec 1" (constant 14) and "pulse spec 2" (constant 15). Following these calls you would make a call to Counter Control.vi with the control code set to "switch cycle" (constant 7). The attached LabVIEW programs demonstrate this flow."
    You can make two calls to Counter Set Attribute or you can make a call to Set Pulse Specs which, if you open this VI, you will see that it is just making two calls to Counter Set Attribute. What you are doing with the Counter Set Attribute VIs is setting two registers called "pulse s
    pec 1" and "pulse spec 2". These two registers are used to configure the frequency and duty cycle of your output frequency.
    The example program which is attached to this Knowledge Base demonstrates how to change the frequency of a continuous generation on the fly. Why continuous? Because changing the frequency of a finite train would be easy. When the train completes it's finite generation you would just change the frequency and run a finite train again. You would not care about the time delay due to reconfiguration of the counter.
    If you would like to change the frequency of the pulse train using a knob, this functionality will have to be added in the while loop. The while loop will be continuously checking for the new value of the knob and using the knob value to set the pulse specs.
    LabVIEW is a language, and as with learning all new languages (spoken or programatic) there is a lot of learning to be accomplished. The great thing is that LabVIEW is much easier than mo
    st languages and the learning curve should be much smaller. Don't fret, you'll be an expert before you know it. Especially since you're tackling a challenging first project.
    Regards,
    Justin Britten

  • How to change the tabbing order of an array of clusters?

    How to change the tabbing order of an array of clusters?  I have the cluster arranged in table in the front panel.   The cluster element goes horizontal and array element goes vertically.   When I press the tab key, the cursor goes to the next array element instead of the next cluster item (down instead across).
    Solved!
    Go to Solution.

    Broken Arrow wrote:
    Harold asked a perfectly reasonable and necessary question, but how is that a Solution ???
    I believe it is called the Socratic Method.
    Sea-Story time
    I had the privledge of working for Ron Davis when he managed the Allegheny District of DEC. He was an ex-WO4 (Highest possilbe rank for non-commisioned officer in US Navy, required act of congress to confirm).
    Ron never answered any question I ever saw presented to him. I remember a group of managers in a frenzy over some issue  running to him to to see what he thought. He asked them a series of questions that lead them to the solution and soon they were smiling and slapping each other on the back as they walked away.
    Who is that has a signature that read "it is the questions that guide us"?
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to change boolean text of boolean array programatically?

    Hi,
    I have a boolean array. How to change the boolean text programatically for all the array element? 
    Thanks a lot for any help.
    Anne

    Anne Zuo wrote:
    It works with one boolean, BUT doesn't work to  boolean array. 
    "Doesn't work" is not specific enough. In what way does it not work (no such property, broken wire, boolean text does not actually change, ...etc)? 
    Yes, it works just fine.
    RIght-click on one of the array elements and select "create ...property node...boolean text...text"
    LabVIEW Champion . Do more with less code and in less time .

  • How do i change 2 row of array into waveform with delta time and time

    Hello,
    How do i change 2 row of array into waveform with delta time and time
    so the waveform graph will display two waveform,
    waveform, not cluster =]
    and how to extract 1d array from waveform?

    Hi AxE,
    Here is an example VI, that do what You asked for.
    Both requests.
    Hope it Helps...
    Attachments:
    2D_to_Waveform.vi ‏75 KB

  • How to change array size in forms6i

    Does anyone know how to change the array size in Forms6i.
    The only runtime option i see is Array=YES (Use array SQL processing). But I want to increase the number of records per request retrieved. There's supposed to be a 'Query Array Size' parameter but I have no clue where to find this ...
    kind regards

    Kurt, it may sound an obvious point to make but - did you even consider the on the help??
    We spend a lot of effort in producing this and it should be the first stop for quesions.
    Bring up the help, click on index and then type in "QUERY ARRAY" - and the list automatically moved to the topic you want.
    Regards
    Grant Ronald
    Forms Product Management

  • How to change button colors in a loop?

    I am working on a task that should imitate an elevator. I have two vertical
    rows of round buttons "Up" and "Down" When a circle is selected randomly by
    the program, the circle becomes yellow and the elevator moves to that
    button.
    Here is what I did:
    1. created a class Circle where I save buttons' parameters
    2. saved Circle objects in an array
    3. drew the buttons depending on their parameters
    4. generated a random number, matched it with an array index and assigned
    the object color to yellow.
    Everything is fine except that I can't figure out how to change colors of my
    buttons in a loop.
    import javax.swing.*;
    import java.awt.*;
    import java.util.*;
    public class Elevator3 extends JPanel
    private int n = 40;
    private int width = 200;
    private int floors = 10;
    private int interval = 1000;
    private boolean selected = false;
    private Circle[] buttons = new Circle[2*(floors-1)];
    public Elevator3()
    build();
    JFrame frame = new JFrame("Elevator3");
    setBackground(Color.WHITE);
    setFont(new Font("SansSerif", Font.PLAIN, Math.round(n/3)));
    frame.getContentPane().add(this);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(width, n*(floors+2) );
    frame.setVisible(true);
    public void build()
    Random r = new Random();
    int buttonPick;
    int timeUntilNextButton = r.nextInt(interval);
    for (int k =0; ; k++)
    if (timeUntilNextButton-- ==0)
    buttonPick = r.nextInt(2*(floors-1));
    //populate my buttons array here - how??
    timeUntilNextButton = r.nextInt(interval);
    //adding "Down" buttons
    for (int i=1, count=0; i < floors; i++, count++)
    if (count == buttonPick)
    selected = true;
    else
    selected = false;
    buttons[count]= new Circle(n*2, n*i, selected, Math.round(n/2));
    //build an array of "Up" circles
    for (int i=2, count=floors-1; i < floors+1; i++, count++)
    if (count == buttonPick)
    selected = true;
    else
    selected = false;
    buttons[count]= new Circle(n, n*i, selected, Math.round(n/2));
    public static void main(String[] args)
    new Elevator3();
    protected void paintComponent(Graphics g)
    super.paintComponent(g);
    //draw buttons
    for (int i=0; i < buttons.length; i++)
    g.setColor(buttons.getColor());
    g.fillOval(buttons[i].getX(), buttons[i].getY(), buttons[i].getWidth(), buttons[i].getWidth());
    class Circle
    private int x;
    private int y;
    private Color c;
    private boolean pressed;
    private int width;
    public Circle(int xCoordinate, int yCoordinate, boolean selected, int diameter)
    x = xCoordinate;
    y = yCoordinate;
    pressed = selected;
    width = diameter;
    if (pressed)
    c = Color.YELLOW;
    else
    c = Color.LIGHT_GRAY;
    public Color getColor()
    return c;
    public int getX()
    return x;
    public int getY()
    return y;
    public int getWidth()
    return width;

    hi,
    am sorry, i couldn't make out what exactly the problem, but as ur subject line says...
    may be the code give below will help you to change button colors in a loop..
              for(int i = 0; i < button.length; i++){
                   int color1 = (int)(250*Math.random());
                   int color2 = (int)(250*Math.random());
                   int color3 = (int)(250*Math.random());
                   Color c = new Color(color1,color2,color3);
                   button[i] = new JButton("button name");
                   button.addActionListener(this);
                   //to check the r, g, b combination.
                   //System.out.println(c);
                   button[i].setBackground(c);
                   button[i].setForeground(Color.white);
    //adding into the panel
                   panel.add(button[i]);
    hope this would help you.

  • How to change sort order for Notes in iOS?

    When using Notes in OS 10.10, I can change the sort order. However, I cannot see how to change the sort order for Notes in iOS8 on my iPhone. I sync using iCloud, but the iPhone does not pick up the sort order (alpha) that I have chosen on my MBP.
    Is it possible to change the sort order on phones?
    Thanks.

    View > Sort By > Title

  • How to change report region fields in read only mode?

    How to change report region fields in read only mode?
    skud.

    add the following javascript fuction to page header(or Javascript function and variables section)
    function disableItems(pRegionStaticId,pDisableFlag) {
      $('#'+pRegionStaticId).find('[name^=f]').each( function(){ /* matches fxx */
        if( $(this).attr('name').match(/f[0-9][0-9]/) ){
          return $(this);
      }).attr('disabled',pDisableFlag);
    pRegionStaticId is the region's static Id+
    Note that this code specifically disables only application arrays. Disabled items are not available after submission (and hence are different from readonly) . But any page javascript can modify disabled or readonly items(client side), so you must check at the server side to validate the data.
    You can disable items using
    disableItems('MY_REGION_ID' ,true);and enable them by passing false
    disableItems('MY_REGION_ID' ,false);

  • How to change "activeDocument"?

    Hi Guys, I am new to Illustrator scripting - actually just started today. I don't know how to change the activeDocument to recursively process all the open .ai files and generate corresponding PNG files. "documents" is an array of all open .ai files. My problem is that all the generated PNG files are the same. The alert message confirms that activeDocumen.name doesn't change, whereas the sourceDoc name recurrsively changes based on the open files.
    Here is a code snipit:
                for ( i = 0; i < app.documents.length; i++ ) {
                    sourceDoc = app.documents[i]; // returns the document object
                    // Get the file to save the document as pdf into
                    targetFile = this.getTargetFile(sourceDoc.name, '.png', destFolder);
                    // Export as png
                     sourceDoc.exportFile(targetFile, ExportType.PNG24, options);
                      alert (activeDocument.name);
                      alert (sourceDoc.name);
    Any help is appreciated!
    Alex

    I was missing:
    sourceDoc.close(SaveOptions.DONOTSAVECHANGES);
    It fixed the problem. Also a more elegant solution is located at:
    http://forums.adobe.com/message/3205868

Maybe you are looking for

  • Cell data format problem

    Hello, I just began using the new version of Numbers. I tried to make a distance-speed-time function and have it as hour, minute and second but when I switch from automatic data format to custom data format (Duration) and go to the next cell to do th

  • Could not find agent library on the library path or in the local directory

    Hi all, I'm trying to write a jvmti agent that write any information in a mysql db. I've written a simple agent that work correctly and now I'll try to insert the mysqlpp library in my agent: 1) I've added #include <mysql++.h> 2) and I've added mysql

  • So what am I supposed to do with a .msp file?

    So what am I supposed to do with a .msp file?  It has no file association under Windows 7, yet Adobe points users who wish to patch their current version of Acrobat 9 Pro to a web page with download links to .msp files.

  • HELP!  How to get 103K messages in TRASH back to proper folders

    I just deleted all 103,000 messages in MAIL to make space on my laptop.  I use gmail and never look at MAIL.  However, I didn't realize that doing so would delete them from Gmail as well!  They are all still in the trash as far as I can tell.  I know

  • Acrobate professional and the 7.0.7 patch

    I have set up the Acrobat Professional 7.0.0 upgrade install VIA the Install Tuner. We have managed to patch the Admin install to 7.0.5. When we try to run the 7.0.7 patch against the Admin install it starts and stops right away like something is wro