Setting Canvas Background Color issue

For some reason I cannot set a color for my canvas background. I have tried using setStyle('backgroundColor', colorNumber); in actionscript and setting directly in the mxml with no success. It only takes the value that is set in the design mode of Flex.  Ideally I want to load in a color value from an xml file and use that color value, which I have been doing for other components, but for some reason the canvas will not work. Any ideas???

Ok this is complete code, where i'm reading xml through wrapper which you can do it through HTTPservice. Make sure you put proper swf name while embeding.
<!--------------------------------------------------------------mxml code---------------------------------------------------------------------->
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="create()" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #FFFFFF]">
<mx:Script>
<![CDATA[
import mx.utils.ColorUtil;
import com.anychart.visual.fill.Fill;
import com.anychart.styles.Style;
import mx.collections.XMLListCollection;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
[Bindable]
      public var inputdata:XMLListCollection;
      [Bindable]
     public var canvasData:String;
     [Bindable]
     public var list:XMLList;
     [Bindable]
     public var mycolors:Array = new Array();
     public var count:int=0;
     public var clrname:String;
    public function create():void{
    //Reading data from wrapper
    canvasData=mx.core.Application.application.parameters.canvasData;
    //convert into xml      
        list = new XMLList(canvasData);
        //datasource
        inputdata = new XMLListCollection(list);
        for(var j:int=0;j<3;j++){
    for each(var item:XML in inputdata){
mycolors[j] =item..name[j].toString();
    public function showme():void{
    var value:String=" ";
    for(var i:int=0;i<3;i++){
    value = mycolors[i]+"\n"+value;
    Alert.show(value);    
    public function change():void{
    if(count == 3){
    count=0;
    clrname=mycolors[count];
    else{
    clrname=mycolors[count];
    Alert.show(count+" "+clrname); //This alert line is optional you can remove it all other lines are imp.
    count++;
    mycanvas.setStyle("backgroundColor",clrname);
]]>
</mx:Script>
<mx:Panel x="246.5" y="48" width="500" height="544" layout="absolute" backgroundColor="#E8E5E5">
<mx:Canvas id="mycanvas" x="55" y="40" width="370" height="436" backgroundColor="0xFFFFFF" cornerRadius="20">
<mx:Label x="51" y="55" text="This is Canvas" width="147" height="23" fontSize="17"/>
<mx:Button id="btn1" x="51" y="99" label="Show me" click="showme()"/>
<mx:Button id="btn2" x="152" y="99" label="Change"  click="change()"/>
</mx:Canvas>
</mx:Panel>
</mx:Application>
<-------------------------------------------------------------------------------jsp code where swf embeded--------------------------------------------------------------------------->
<html lang="en">
<head>
<title></title>
<%
    String canvasData = "<values><name>0xE4F9A0</name><name>0xA5BC4E</name><name>0x6693B0</name></values>";
%>
</head>
<body scroll="no">
  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="problem" width="100%" height="100%"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="problem.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#869ca7" />
<param name="allowScriptAccess" value="sameDomain" />
<param name='FlashVars' value='canvasData= <%= canvasData %>'/>
<embed src="problem.swf" quality="high" bgcolor="#869ca7"
width="100%" height="100%" name="problem" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer"
FlashVars="canvasData= <%= canvasData %>">
</embed>
</object>
</body>
</html>

Similar Messages

  • How 2 set the background color in j2me

    Can any body tell me how to set the background color to midlet.??

    if you are using Screen then you can call its setBackColor()
    or if you are using Canvas then you can call
    g.setColor(r,g,b);
    g.fillRect(0,0,getWidth,getHieght);
    where g is the Graphics instance of Canvas,for further information consult documentation

  • AS2 TextInput Background Color - Issues when trying to change dynamically

    Hello,
    I'm having issues changing a TextInput background color after the initial onLoad using AS2.
    On load, I have no issues setting the background color with this code:
    Code:
    onClipEvent (load) {
        this.background = true;
        this.backgroundColor = 0x1E1C1C;
    However, I have a form validator run when focus is lost but yet I cannot set the background color at that point. For example, I'm trying to set the background color to orange and text to white if the field's contents are invalid. Even something simple like this doesn't affect the colors.
    Code:
    on (focusOut) {
            this.backgroundColor = 0xFAA523;
            this.borderColor = 0xFAA523;
            this.borderStyle = "solid";
            this.color = 0xFFFFFF;
            this.text = 'Enter your first name';
    All code is in actions for the TextInput itself.
    Anyone know what I'm doing wrong?
    Thanks in advance!

    Actually, that's not the solution. You need to use setStyle to access the backgroundColor property when the TextInput is already generated.
    This worked for me:
    this.setStyle("backgroundColor",0x1E1C1C);

  • Change viewer/canvas background color?

    When I have a HD clip in the canvas window I get the letterbox look.
    The bars are currently grey which I assume is default.
    Is there anyway to change the canvas background color to black?

    Just hit Control + U if you fancy the standard layout
    or go to FCP main menu>Window>Arrange> Two Up
    if you fancy a more useful layout (IMO).
    These actions will clear the confusion.
    I have the Two Up view shortcut set to Shift + 2 (You can choose your own).
    You can achieve that by customizing your keyboard shortcuts (Alt/Otion + H to start with keyboard layout customization).
    Luca

  • Defaule Canvas background color - Forms 6i

    How do i set the default forms canvas color. I changed the canvas background color to blue. i want my original color back. The property of foreground color is <Unspecified>. I need the same for background.

    r u doin this on Runtime ? i thought u r talking abt design time....coz sometimes builder stuck with color of canvas
    if yes then set_canvas_property('canvasname',background_color,'colorname');
    Baig
    [My Oracle Blog|http://baigsorcl.blogspot.com/]
    Edited by: Baig on Jan 28, 2010 2:29 PM

  • Canvas background color bug

    Hey,
    abviously there is a bug in the new Adobe Reader X.
    The Adobe Reader crashes at start up when setting the background color of the 3D annotation canvas with the following function:
    In Adobe Reader 9.x this worked for me!
    //=============================
    function changeBGcolor()
    var topColor = new Color(1.0, 1.0, 1.0);
    var bottomColor = new Color(0.5, 0.5, 0.7);
    var myRenderObject = new RenderEventHandler();
    myRenderObject.onEvent = function(event)
    var theCanvas = event.canvas;
    theCanvas.background.setColor(topColor, bottomColor);
    runtime.addEventHandler( myRenderObject );
    changeBGcolor();
    //===========================

    I am using Windows Vista 64bit and I create the PDF with the iText library, but as I said, with Adobe Reader 9.x everything worked fine for me. Now, with Adobe Reader X, that does not work.:(

  • How to set a background color to view

    Hi All,
              i creared a view with 2 textboxes and a button.These elements are in TransparentContainer.I set the background color to the TransparentContainer.By setting color to the TransparentContainer it is comming at the center and the 4 sides of it is displaying in the normal background color of the browser
    i didnt find any color options for the view called RootUIElementContainer.the width and height of the view are setted to the browser means 1024*768.
    Just like sap editor which we get by the link https://www.sdn.sap.com i want to get my view .....
    I want to set color to this RootUIElementContainer element which effect the whole view...not the containers or groups which i add under this RootUIElementContainer
    Regards
    Padma N

    hi Padma,
    For changing the background colour you will have to make the change in the theme.
    You can download the theme editor plugin for eclipse from SDN. With this plugin, you can make changes to the default themes , save as a new theme
    Or if you are using portal, then goto system administrator, theme editor, select SAP Streamline and change the color in Screen areas -> application, then save the theme with different name.
    Best regards,
    Sangeeta

  • Dynamically Set Subreport Background Color to the Same Value as Main Report Background Color

    I have a report that contains a subreport.  The main report has groupings in it.  I am dynamically setting the background color of the group rows based on an expression.  That part is working fine.  The problem that I am having is that
    I don't know how to get the subreport to "inherit" the background color of the grouping that holds it.
    Basically, I have different row shadings on my report differentiating the groupings except for the rows where the subreport shows.
    How do I go about setting the subreport background color to equal it's contaiing grouping's background color?  Thanks in advance for any and all assistance provided.

    The parameter method given by gpshukla will send the info to the subreport, but you don't need the color parameter in the main report, only the subreport. The trick is in setting the value of that parameter.
    Right-click the cell with the embedded subreport, you can select subreport properties.
    Select Parameters and add a parameter.
    The name column is the name of the parameter in the subreport (color) and value is the value to set it to.
    Set name to "color" (no quotes).
    Set Value to the same expression used to set the background color for the row.
    In the subreport, click the design surface to select the report (not header or footer).
    In the properties pane, select background color and choose expression from the dropdown.
    Type =Parameters!color.Value into the expression builder.
    This will work assuming that background color in the main report row will not change without also refreshing the subreport.
    "You will find a fortune, though it will not be the one you seek." -
    Blind Seer, O Brother Where Art Thou
    Please Mark posts as answers or helpful so that others may find the fortune they seek.

  • Can I invoke a SubVI in an event? and how do I set the background color of a pipe to #0000ff?

    When I click an image or a glass pipe(which belongs to Industry/Chesmitry category in palette), I want a SubVI to be invoked.
    The purpose is to fetch an OPC-UA data from a web service and to write to it via the service.
    We are building an HMI solution which displays an interactive water plant diagram.
    When users click pipes and motors in the diagram, clicked devices should be turned on and off and change their animations or colors accordingly.
    OPC-UA is for communication with devices.
    I couldn't even set the background color of a pipe to "#0000ff", but setting it to "Red" or "Blue" was possible, and I don't know how to invoke SubVIs in event scripts.
    The documentations in NI.com are confusing and lack depth.
    Even silverlight references are confusing.
    How do I do all of these?

    Hi iCat,
    Can you provide some more information about your current implementation so that we can help to answer your questions. Some questions I have for you are:
    Are you creating this project in the NI LabVIEW Web UI Builder or in LabVIEW?
    How are you publishing your webservice? Is this also in LabVIEW?
    How is your webservice interacting with an OPC-UA server?
    How is the certification set up with OPC-UA so that you can communicate between the server and the client?
    Best Regards,
    Allison M.
    Applications Engineer
    National Instruments
    ni.com/support

  • How to set the Background Color of a Text Field in a Tabular Report.

    Hello,
    I tried to set the Background Color of a Text Field in a Tabular Report.
    But I was not able to change this colur.
    In the report attributes --> column attributes
    I tried already:
    1. Column Formating -- >CSS Style (bgcolor: red)
    2. Tabular Form Element --> Element Attributes (bgcolor: red)
    but nothing worked.
    Can anybody help me?
    I Use Oracle Apex 2.2.1 on 10gR2
    thank you in advance.
    Oliver

    in "Report Attributes" select the column to move to the "Column Attributes" page. In the "Element Attributes" field under the "Tabular Form Element" region enter
    style="background-color:red;"
    I will also check if there is a way to do this via the template and post here again
    edit:
    in your template definition, above the template, enter the following:
    < STYLE TYPE="text/css" >
    .class INPUT {background-color:red;}
    < /STYLE >
    (remove the spaces after the < and before the >)
    change "class" to the class that the template is calling
    (I'm using theme 9, the table has: class="t9GCCReportsStyle1" so I would enter t9GCCReportsStyle1)
    A side-effect of using this second version is that ALL input types will have a red background color--checkboxes, input boxes, etc.
    Message was edited by:
    TheJosh

  • How do I set the background color of a page_item?

    I've been pasting "background-color:#5CD65C" in a number of places, like "HTML Table Cell Attributes" under the Label and the Element tabs, but get no results. Can anyone tell me how to set the background color of a cell, please?

    Hi Doug,
    Dynamic Actions is an alternative also, especially if it is conditional.
    Action Set Style
    Fire When Event Result Is True
    Style Name background-color
    Value #5CD65C
    Selection Type DOM Object
    DOM Object your item name
    Set your Condition Type and you have it.
    Jeff
    Edited by: jwellsnh on May 24, 2011 3:55 PM

  • How can I set the background color of JLabel?

    Can any one tell me how to set the background color of a JLabel?
    I have:
    JLabel prop = new JLabel("blahblah");
    prop.setBackground(Color.red);
    Thank you in advance...

    JLabel prop = new JLabel("blahblah");
    prop.setBackground(Color.red);
    prop.setOpaque(true);

  • UITableView: set different background colors for header and the table

    I would like to set my background color for my UITableView to white and set my tableViewHeader backgroundColor to grayColor similar to the facebook app. When I bounce scroll my table so that you can see above the header, then currently it is white above the header view. I want that to be brown instead.
    In the facebook app, above the headerview, it is a blue color and below the table is a white color. If i try and set the UITableView backgroundColor to brown, then the top will be brown, but so will the bottom. Additionally, all of the unset cells will have a brown background instead of white.
    Any help with this?

    Fixed..

  • Setting JScrollPane background color.

    Does anybody know how to set what color appears in the background of a JScrollPane when the Component in the pane is smaller than the pane itself?
    In particular, I have a JTable in a JScrollPane, and when the pane is bigger than the table, the gray default background of the viewport looks weird behind the white background of the table.
    MyScrollPane.setBackground() doesn't do it, neither does MyScrollPane.getViewport().setBackground().
    Thanks in advance,
    Jason

    This might explain some things, hope it helps...
    it's a cut and paste from the JScrollpane source....
    A common operation to want to do is to set the background color that will be used if the main viewport view is smaller than the viewport, or is not opaque. This can be accomplished by setting the background color
    of the viewport, via scrollPane.getViewport().setBackground().The reason for setting the color of the viewport and not the scrollpane is that by default JViewport is opaque which, among other things, means it will completely fill in its background using its background color. Therefore when <code>JScrollPane</code> draws its background the viewport will usually draw over it.

  • Why does the eyedropper tool set the background color swatch instead of the foreground?

    Whenever I try to use the eyedropper tool in Photoshop CS5, the eyedroper sets the background color instead of the foreground. I know you can swap the colors with the arrows, but Photoshop used to be able to just put the color in the foreground swatch without me doing any extra manual work. How do I restore it?

    Click on Windows and color.  There is a setting there to change from
    foreground to background.  The one with the box around it is the default setting.

Maybe you are looking for

  • Problem with apple I'd showing on messages!

    Guys, I don't have an iPhone, only an iPad. I've just registered an apple I'd. Now when I send messages, my email add shows and I don't want that. Does anyone know how I can change this to my name instead? Pls help guys it's annoying me!

  • How does workflow retrieve users under an org. unit when sending email

    Dear All: Workflow supports sending email activity where you can specify the receipt type and receipt ID. For example, the email is supposed to send to the users within an organizational unit. I am just wondering how SAP workflow determines the users

  • I need to install acrobat pro on a new laptop

    Earlier I had subscribed to acrobat pro now that laptop has crashed want to install in new laptop

  • Best Sequence Preset for Canon HG 10?

    Hi guys, i have a Cannon HG10, but i am confused on which Sequence Preset to choose when starting a new project. My settings for the Cannon are 1920x1080, 15mbps, PF25 (frame rate), 1080i I want to choose the best settings possible for the best quali

  • Safari Browser page

    How Can I get my Safari browser to print the website address of each website I go to. It used to do this but I can no longer either find the exact address of the website I'm at or type in an address and go directly there?