Problem of fillup with colored rectangles

Here is my canvas

< mx:Canvas id = "b1" x = "10" y = "10" height = "40" width = "300" borderStyle = "solid" borderColor = "black" / >

To fill the canvas with rectangles, I wrote the following code

for (var i: int = b1.x; i < b1.x + b1.width; i = i + 15)
{
var line1:UIComponent = new UIComponent();
var lineThickness1:Number = 1;
var lineColor1:Number = 0 x 000000;
var lineAlpha1:Number = 1;
LINE1. Graphics.LineStyle (lineThickness1, lineColor1, lineAlpha1);
LINE1. Graphics.MoveTo (i, B1.y);
LINE1. Graphics.drawRect(i,B1.y,15,B1.) Height);
this.addChild (line1);
}

amount of the fine can

< mx:HBox = "40" x y = "450" >
< mx:Label text = "" enter units: "fontWeight ="bold"fontSize ="15"/ >"
< mx:TextInput id = "tiUnits" width = "30" maxChars = "1" / >
< mx:Button id = "btn" label = "OK" click = "btnCall (tiUnits.text); "/ >
< / mx:HBox >

In btnCall()

entry entry in tiUnits should be converted to integer, and taking into account this value, I need to fill the canvas with color rectangles(width-15)

for example: If an entry is 15 the first rectangle must fill with color and if I come back in 30 then after first two rectangle rectangles each width 15 must fill

in this way I have fill the canvas one after the other

Please help me...

Hope that this code solves your problem

private var lastPos: int = 0;

private function drawRectangle(event: MouseEvent): void {
     var unit: int = (Number(tiUnits.text) / 15);
     var colors: Array = [0x0000FF, 0x00FF00, 0xFF0000, 0xFF00FF, 0x00FFFF, 0xFFFF00]

     for(var i: int = 0; i < unit ; i++) {
          var lineThickness1: Number = 1;
          var lineColor1: Number = 0x000000;
          var lineAlpha1: Number = 1;
          var bgColor: uint = colors[Math.floor(Math.random() * colors.length)];

          var line1: UIComponent = new UIComponent();
          line1.graphics.lineStyle(lineThickness1, lineColor1, lineAlpha1);
          line1.graphics.beginFill(bgColor, 1.0);
          line1.graphics.moveTo(((lastPos + i) * 15), b1.y);
          line1.graphics.drawRect(((lastPos + i) * 15) - 1, -1, 15, b1.height - 1);
          b1.addChild(line1);
     }
     lastPos = lastPos + unit;
}

Tags: Flex

Similar Questions

  • PROBLEM of ALIGNMENT with color printing

    PROBLEM of ALIGNMENT with color printing.  HP Officejet Pro L7680 all-in-One - using Mac OS x 10.6.8 - with USB connection & ethernet - without error message thank you.

    Hello

    What kind of problem?  Print quality problems?  You have run the alignment of the HP utility?

  • 5 - problems of Lightroom with color printing

    I have 5 Lightroom and am having problems with my impressions.  They look great in LR, but when I upload to different websites for the dyed prints have a gray-green cast to them and print with the troupe of grey-green.  I can pull up in other applications, i.e. Windows and Facebook Photo Gallery and they look good.  I checked my preferences and they are defined in sRGB.  Any other ideas?  For example, I got an invitation from a friend, the photos I dealt with in LR and then used Photoshop CS4 to make the invitation.  The major colors printed invitation.  She liked the photos, I had taken and asked those who have too much.  When she printed the real images, they had a gray-green tint to them, but the invitation looked very good even if it was made on the same pictures that came out of gray-green.  Any help is greatly appreciated!

    You must choose sRGB in the export dialog box. The color space you chose for external editing will make no difference in this regard.

  • WebView weird display problem (of colored rectangles) - Debug Mode

    Hello

    I had a problem with a JavaFX Webview.

    Everything loads fine, but each element in the DOM of the page (including the body) is overlaid with a rectangle of color random when hovered.

    After a few seconds the entire page is makes it unreadable and only a weird mix of colors.

    It works without problem in the whole of JavaFX example, so I think that it is not a problem of javafx, but I am doing something wrong somewhere else in my application.

    The initialization code is the same as in the example:

    webview = new WebView();
    previewStage.getChildren().add(webview);
    
    final WebEngine webEngine = webview.getEngine();
    webEngine.load("http://www.google.de");
    
    

    Thought it might be a problem of style sheet, but I removed all the style sheets and it looks always the same.

    I have attached some pictures of what it looks like.

    http://www.tinyuploads.com/images/31lf1b.PNG

    http://www.tinyuploads.com/images/UxK8wZ.PNG

    I appreciate all help.

    Thank you!

    It is https://javafx-jira.kenai.com/browse/RT-23846. Please make sure that you do not enable fine for the com.sun.javafx.webkit.prism.WCGraphicsPrismContext class.

  • Age of Empires 2 The Conquerors - problem with colors

    Hello

    My most favorite game AoE 2 on does not valid. This means that if I play in single or multiplayer game I see 'blue' water violet and 'green' yellow grass. Also the player color eg 'cyan' on the map it is visible in the yellow form. How can I do? I asked other people about it and there's the problem without correlations with the help of equipment and drivers. I use Windows 7 pro from msdn, my Radeon x 800 graphics. I used the driver windows and amd Web site. I also tried various compatibility without result mode.

    Help me

    Kill explorer.exe, while the game is loading fixed the problem in Windows 7

    http://en.Wikipedia.org/wiki/Age_of_Empires_II:_The_Conquerors

    Messages rating helps other users
    Mark L. Ferguson MS - MVP

  • Problem with colored labels

    Hello

    I'm having some problems with color tags when you use lightroom;

    I recently upgraded to Lightroom from 5.6 to 6.5, and all the photos of my catalog with tags color turns white label only.

    I also have the same problem when I import pictures from my laptop catalog, whith photo colors such as red, blue, green, turns in a white label...

    Is there a problem with LR 6.5?

    Could you help me please?

    Cosette

    I finally found the solution.

    During the upgrade, LR languages have changed, and the words associated with the colors too, labels

    so I translate just the name of the color in the metadata / color label set / change, and everything is fine!

  • problem with color efex pro 3 in CS5...

    Hi all

    Sorry for my English

    I have a problem with Color Efex Pro 3, I can not

    If it is usable on my CS5 how do?

    I installed the software in the Photoshop plug-in

    CS5 and nothing

    Help me I am knocked out I finds no solution...

    Thank you all in advance for help you

    We do not control the API - but the code of the plugin runs in our process.

    Plugins are not other applications, they are DLLs with reminders in Photoshop, sharing space with Photoshop.

    If we cannot witn against their bugs with the current plugin architecture.

    If you didn't mind working two orders of magnitude slower with no plugins do not access to as many features of Photoshop, we could put plugins in another process.   Then, of course there are things that we can do - just nothing reasonable, or that visitors and developers would be conditioned with.

    And next time, please do not hesitate to ask questions instead of trying to make a Chair coding.

  • MS Paint "fill with color" tool does not work. :(

    In the painting, my "fill with color" tool (the pouring paint can) does not work. I click on the box, I click on a different color, the icon changes to the can, but when I click on a space as say an empty circle, it doesn't do anything. Right click, nothing, left click, nothing.

    I noticed that the only thing he is able to do is to change a solid color that I did (as a solid black rectangle) in a different color, but only once. If I rectangle black color green, I can't change it to any other color after. I don't know what is happening.

    I am not edit a photo or anything btw, I start a new painting from scratch file. I'm trying just to circles of color and enclosed spaces. I've done this dozens of times with no problems. I tried restarting the computer and paint without effect.

    Thanks for any help!

    In the painting, my "fill with color" tool (the pouring paint can) does not work. I click on the box, I click on a different color, the icon changes to the can, but when I click on a space as say an empty circle, it doesn't do anything. Right click, nothing, left click, nothing.

    I noticed that the only thing he is able to do is to change a solid color that I did (as a solid black rectangle) in a different color, but only once. If I rectangle black color green, I can't change it to any other color after. I don't know what is happening.

    I am not edit a photo or anything btw, I start a new painting from scratch file. I'm trying just to circles of color and enclosed spaces. I've done this dozens of times with no problems. I tried restarting the computer and paint without effect.

    Thanks for any help!

    salés

    try to run the sfc/scannow command. to repair the corrupted system files

    http://support.Microsoft.com/kb/929833

    Use the (SFC.exe) System File Checker tool to determine which file is causing the problem and then replace the file. To do this, follow these steps:

    1. Open an elevated command prompt. To do this, click Start, click principally madeprograms, Accessories, right-click guest, and then click run as administrator. If you are prompted for an administrator password or a confirmation, type the password, or clickallow.
    2. Type the following command and press ENTER:
      sfc/scannow

      The sfc/scannow command analyzes all protected system files and replaces incorrect versions with appropriate Microsoft versions.

    Walter, the time zone traveller

  • Office Jet 6600: How to print black with color ink run out?

    How can I print black with color ink are empty? (I have gone to properties... black and white only... and allow black ink only a few times, but I get the options for onlinr purchases, cancel printing or help.)

    When I click on it help States I can print with the depleted cartridges, but it doesn't tell me how. Can someone please?

    Hello

    For your printer, it is only possible to print only in black when the other cartridges are exhausted.

    If you want to know more about it please check the document below

    http://support.HP.com/us-en/product/HP-OfficeJet-6600-e-all-in-one-printer---H711a/H711g/4322968/model/4323587/document/c04331666

    Thank you

    I am an employee of HP, these messages are consistent with my knowledge and HP is not responsible.
    By clicking on the star of congratulations in the post helped you to say thanks.
    Please indicate the position that solved your problem as accepted Solution

    I work for HP

  • Problems of network with 715W

    For months (seems like years?) I had to power cycle regularly my printer, the PC and the modem/router to restore network connectivity.  More recently (now) connectivity is dead, even until I can't connect using a USB cable.  If I try to print a page of test via a USB port, it goes through the motions, pulling a page from the paper tray, abruptly resets and get the blank page on the output tray.  I tried without success with several resets of the router, different channels, power levels, etc.

    Anyubody other similar problems?  Of course, I had also just replace my black and purchased 2 new black cartridge and a color cartridge to avoid missing (victimized by this one at Christmas while they were not in stock!)

    After spending over an hour on the phone with Dell, call of the Canada, getting bounced to half a dozen different representatives in the United States and then back to the Canada even once, he ended it would cost more than a little troubleshooting only so buy a new printer (not DELL).  I managed to get a RA number to be able to return the cartridges, that I just bought.

    Then I called my provider I had problems last week with my network which I think might be related.  After about 15 minutes with them, they found where a framework had been modified caused place ended my problems.  Even if they are not 'officially' supporting printers, he worked through the configuration with me and you have my printer works again 100%.

  • Merge the problem of clips with replacement of sequences of proxy

    Hello

    I have problems to find a solution to a problem I have with the merging of the Clips feature in Adobe first Pro CC.

    I am currently working on a tool for editing using sequences of proxy which I intend to replace after locking picture for color and export. The project was registered with dual sound, so my intentions were to synchronization and merge all the images in the proxy edit for an easy workflow and then replacement all clips with the original source files prior to export.

    The problem is that when I replace proxy images in the first, the merged clips don't update.

    If someone knows a solution or the solution please let me know, because my workflow would really enjoy being able to use clips of fusion, but only if I am then able to replace the images easily with the source files.

    Thank you

    Aaron

    If someone knows a solution or workaround...

    Do not use a proxy.  Use the originals of sufficient quality for final export intermediaries.

  • Fill with color

    I can just fill my drawing with a color box, or what I go through and make layers etc.?

    Look at the toolbar on the left side. You will see an icon with a dotted line. If you hold down the mouse a few seconds on the Tools icon more will pop up. Here are the tools of selection as well as the icon that resembles a rope lasso and a brush with a line dashed.

    You will use the brush with the dotted line the most. This is called the quick selection tool. You can paint over an area to make a selection and he try to help you. At any time you can hold ALT on windows or opt key on the mac to remove a part of the selection.

    No matter which icon in the toolbar that has a small triangle in the lower right corner has additional tools that you can use. Just hold the mouse for a few seconds, as you did with the rectangle Select tool (the first icon that looks like a dotted line)

    The rectangle selection tool is great for the selection of a rectangle, you will find that the modifier keys are very useful with the use of those selection tools, as well as most of the other tools.

    The shift key will restrict the selection to a perfect square or a circle for example. ALT/Opt is to remove and ctrl/cmd is to use the move tool temporarily. Manufacturing is easier to move a selection or object.

  • Change the thickness of the lines created with the Rectangle tool in CS2?

    I'm trying to change the thickness of the lines for a rectangle drawn with the Rectangle tool in Photoshop CS2.

    I can't understand how change the thickness of the lines of the four sides of the rectangle before I draw the rectangle by using the Rectangle tool or after the Rectangle was drawn. The same problem seems to occur when you use the tool polygon, Ellispse tool, etc.

    I can turn the rectangle to make it bigger or smaller, etc., but it seems that I should be able to vary the thickness of the lines for a rectangle.

    This task is possible in Photoshop?  It's simple in Illustrator - it seems it should be a fairly simple task in P-shop.  I looked on Google and in help for P-shop CS2 for a response but cannot locate a solution.  I don't see something really obvious?

    Any help is greatly appeciated.

    Thank you!

    Read post 1 once again. You want to use the layer style (double click to the right of the name of the layer in the layers panel) and use the option of the race. You can even set layer styles to apply to objects with a single click. If you frequently need the thick rectangle, it will be a click.

    Layer style presets that are predefined values and cannot be changed on the fly just like real styles, but they are still very useful.

  • Trouble with color profiles?

    Since the installation of photoshop, I had no problem. A few days ago I hit accedentally an access key that changed a few color profile settings, but I can't understand those who. Now, when I save a jpg or gif, the colors are much brighter and more vibrant than my work of colors. If I turn on the preview of the color test, I get the true picture. However, I had never put forth and there not together now. Anyone know what is happening? The colors of evidence are set to "monitor colors.

    I have attached a sample of the same image open in photoshop and saved jpg image open in preview. I'd appreciate any help you can give me!

    This has been discussed ad nauseam here, and there are many existing threads on the topic.  This type of thread can get very long without delay.  I suggest you just take a peek.

    In a Word, you need to calibrate and profile your monitor with precision, choose a working color space, honor this tag (color space) in all the files that you open and tag all of your files with the color profile in which they were created.  Then look at the image in an application of color management.

    If you choose not to embed the color profile in a JPEG image, which means that you end up with a JPEG file is not marked, be prepared to see the differences in color between the appearance of the image in some applications, more especially if you have a Monitor wide gamut.  For example, Photoshop and Firefox 3.0.8 (the latter with color enabled, management that is not default) will assume sRGB for all unmarked images correctly.  However, applications from the Finder preview, Safari, iPhoto and Aperture, Apple, simply throw all unmarked images screen profile.  Who exactly will have the effect that you show.

    Similarly, if you let a created image, say ProPhoto RGB, not identified, it will look like it's fire in Photoshop and Bridge, as well as in the Finder, etc.

    To beging learn color management, start here: http://www.gballard.net/psd/cmstheory.html

  • Hey, need help. I get this in my iPhone that 'there is a problem of billing with a previous purchase. Please update your payment method"in any way I can remove my visa card from iTunes

    Hey, need help. I get this in my iPhone that 'there is a problem of billing with a previous purchase. Please update your payment method"anyway I can remove my visa card from iTunes?

    You must pay your debt first.

Maybe you are looking for