How to create a Image object from action script

I need to set the back ground of charting dynamically, thus I need to create Image from a png/gif files. I have wrritten following code, but doesn't work.
public function addBackground():void
    var cbg:ChartBackground=new ChartBackground();
    var bgs:Array=new Array();
    bgs.push(cbg);
    lineChart.backgroundElements=bgs;     
package arubaUI
    import mx.controls.Image;
    [Embed(source="../assets/chart_16.png")]   
    public class ChartBackground extends Image
Does any one knows how to do that?
Thanks!

I put the code like and got compile error:
public class ArubaLinePanel extends Panel
  private var lineChart:LineChart;
  private var lineData:ArrayCollection=new ArrayCollection( [
            { Month: "Jan", Profit: 2000, Expenses: 1500, Amount: 450 },
            { Month: "Feb", Profit: 1000, Expenses: 200, Amount: 600 },
            { Month: "Mar", Profit: 1500, Expenses: 500, Amount: 300 },
            { Month: "Apr", Profit: 1800, Expenses: 1200, Amount: 900 },
            { Month: "May", Profit: 2400, Expenses: 575, Amount: 500 } ]);
  public function ArubaLinePanel()
        super();           
        lineChart=new LineChart();
        lineChart.dataProvider=lineData;
        lineChart.showDataTips=true;
        var axisX:CategoryAxis=new CategoryAxis()
        axisX.categoryField="Month";
        lineChart.horizontalAxis=axisX;
        var seriesArray:Array = new Array();
        var ls:LineSeries=new LineSeries();
        ls.yField="Profit";
        ls.displayName="Profit";
        seriesArray.push(ls);
        lineChart.series=seriesArray;
        this.addChild(lineChart);
        var legend:Legend=new Legend();
        legend.dataProvider=lineChart;
        this.addChild(legend);       
        addBackground();
public function addBackground():void
    var cbg:ChartBackground=new ChartBackground();
    var bgs:Array=new Array();
    bgs.push(cbg);
    lineChart.backgroundElements=bgs;     
Another method I tried:
package arubaUI
    import mx.controls.Image;
    [Embed(source="../assets/chart_16.png")]   
    public class ChartBackground extends Image
There is no compile error, but image is not show on screen,
Thanks!
April

Similar Messages

  • How to pass arraylist of object from action class to jsp and display in jsp

    I need to do the following using struts
    I have input jsp, action class and action form associated to that. In the action class I will generate the sql based on the input from jsp page/action form, create a result set. The result set is stored as java objects in a ArrayList object.
    Now I need to pass the arraylist object to another jsp to display. Can I put the ArrayList object in the request object and pass to the success page defined for the action? If this approach is not apprpriate, please let me know correct approach.
    if this method is okay, how can I access the objects from arraylist in jsp and display their property in jsp. This java object is a java bean ( getter and setter methods on it).
    ( need jsp code)
    Can I do like this:
    <% ArrayList objList = (ArrayList)request.getattribute("lookupdata"): %> in jsp
    (***I have done request.setattribute("lookupdata", arraylistobj); in action class. ***)
    Assuming the java object has two properties, can I do the following
    <% for (iint i=0. i<objList.size;I++){ %>
    <td> what should i do here to get the first property of the object </td>
    <td> what should i do here to get the first property of the object </td>
    <% }
    %>
    if this approach is not proper, how can I pass the list of objects and parse in jsp?
    I am not sure what will be the name of the object. I can find out how many are there but i am not sure I can find out the name
    thanks a lot

    Double post:
    http://forum.java.sun.com/thread.jspa?threadID=5233144&tstart=0

  • How to create a Document object from a string.

    If I use the following code, the input String cannot contain "\n", otherwise, it generates errors.
    in the following code, inputXMLString is a String object that has xml content.
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document document = builder.parse(new InputSource(new StringReader(inputXMLString)));          How can I create a Document object from a string with "\n" in the string?
    Thanks.

    If I use the following code, the input String cannot
    contain "\n", otherwise, it generates errors.That's going to be a huge surprise to thousands of people who process XML containing newline characters every day without errors.
    Perhaps your newline characters are in the middle of element names, or something else that causes your XML to be not well-formed. I'm just guessing here, though, because you didn't say what errors you were getting.

  • How to create resized image instance from an existing image

    It looks like the image class does not provide a possibility to create a resized instance. Image#impl_getURL() would be good enough to create a resized instance of an existing image - but could be removed in a future release. So what's the preferred way if I have an image object only - there's no information about the based image resource.

    You can resize an image on loading using one of the constructors that takes requestedWidth and requestedHeight parameters. This is useful for preserving memory when (for example) needing to display a large number of thumbnails.
    Additionally, the ImageView class defines resizing functionality for the view of an Image. So you can load the full Image, then display one or more resized versions in ImageView(s).
    If you need, you can retrieve an Image object representing the ImageView by calling snapshot(...) on the ImageView; for most use cases the ImageView itself will be all you need.

  • How can I send Scroling commands from action script?

    I just set both horizontalScrollPolicy and verticalScrollPolicy off, and I wont that the picture will scroll down when the user move his mouse to the bottom of the screen, I created mouse event that shows me mouse coordination in a text bar all what I have left to do is to give the scrolling command, just can't find it, so I am asking your help, hope you will.

    See the Capabilities class to examine the screen resolution:
    The Capabilities class provides properties that describe the system and
    player that are hosting a SWF file. For example, a mobile phone's screen might
    be 100 square pixels, black and white, whereas a PC screen might be 1000 square
    pixels, color. By using the Capabilities object to determine what type of device
    a user has, you can provide appropriate content to as many users as possible.
    When you know the device's capabilities, you can tell the server to send the
    appropriate SWF files or tell the SWF file to alter its presentation.
    For example, here is how you can check the user's screen resolution:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
      creationComplete="init();">
      <mx:Script>
        <![CDATA[
          private function init():void{
            trace("screenResolutionX: " + Capabilities.screenResolutionX);
            trace("screenResolutionY: " + Capabilities.screenResolutionY);
        ]]>
      </mx:Script>
    </mx:Application>

  • How to create an auction website using Action Script 3

    I want to develop an auction website for a flash assignment but I don't know how to go about doing it. Can I get some suggestions?

    If you don't know what you need to create for such a site, then you should try to think of something else that you might have some idea of how to go about doing.  Maybe you should talk to other students or your instructor to get some ideas and to figure out what kinds of things you need to be able to demonstrate with your assignment.

  • How to create a line in flash action script 3.0

    i am trying to create a line that can be draggable and  extedable from start and end points of line. some one help plzz

    what problem are you having?

  • How to create a pdf file from multiple images ?

    Dear All,
    I want to create a SINGLE page pdf file from two or more page size images that are combined to make a single page pdf. Again, this question is on pdfs that are made out of several, atleast  two color images and a black-and-white mask for one of them.
    I have such pdf files from an unknown source (the producer is edited out) whereby there are three tiff images, obtained using the well known pdfimages extractor.
    When I want to make a pdf out of tiff or png or other image formats, I right click and tell Adobe Acrobat to make a pdf.
    However, I dont know how I can give a command to select say,  three tif images and specify which is the mask for which and then join  them in a way that I get the pdf from the composite of the two color images and a mask for one of them.
    Please help me out.
    I am a little familiar with the pdf structure skeleton and when necessary, fixed xref tables in one of my favorite editors. A few years ago, I also wrote a bunch of javascripts to make some annotations and needed some automation and used some itext type libraries. However, I need your help in this problem as I am now rusty and forgot some of what I studied to solve my earlier problems. This is a new problem for me. Gentle hints from you would be very nice to help me in this problem. Please specify if necessary what manual and pages to read. in the pdfspec.
    Best Regards
    Disabled Veteran [physically handicapped]

    Hello Again.
    On Fri, May 11, 2012 at 12:20 PM, lrosenth <[email protected]> wrote:
    >
    > Re: How to create a pdf file from multiple images ?
    >
    > created by lrosenth in PDF Language and Specifications - View the full
    > discussion
    > ________________________________
    >
    > No clue who Irving is…
    >
    I was hoping to have your first name so its easy for me to address you.
    > I have no clue what OS platform, programming language, etc. you use so
    > can’t really narrow things down.
    I would gladly mention that I am working on windows platform, preferably XP.
    I can also work on linux for free products that come with it.
    >  Also, as this is an Adobe forum, we only
    > recommend Adobe products – so there may be other options that even my list
    > wouldn’t include.
    But adding other products, for the help of an adobe products user,
    even if it outside adobe, shall add greater prestige to your company
    and give impression of user-centeredness.
    > If you read ISO 32000-1:2008 (aka the PDF standard), you will find the
    > information about Images and Image Masks well described.  I didn’t think I
    > needed to repeat any of that information.
    Well, just add the few pdf stanzas since you are proficient on it and
    I am presently a little rusty as I mentioned. Just asking a little
    extra yard, not even to go an extra mile.
    > And, if you read that same document, you will see that there is NO SUCH
    > THING as a “text only PDF”.   All PDF documents are structured binary files.
    Well, ascii format or uncompressed format that is human readable. I
    know its a binary file, but human readable ascii version of it.
    I hope you can give me some stanza and various other approaches
    possible so I can select or combine things for myself. I see only a
    miniscule number of posts claiming to have written masks in this forum
    and then with no details.
    Regards
    Roger
    Message was edited by: dying veteran
    because the adobe posting system went crazy and truncated all except the first line ... dunno why

  • How to create Authority check object

    Hello Gurus,
    How to create Authority-check object 'ZABC'
                                                             ID 'TABLE' FIELD 'ZTABLE'.
    Please tell me detailed procedure.
    Thanks in advance.
    Best Regards,
    zubera

    Dear Zubera,
    Creating Authorization Fields
    In authorization objects, authorization fields represent the values to be tested during authorization checks.
    To create authorization fields, choose Tools --> ABAP Workbench --> Development --> Other tools --> Authorization objects ® Fields.
    To create a authorization field:
    1. Choose Create authorization field.
    2. On the next screen, enter the name of the field. Field names    must be unique and must begin with the letter Y or Z.
    3. Assign a data element from the ABAP Dictionary to the field.
    4. If desired, enter a check table for the possible entries. For    more information about check tables.
    For more information about AUTHORITY-CHECK, see the keyword documentation of the ABAP Editor.
    You can often use the fields defined by SAP in your own authorization objects. If you create a new authorization object, you do not need to define your own fields. For example, you can use the SAP field ACTVT in your own authorization objects to represent a wide variety of actions in the system.
    Assigning an Authorization Object to an Object Class
    Each authorization object must be assigned to an object class when it is created.
    Choose Tools --> ABAP Workbench --> Development --> Other tools --> Authorization objects --> Objects.
    You can also create authorization objects in the Object Navigator (SE80).
    Creating / Choosing Object Classes
    The system displays a list of existing object classes.
    Object classes are organized according to the components of the system.
    Before you can create a new object, you must define the object class for the component in which you are working. The objects are not overwritten when you install new releases.
    You can also define your own object classes. If you do so, select class names that begin with Y or Z to avoid conflicts with SAP names.
    Creating an Object
    Enter a unique object name and the fields that belong to the object. Object names must begin with the letter Y or Z in accordance with the naming convention for customer-specific objects.
    You can enter up to ten authorization fields in an object definition. You must also enter a description of the object and create documentation for it.
    Ensure that the object definition matches the AUTHORITY-CHECK calls that refer to the object.
    Do not change or delete authorization objects defined by SAP. This disables SAP programs that use the objects.
    You can regenerate the profile SAP_ALL after creating an authorization object.
    Best Regards,
    Rajesh
    Please reward points if found helpful.

  • How can you move the objects from one server to another?

    how can you move the objects from one server to another?

    Hi,
    Collecting objects for Transporting
    1. rsa1->transport connection
    2. left panel choose 'object type', middle panel choose 'infocube' and 'select objects'
    3. then choose your infocube and 'transfer'
    4. will go to right panel, choose collection mode 'manual' and grouping only 'necessary objects'
    5. after objects collection finished, create request
    6. If they are $TMP, then change the package.
    7. When you click the Save on the change package, it will prompt for transport. Here you can provide an existing open transport request number, or if you like here itself you can create a new one.
    8. You can check the request in SE09 to confirm.
    Releasing Transport Request  
    Lets say you are transporting from BWD to BWQ
    Step 1: In BWD go to TCode SE10
    Step 2: Find the request and release it (Truck Icon or option can be found by right click on request #)
    Note: First release the child request and then the parent request
    Steps below are to import transport (generally done by basis )
    Step 1: In BWQ go to Tcode STMS
    Step 2: Click on Import queue button
    Step 3: Double Click on the line which says BWQ (or the system into which transport has to be imported)
    Step 4: Click on refresh button
    Step 5: High light the trasnport request and import it (using the truck icon)
    Transport
    http://help.sap.com/saphelp_nw2004s/helpdata/en/b5/1d733b73a8f706e10000000a11402f/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/0b/5ee7377a98c17fe10000009b38f842/frameset.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/media/uuid/224381ad-0701-0010-dcb5-d74236082bff
    Hope this helps.
    thanks,
    JituK

  • How to create a BufferedImage object using a .png file on harddisk

    For some application of JFreeChart I want to create a BufferedImage object from png file on harddisk.
    Can anybody tell me how to achieve this?
    Thanks in advance.

    See [this thread|http://forum.java.sun.com/thread.jspa?threadID=5144115].

  • ADF Faces: RichTable - How to create a RichTable object

    Hi. How to create a RichTable object to put in a JSF page ? I need to make a method that receive a list of name of columns and a list of list of data. This code that I have writing don't work. What's my error?
            public RichTable getADFTable(
            List<String> lstCols, List< List<String> > lstLstData
            RichColumn adfCol = null;
            List<RichColumn> lstRichCols = new ArrayList<RichColumn>();
            int cont = 0;
            for( String col : lstCols ){
                adfCol = new RichColumn();
                adfCol.setDisplayIndex(cont++);
                adfCol.setHeaderText( col );
                adfCol.setMinimumWidth( "60" );
                lstRichCols.add( adfCol );
            int contCols = 0;
            RichOutputText text = null;
            RichTable AdfTab = new RichTable();
            for( List<String> lstData : lstLstData){
                for( String data : lstData ){
                    text = new RichOutputText();
                    text.setValue(data);
                    lstRichCols.get( contCols ).getChildren().add( text );
                    contCols++;
                contCols = 0;
            AdfTab.setRows(this.lstEntit.size());
            cont = 0;
            for( RichColumn col : lstRichCols ){
                AdfTab.getChildren().add( col );
            return AdfTab;
        }

    I was searching for an example and i found it but whit errors, finally i fixed and it works.
    You just have to generate the data from your webservices and "put" into this structure.
    The java file (Bean)
    package view;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    import org.apache.myfaces.trinidad.model.CollectionModel;
    import org.apache.myfaces.trinidad.model.SortableModel;
    public class DynamicTable {
        private SortableModel model;
        private List<String> columnNames;
        public DynamicTable() {
            columnNames = new ArrayList<String>();
            columnNames.add("Col-1");
            columnNames.add("Col-2");
            generateColumnModel();
        public void generateColumnModel() {
            this.model = new SortableModel(createRows(columnNames));
        private List<Map> createRows(List<String> columnNames) {
            int i = 0;
            List<Map> mapListforRows = new ArrayList<Map>();
            for (String name : columnNames) {
                Map newRow = new HashMap();
                mapListforRows.add(newRow);
                for (String col : columnNames) {
                    newRow.put(col, "data");
            return mapListforRows;
        // Get table model
        public CollectionModel getCollectionModel() {
            return model;
        public void setColumnNames(List<String> columnNames) {
            this.columnNames = columnNames;
        public List<String> getColumnNames() {
            return columnNames;
    }The jspx file (page)
               <af:table varStatus="rowStat" summary="table"
                            value="#{pageFlowScope.DynamicTable.collectionModel}"
                            rows="#{pageFlowScope.DynamicTable.collectionModel.rowCount}"
                            rowSelection="none" contentDelivery="immediate"
                            var="row" rendered="true" id="t1">
                    <af:forEach items="#{pageFlowScope.DynamicTable.columnNames}"
                                var="name">
                      <af:column sortable="true" sortProperty="#{name}"
                                 rowHeader="unstyled" headerText="#{name}"
                                 inlineStyle="width:100px;" id="c1">
                        <af:activeOutputText value="#{row[name]}" id="aot1"/>
                      </af:column>
                    </af:forEach>
                  </af:table>

  • Create internet explorer object from process ID

    Hi,
    I want to create a object for open instance of internet explorer and pass username and password to it.
    By using the below command I am getting the process object but how can we create internet explorer object from it so that I can access document elements.
    gps | ? {$_.mainwindowtitle -match 'Service'} | select name, mainwindowtitle
    Thanks
    Prasanna

    Hi Prasanna,
    If you means create IE object and signin automatically with username and password, the script below is for your reference:
    $username = "....."
    $password = "......"
    $ie = New-Object -com InternetExplorer.Application
    $ie.visible=$true
    $ie.navigate("https://login.live.com/")
    while($ie.ReadyState -ne 4) {start-sleep -m 100}
    $ie.document.getElementById("i0116").value= $username
    $ie.document.getElementById("i0118").value = $password
    $ie.document.getElementById("idSIButton9").click()
    start-sleep -m 100
    gps | ? {$_.mainwindowtitle -match 'Microsoft account'} | select name, mainwindowtitle
    The result like:
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang

  • How do you remove an object from a picture.  Newbie to program CS6

    how do you remove an object from a picture.  Newbie to program CS6

    Well, generally you can use the clone-stamp tool for one, shortcut is S. It basically allows you to take data from any part of the image and copy that over. What I do is draw on a new layer above the one to modify- make sure you select Sample:"This layer and below" in the top toolbar when doing so. Other ways include blending something on top of the object too, using different blending modes. Painting over it works too at times (rarely). It'd be easier if we knew a specific case though...

  • Problem of create an Image object ?

    Dear all :
    the following code does not work when i use it in the application rather than in the applet :
    Image img = createImage(new MemoryImageSource(org_width,org_height,palette,0,org_width));
    where org_width , org_height is an int , while palette is an int[] that contain the pixels data in an application .
    So i then tried to create the ImageProducer object :
    ImageProducer ip = new MemoryImageSource(org_width,org_height,palette,0,org_width);
    But how can i create an Image object using the ImageProducer in an application ? Or any ways to create an Image object using the int [] pixel data in an application ?

    Hi
    I don't know if this is what your looking for, but I had the same problem, and it helped me, so why not try looking at it
    http://forum.java.sun.com/thread.jsp?forum=31&thread=167305
    Aagaard

Maybe you are looking for