Canvas with background squares

I have a requirement to create a canvas with squares as background (see attached image1).  When the user resizes the canvas , the squares size should get resize automatically.
When the user double clicks on this canvas I need to create the bigger square. This bigger square should align to the nearest background squares(see the Image2)
Is there shortcut in implementing this requirement ? Please help me to implement this requirement.

Hi
You'll need to do something like below, create a custom comp and draw what you want on it.
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300" >
<mx:Script>
<![CDATA[
override protected function updateDisplayList(uw:Number, uh:Number):void {
super.updateDisplayList(uw,uh);
var xpos:int = 0;
// Divide width by no of lines you want will cause resize as comp redraws
var xGap:Number = uw/10; 
var ypos:int = 0;
var yGap:Number = uh/10;
graphics.beginFill(0xffffff,1)
graphics.drawRect(0,0,uw,uh);
graphics.endFill();
while (xpos<uw) {
graphics.lineStyle(1,0xcccccc);
graphics.moveTo(xpos,0);
graphics.lineTo(xpos,uh);
xpos += xGap;
while (ypos<uh) {
graphics.lineStyle(1,0xcccccc);
graphics.moveTo(0,ypos);
graphics.lineTo(uw,ypos);
ypos += yGap;
]]>
</mx:Script>
</mx:Canvas>
Hope this helps you make a start
Andrew

Similar Messages

  • New photoshop cc seems to have a bug wrt the toolbar's foreground and background squares.

    New photoshop cc seems to have a bug wrt the toolbar's foreground and background squares. When I pick a color to use as a fill the squares show gray and the fill is gray rather than the color picked. Never had a problem with this in previous version of PS. Could something be set up or initialized to cause this state of affairs?

    Change your document from Grayscale to RGB, or change the selected channel to the RGB data instead of a mask.

  • Canvas with Form

    hi pals,
    I have some doubts with my application development. Till now i am developing application with Canvas, and i know we can able to use form as well as canvas within single midlet am i right?
    But i want to use Canvas as background for Form(ie. the Form should display on canvas) is it possible?
    And one more question can we add color for buttons used in form?
    waiting For reply..
    Thank you,

    Thank you,
    Iam trying to use j2me ploish, for that i had download j2mepolish-1[1].3-beta3.jar file, but i dont know how to use it with netbeans5.0 IDE.
    (by exploring tutorials we have to change the build .xml file ) but it is not clear to me.
    Can you help me how to use j2mepolish with netbeans or any other way.

  • Canvas Resize to Square for a large number of images using script. E.g. image is currently 1020 x 600, I would like to change this to 1020 x 600. PLEASE HELP

    Hi All,
    I have a large number of images that I need to resize the canvas sizes to a square, the images are currently in different sizes. For example, if an image is 1020 x 600 I would like to change the canvas to 1020 x 1020 so that the image becomes a square. I am using CS3 and all the images are jpeg's. I have done research on scripts but the ones I have tried have not worked. Please help.
    Thanks.

    Since you do not want to crop your images to a square 1:1 aspect ratio changing the canvas to be square will not make your images square they will retain their Aspect Ratio and  image size will be changer to fit within your 1020 px square. There will be a border or borders on a side or two borders on opposite sides.   You do not need a script because Photoshop ships with a Plug-in script to be used in Actions.   What is good about Plugins is the support Actions.  When you record the action the plug-in during action recording records the setting you use in its dialog into  the actions step.  When the Action is played the Plug-in use the recorded setting an bypasses displaying its dialog. So the Action can be Batch.  The Action you would record would have two  Steps.   Step 1  menu File>Automate>Fit Image... in the Fit Image dialog enter 1020 in the width and height  fields.  Step 2 Canvas size enter 1020 pixels in width and height  not relative leave the anchor point centered it you want even borders on two sides set color to white in the canvas size dialog. You can batch the action.
    The above script will also work. Its squares the document then re-sizes to 1020x1020  the action re-sizes the image to fit with in an area 1020 x 1020 then add any missing canvas. The script like the action only process one image so it would also need to be batched. Record the script into and action and batch the action. As the author wrote. The script re size canvas did not specify an anchor point so the default center anchor point is uses  like the action canvas will be added to two sides.

  • Red circles with red squares inside?

    I have red circles with red squares inside, prohibiting me from playing some of my music, playlists etc. ???

    It means your songs have not properly downloaded to your iPad/iPhone.
    I believe this is an ios7 problem due to more crap code from apple.
    If anyone has a good solution—aside from completley resetting your device—please type it here.

  • ERROR while uploading the data into ztable with background processing

    Hi gurus,
    i am trying to upload the data from excel file to internal table 
    its working fine ..
    but........
    if i try to upload the data with background processing , in sm37 it is saying "error during the upload of clipboard contents".
    Regards,
    Sri

    Hi,
    FM GUI_UPLOAD doesnt work in background, use dataset to upload it from application server.
    refer below code
    *--Local Variables
      DATA : l_file  TYPE string,
             l_line  TYPE string,
             l_index TYPE sy-tabix.
    *--Clear
      CLEAR : l_file.
      l_file = p_ipfile.
    *--Read the data from application server file.
      OPEN DATASET l_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      IF sy-subrc NE 0.
    *--Error in opening file
        MESSAGE i368(00) WITH text-005.
      ENDIF.
    *--Get all the records from the specified location.
      DO.
        READ DATASET l_file INTO l_line.
        IF sy-subrc NE 0.
          EXIT.
        ELSE.
          SPLIT l_line AT cl_abap_char_utilities=>horizontal_tab
                          INTO st_ipfile-vbeln
                               st_ipfile-posnr
                               st_ipfile-edatu
                               st_ipfile-wmeng.
          APPEND st_ipfile TO it_ipfile.
        ENDIF.
      ENDDO.
    Regards,
    Prashant

  • 570 GTX lockup with white squares

    Card: MSI 570 GTX (N570GTX M2D12D5/OC)
    Driver: Nvidia 270.61
    Bios updated to latest (KK1)
    According to MSI Afterburner I am running the stock settings: 988mV core voltage, 786MHz Core/1572MHz Shader/2100MHz Memory.
    I have never overclocked the card beyond the stock OC that the card comes with.
    When playing the game Rift after about an hour, sometimes less little white squares show up all over both of my monitors and then within a few seconds the computer locks up.
    MSI Kombustor seems to work ok, I haven't run it indefinitely but it makes it through the default benchmark.  I tried another stress program called OCCT.  I ran that for about 20 minutes with default shader complexity (0) and it produced 1 error and no crashes.  I tried it again with shader complexity 4 (out of 8) and every minute or two it would signal an error then after about half an hour I got the same lockup with the white squares.  So far I have only seen this lockup occur in Rift and with OCCT.  I beat Portal 2 in single player and Coop and played several hours of Shogun 2 with no issues.
    This is actually my second 570.  My original one started producing artifacts constantly and games were completely unplayable.  I RMA'ed it a week or two ago and now this card is presenting a different problem.
    Rest of my computer:
    Windows 7 Home Premium (64bit)
    Intel Core i5 760 at stock (2.80GHz)
    8GB DDR3 Ram
    750 Watt Silverstone power supply
    Any suggestions on what to try next?  Is the card bad?  I didn't see any references to this exact problem when I tried searching the MSI forums.  Though I did run across another forum where someone was having the same problem.  I don't think they found a solution though.
    Snapped a picture of the frozen screen with white squares:

    Good to hear   
    Maybe Svet can make you a custombios, so you can flash your cards bios, then you dont have to use Afterburner all the time.
    Hope he reacts 

  • Screen light auto turn dark when I use program/web with background dark in windows 8.1

    Hi there,
    I used HP Pavilion dv6t-6000 CTO Quad for 3 years.
    CPU: Intel core i7-2630QM
    GPU: AMD Radeon 6490m
    It build in windows 7 and I manual install ( fresh install ) windows 8. It's fine. But when I upgrade to windows 8.1, it have an issue and I really hate it.
    When I use "Sublime Text" ( with background is black ), the screen light is become darker. And when I back to ( e.g: a website with background is white ), the screen turn back to lighter.
    I tried many ways, included 4 ways here but it's NOT WORK. 
    NOTE: When I used Option 1 ( upper )
    1. Open PC settings, and click/tap on PC and devices on the left side
    2. Click/tap on Power and sleep on the left side, and turn on or off Adjust my screen brightness automatically on the right side under Brightness.
    ==> It's NOT SHOW button "Adjust my screen brightness automatically". It mean: I have NO built in auto brightness sensor.
    I think this issue is about AMD driver or Intel Graphic driver.
    Is anybody have idea???

    Hi @kolz,
    Welcome to the HP Forums!
    It is a wonderful  place to find answers and solutions!
    For you to have the best experience in the HP forum I would like to direct your attention to the HP Forums Guide Learn How to Post and More
    i grasp that after updating your system from Windows 8 to 8.1 you are having an issue with the display going dim.
    You have tried some steps you located on the web but there was no change.
    Windows 8 an 8.1 are not supported Operating Systems for your notebook.  This does not mean they will not work only that HP has not tested it and therefore does not supply updated drivers.  You would need to check the manufacturer's site for any updated drivers.
    Downloading or Updating Software and Drivers for HP Computers
    When I checked the driver page for your notebook I did notice there is a  bios update, have you done that?
    HP Pavilion dv6t-6000 CTO Quad Edition Entertainment Drivers and Software
    As a bios update does have a potential to cause damage I suggest contacting HP support for assistance with that process.
    Updating the BIOS
    Please call our technical support at 800 474 6836. If you live outside the US/Canada Region, please click the link below to get a support number for your region.
    World Wide Phone Support
    Good Luck!
    Here is a link to Troubleshooting a dim display (Windows 8, Windows 7 and Windows Vista)
    Sparkles1
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the bottom right to say “Thanks” for helping!

  • How to add the text box with background color in Acrobat 9 Pro ? (Urgent)

    I have previously used the Callout tool to add the comments in a PDF file, but the comments were difficult to read as some of them were mixed with the pictures just shown below. Therefore , I hope that there's a tool that can create the box with background color, but I cannot find such tool. What should I do ? Hope to get the answer ASAP, as it's very urgent !
    P.S. The picture below is represent the problem: the comment are difficult to read.

    In the properties of the callout comment you can change the fill color.

  • I have a problem with black squares in the contact list on facebook, but it is only in Firefox, I no longer know what to do? I'm using Windows 8

    I have a problem with black squares,rectangles, etc, in the contact list on facebook, but it is only in Firefox, I no longer know what to do? I'm using Windows 8.

    '''Try the Firefox Safe Mode''' to see how it works there. The Safe Mode is a troubleshooting mode, which disables most add-ons.''
    ''(If you're not using it, switch to the Default theme.)''
    * You can open the Firefox 4.0+ Safe Mode by holding the '''Shift''' key when you use the Firefox desktop or Start menu shortcut.
    * Or use the Help menu item and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    ''Don't select anything right now, just use "'Start in Safe Mode"''
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shift key) to open it again.''
    '''''If it is good in the Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one.
    Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''

  • FF36: Sites with background image flickers/flashes when going back to tab after 2 minutes.

    Figure I'll mention this here as well.
    When viewing websites with background images, such as twitter.com or my own website at www.markheadrick.com and I change to another tab for 2 minutes (this amount of time is repeatable anyway) I get a flicker of a black background before the page is fully drawn. If I have multiple tabs with the same background image, only the first tab will show the flicker. It's like it's loosing the image in memory or something. It has done this with Firefox in Safe Mode and with a new, clean profile. It has also done this with Hardware Acceleration off.
    Windows 7 Pro 64bit w/ NVidia 550ti and 314.22 drivers. Newer drivers are more problematic which is why I have stayed with these.
    Again, only pages with background images seem to show this flicker. Did not happen with Firefox 35 on my system.
    I created a bug for it here: https://bugzilla.mozilla.org/show_bug.cgi?id=1137082
    Thanks,
    Mark H

    I tried, but could not see and problem.
    Hello,
    In order to better assist you with your issue please provide us with a screenshot. If you need help to create a screenshot, please see [[How do I create a screenshot of my problem?]]
    Once you've done this, attach the saved screenshot file to your forum post by clicking the '''Browse...''' button below the ''Post your reply'' box. This will help us to visualize the problem.
    Thank you!

  • PDF printing of web-pages WITH background?

    How do I make it possible to have the background image/pattern/colour etc. of a web-page included when I "print" to PDF?
    Whenever I print a web page with something in the background other than white it's missing in the PDF file. This happens in my daily-use browser (Seamonkey), but also in Safari. However, in iCab (http://www.icab.de/) the background is included in the PDF file, so at least it's possible in MacOS. I just can't find any settings for it.

    Yes, this worked! Thanks!
    Another neat trick I found is that you can save the different settings. Just go to the "presets" part of the print menu, then save the current setting. For example by naming it "PDF printing with background".
    Then turn off the background colour/image/pattern and save it as a new preset (e.g. "Print (to paper)").
    That way you don't need to waste lots of ink, but at the same time you'll get the complete web-page with background and all when you save it as a PDF file. Just remember to select the right preset before you "print".

  • Long canvas with scroll bar

    Hi. I have a form with a very long canvas containing more items than fit on the screen at a time - meaning some items are far down on the canvas and do not appear unless the user physically uses the mouse and scrolls down. This causes a problem for me because as the user tabs through the various fields the cursor will eventually "appear" to disappear. It has not actually disappeared of course, but it has simply navigated to an item that is further down on the canvas out-of-sight. Thus the user must recognize that this has happened and then use the mouse to scroll down and find the cursor again.
    Is there a way to automatically coordinate this scrolling so that the cursor always stays in view for the user - meaning that the user will never have to manually scroll down to find the cursor? Or worst case, can I programatically scroll down for the user so that the cursor always remains visible?
    Any help would be greatly appreciated. If you have any sample code please send it to: [email protected]
    Thanks in advance.
    Edited by: Buechler on Jun 30, 2009 12:20 PM

    -> 3) Changed the default Window width to 5 and it's height to 12
    Don't do that. That apparently guarantees the problem you have.
    The Window size should be no larger than will fit on the user's screen, and the user running the lowest screen resolution should be your target. We create forms no larger than will fit on the 800x600 layout. Our forms always use the Real,Pixel coordinate system, and I create forms with the window size set to a maximum of 784x442. Those reduced numbers allow the form to fit within a browser window in web forms. Our forms run under both 6i Client/Server AND Web, and there is a pre-form that adjusts the web form window size a little larger, but that is all.
    Also, when you run your form, that scrollbar you see is there because your window is not maximized. Our forms always maximize the window, and even have a when-window-resized trigger with this:
    <pre><font face = "Lucida Console, Courier New, Courier, Fixed" size = "1" color = "navy">DECLARE
    W0 Window := Find_Window('WINDOW0');
    BEGIN
    If Get_Window_Property(W0,Window_State)<>'MAXIMIZE' then
    Set_Window_Property(W0,Window_State,Maximize);
    End if;
    END;</font></pre>
    The wwr trigger ensures the user never sees the Window0 border -- it is useless unless you are running a form with multiple windows, which we never do.
    So.... Maximize your Window0, and then you will see the behavior I have been describing. Create a stacked canvas with a vertical scrollbar, and it will behave even better.

  • Flash with background sound (I got error #2037)

    Hallo.
    I am a beginner at AS3 programming. I like to make a flash with background sound (*.mp3 files from *.xml list). Everything works fine, but when I press "onClick" button I got output error.
    Error: Error #2037: Functions called in incorrect sequence, or earlier call was unsuccessful.
        at flash.media::Sound/_load()
        at flash.media::Sound/load()
        at proov_fla::MainTimeline/F_MP3_laadimine()
        at flash.events::EventDispatcher/dispatchEventFunction()
        at flash.events::EventDispatcher/dispatchEvent()
        at flash.net::URLLoader/onComplete()
    My Script:
    var MP3_PLAYLIST:String = "playlist1.xml";
    var LAADI_MUUSIKA:URLRequest;
    var MUUSIKA:Sound = new Sound();
    var MUUSIKA_KANAL:SoundChannel = new SoundChannel();
    var HETKE_MUUSIKA:Sound = MUUSIKA;
    var POSITSIOON:Number;
    var HETKE_INDEX:Number = 0;
    var KAS_MUUSIKA_MÄNGIB:Boolean = true;
    var XML_FAIL:XML;
    var MUUSIKA_NIMEKIRI:XMLList;
    var MP3_LAADIJA:URLLoader = new URLLoader();
    MP3_LAADIJA.addEventListener(Event.COMPLETE, F_MP3_laadimine);
    MP3_LAADIJA.load(new URLRequest(MP3_PLAYLIST));
    onClick.addEventListener(MouseEvent.CLICK, järgminelugu);
    function järgminelugu(e:MouseEvent):void
        MP3_PLAYLIST = "playlist2.xml";
        MP3_LAADIJA.load(new URLRequest(MP3_PLAYLIST));
    function F_MP3_laadimine(e:Event):void
        XML_FAIL = new XML(e.target.data);
        MUUSIKA_NIMEKIRI = XML_FAIL.track;
        LAADI_MUUSIKA = new URLRequest(MUUSIKA_NIMEKIRI[0].path);
        MUUSIKA.load(LAADI_MUUSIKA);
        MUUSIKA_KANAL = MUUSIKA.play();
    My full purpose will look like this http://uusrand.pri.ee/galerii/proov/

    Hallo.
    Can anybody help me to add an actionscript line(s) into attach file "newXML.fla".
    In this file I have a script to play mp3 files from xml list (this works).
    I also add button to load new mp3 fileslist from new xml file. But I don't know how.
    My Script:
    var MP3playlist:String = "http://uusrand.pri.ee/mp3/playlist.xml";
    var MP3file:URLRequest;
    var MP3SoundURL:Sound = new Sound();
    var MP3sound_channel:SoundChannel = new SoundChannel();
    var xml:XML;
    var playlist_index:XMLList;
    var xml_loader:URLLoader = new URLLoader();
    var MP3index:Number = 0;
    xml_loader.addEventListener(Event.COMPLETE, originalXMLfile);
    xml_loader.load(new URLRequest(MP3playlist));
    onClick.addEventListener(MouseEvent.CLICK, nextXMLfile);
    function nextXMLfile(e:MouseEvent):void
        if (MP3playlist == "http://uusrand.pri.ee/mp3/playlist_loodus.xml") {
            MP3playlist = "http://uusrand.pri.ee/mp3/playlist.xml";
        } else {
            MP3playlist = "http://uusrand.pri.ee/mp3/playlist_loodus.xml";
    function originalXMLfile(e:Event):void
        xml = new XML(xml_loader.data);
        playlist_index = xml.track;
        MP3file = new URLRequest(playlist_index[0].path);
        MP3SoundURL.load(MP3file);
        MP3sound_channel = MP3SoundURL.play();
        MP3sound_channel.addEventListener(Event.SOUND_COMPLETE, nextSong);
    function nextSong(e:Event):void
        if (MP3index < (playlist_index.length() - 1)){
            MP3index++;
        } else {
            MP3index = 0;
        var NextSongRequest:URLRequest = new URLRequest(playlist_index[MP3index].path);
        var NextSongURL:Sound = new Sound(NextSongRequest);
        MP3sound_channel.stop();
        MP3sound_channel = NextSongURL.play();
        MP3sound_channel.addEventListener(Event.SOUND_COMPLETE, nextSong);

  • Why does my music have a red circle with a square dot beside it?

    On my iPad 3, in music, some of my songs have a red circle with a square dot, the songs are grayed out and I am unable to play them. Is there a new setting with ios 7? Does it no longer play mp3's?

    Here's what I had to do, no thanks to the others on here who go at it like Apple, delete and restore.
    No, you don't have to delete and restore. Just open a folder on  your computer, call it something like iPad music, keep it open, open iTunes, select all your music, copy and paste it in the folder you just created, delete all your music from iTunes (relax, you just copied it into that folder). Select all the music in that folder, drop it back onto your playlist. Now, I renamed my playlist, because it was called untitled, originally, so if that doesn't work, rename, or delete and recreate your playlist, copy the music back over, sync, and they will play.
    Worked for me, anyhow. Good luck!
    <Edited by Host>

Maybe you are looking for

  • Importing from one iphoto library to another--how to?

    I want to go into a large iphoto library and break it up into several smaller ones. I currently have two iphoto libraries which, it turns out, are much bigger than the optimal size. One is 25 gigs and the other 71 gigs. I was told that 5000 pictures

  • In Bridge- Edited CR2 Files(JPG/TIF) Are Not Lining Up next to CR2 File

    I had this problem once before and the forum got it fixed. I now cannot find that "discussion" After editing a file in Bridge and saving in Bridge as a TIF or JPG, When it places the file back in Bridge it appears not next to the CR2 file but at the

  • How to run Servlet on Tomcat 4.0.1?

    OK. I've made a simple servlet and using Tomcat 4.0.1 on Windows ME. Tomcat's root directory is C:\jakarta-tomcat-4.0.1\webapps\ROOT. I copied folder with my servlet (java's class) in tomcat's root folder. When I try to run the dialog 'File Download'

  • Idoc type used for an output type

    Hi experts, How do I find the Idoc structure used by an output type. When i look in nace it only shows the program name as RSNASTED and form routine as EDI_PROCESSING. Thanks, Raghu.

  • PROCESS FLOW FOR LOOP IN BUSY STATE

    Hi, I have designed a process flow, in which FOR loop has been incorporated,within the loop FTP activity along with check of file exsistence is done, if file does not exsist ,it again tries to perform successful FTP, else map the file to table and as