How to create table of controls (Images, buttons) in ActionScript

Hello!

Could someone help with ActionScript and Playbook SDK?

How can I create a two-dimensional array of controls (buttons, images, text fields) in ActionScript?

And how do I use radio buttons in ActionScript?

Hey,.

keys and parts do not have ID like in html and javascript. That being said, its impossible to do it like that. the best approach is to create your own class that extends the LabelButton (or whatever component you need) and have an id property that is implemented. so, you can set a code personal to her. I've implemented what you asked below. You can apply this to other components as well enough to make changes to the class and modify the extension. Here is the code:

LabelButtonTest.as (main application class):

package
{
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.MouseEvent;

    [SWF(width="1024", height="600", backgroundColor="#CCCCCC", frameRate="30")]
    public class LabelButtonTest extends Sprite
    {
        private var myButtons:Array;

        public function LabelButtonTest()
        {
            super();

            // support autoOrients
            stage.align = StageAlign.TOP_LEFT;
            stage.scaleMode = StageScaleMode.NO_SCALE;

            /*
             *  Initialize your array of 2 X N (in our case we will be using 10)
            */

            myButtons = new Array(new Array(), new Array());

            /*
             * Now we set up our array, first doing the first row and
             * set up 10 buttons with their own ID using the constructor
             * for our custom class CustomLabelButton(ID)
            */

            for (var i:int = 0; i < 10; i++)
            {
                var myBtn:CustomLabelButton = new CustomLabelButton(i);

                myBtn.label = "Button " + i;
                myBtn.setSize(100, 50);

                myBtn.addEventListener(MouseEvent.CLICK, onClickEvent);

                myButtons[0].push(myBtn);

            }

            /*
             * We do the same for the second row of buttons, starting
             * with 10
            */

            for (var i:int = 10; i < 20; i++)
            {
                var myBtn:CustomLabelButton = new CustomLabelButton(i);

                myBtn.label = "Button " + i;
                myBtn.setSize(100, 50);

                myBtn.addEventListener(MouseEvent.CLICK, onClickEvent);

                myButtons[1].push(myBtn);
            } 

            /*
             * Finally we cycle through our arrays and add them to our display
             * this wil produce two rows of 10 buttons going accross
             * each when clicked will call the funciton onClickEvent and
             * trace out their ID to the debugger
            */

            for (var i:int = 0; i < 10; i++)
            {
                var myBtn:CustomLabelButton = myButtons[0][i];
                var xPos:int = (i * 100) + 10;
                var yPos:int = 10;

                myBtn.setPosition(xPos,yPos);

                addChild(myBtn);
            }

            for (var i:int = 0; i < 10; i++)
            {
                var myBtn:CustomLabelButton = myButtons[1][i];
                var xPos:int = (i * 100) + 10;
                var yPos:int = 60;

                myBtn.setPosition(xPos,yPos);

                addChild(myBtn);
            }

        }
        public function onClickEvent(e:MouseEvent):void
        {
            /*
             * Print out ID of the button thats clicked
            */
            trace("the button ID is: " + e.target.id);
        }
    }
}

CustomLabelButton.as (our custom label with the ID property button class):

package
{
    import qnx.ui.buttons.LabelButton;

    public class CustomLabelButton extends LabelButton
    {
        private var _id:int;

        public function CustomLabelButton(num:int = 0)
        {
            super();

            id = num;

        }
        public function set id(num:int):void
        {
            _id = num;
        }
        public function get id():int
        {
            return _id;
        }
    }
}

run the code and see how it works. I hope that's what you're looking for. Good luck!

Tags: BlackBerry Developers

Similar Questions

  • How to create a custom control for a button where the look apply to everyone else but not the Boolean text?

    Hi all

    I would like to create a button custom as a master, so that if I change the look of the master all other buttons are changed.

    I did it with a custom control, such as a 'type strict def' otherwise the look will change , BUT if I do this as a strict type def I can't change the Boolean text more which should be different on each button.

    How to create a master control of a button where the look apply to everyone else but not the Boolean text?

    Steve Chandler wrote:

    I don't think that you can do. I just looked and as I suspected the Boolean property text is read only for strict typedefs, you cannot use the nodes property to change the text.

    As a just solution make it a typedef. When you want to change the open look the typedef and strict rendering, make your changes, then make no strict again. You will need to update the text Boolean yet once for all instances. Kind of pain. This is perhaps something for the exchange of ideas.

    Alternatively, remove Boolean text and replace with legend

  • How to create a hardware independent Image

    Hello
     
    I'm new to the concept of Imaging.  With kindness is someone help me how to create a hardware independent Image of Win 7 as well as for Win XP

    Kind regards
    Chaitanya

    This kind of question belongs in IT Pro forums on TechNet, the forums you currently send support home users who are not computer graphics.

    http://social.technet.Microsoft.com/forums/en-us/categories

  • How to create a digital control (of any type) which can be increased or decreased by a 'unit' at the same time?

    As in the title.  I want to create a digital control (no current limitation on its type) with a range of 1 to 10 (and a step of 1).  The only difficulty that I have, is that the user should only be able to increase or decrease 1 at any time.  Code initiated by this change of value must have completed at least once before that the value can be changed again.  This is because code of VI is mainly contained in a while loop and control are read once at each iteration and its last value should not differ more than 1.

    Is this possible with LabVIEW 6.1 and if so, how?

    One of the solutions that I came up with so far is to disable the control immediately after its reading, and to turn it on again immediately seized is read the next time (I have to assume that the user is unable to click twice before the control is disabled).  It is an acceptable method, or is there a better way?

    I also had an idea of partially disable a normal digital control, such that it could not be typed in - only arrows remained operational.  However, I'm not sure how.

    James

    Hi James,

    You can use the two buttons (by releasing latch) and a digital display that shows the current value. Button increased the value and the other decreases. Store the value in a shiftregister to work with her.

    I don't know if your solution would work because use may directly enter the new value.

    It will be useful.

    Mike

  • How to create a horizontal Gallery with buttons?

    I can't understand how to create a way to show my photos as a horizontal Gallery with buttons to scroll (photos at left), as Elizabeth Gadd photography . Can anyone help?

    Have you looked at the standard slideshow and Lightbox widget or sought another widget "image Carousel"? It's really basic things.

    Mylenium

  • How to create a list of icon button similar to the application of the timesheet

    Hello
    Can someone tell me how to create an icon, with drop-down list that looks like and similar to the button work, we can find in the application of the timesheet in the following URL: http://apex.oracle.com/pls/otn/f?p=35222:LOGIN

    Thank you!

    Hello
    Click on your list box
    Click on the name of the list
    It is redirects to the list property
    Choose the name of the specific list item, that it will open for the parameter of the attribute
    Choose the small button on the right image will pop up the existing images or
    Download your [shared components] Access image #APP_IMAGES #image1.gif

    Thank you
    Loga

  • How to dynamically add any control (digital button, boolean) to control the line and selected column

    Hello

    How to add a control (digital button, boolean) dynamically in control instead of lines and columns selected. Please suggest the idea or no matter what example code you have please share with me...

    Thank you

    Vieu

    Essentially, that's what you're looking for:

    Please note that you have to account border sizes and the label of the control so that the code does not work right out of the box. You should also check for the height and width of column and if the position is valid at all before moving around the control.

    Norbert

  • How to create table of the method

    Hello-

    Could someone please tell me how can I create an af:table with more than one column of an AppsModule method.

    When I have a 1 d table return for example:

    public String [] createTable()}
    String [] str = new String [1];
    return str;
    }

    I can get as a table and a column is created. But how do I get mutiple columns in a table. I want to write a method that when inserted on jsp page create table with multiple columns.

    I use ADF 11 g.

    Please suggest.

    Greetings-
    Rohit

    Hello

    to do this, you use a matrix, or a list of arrays of objects. The object represents the contents of the line, e.g., person. The Person class then have setter/getter for each property you want to display in a column

    Frank

  • How to create tables without visible lines?

    How an a table with no visible vertical and horizontal lines dividing the rows and columns?

    Owen,

    Luca

    Just turn off the borders of the cells.

  • How to create table of 288 HP push button in the PXI-6509 (3pcs)

    Hi all

    Need help...

    I am a beginner in labview. & her first time use OR for my project.

    We must push buttom about 288 HP control panel. We use PXI-6509 (3 pcs)

    & I do a code (in tie).

    but some time appear as a bug if we push a button push button after all. but some time is ok.

    Please correct the code.

    Thank you very much...

    It seems to work fine for me.  What do you mean by "sometimes appear like a bug?  How is it not behave like you want.

    A few recommendations:

    1. There is no logical reason for the node feedback on some of your cables of the error.

    2. you can turn some of your groups of buttons in a cluster.  This way you can work on changing the value of a cluster and do not have to set up 100's of changes made to the values of the individual controls.  You'd also be abe to easily use the cluster to table to transform your cluster of Boolean Boolean rather than building tables table by manually cabling up to 100's of controls.

  • How to create the data control to a custom object of sale cloud using web service.

    Hi all

    I'm working on a requirement I need to display the common custom object data and their children object. After the display of the data user will be able to select multiple records by using the check box and then update the State to close.

    So basically, I need to create a table in which the data will fill with the checkboxs and when the user clicks on the button update then I need to update a field in the parent object.

    Any help would be appreciated.

    Thank you

    You must follow the steps below

    1. right click on the template project, select the new option

    2 Select the data control in the left hand side of the tab "All Technologies"

    4 Select "control of data from the Web Service" in the right side panel

    3. Enter the name of the data control (custom name)

    4. provide your WSDL to the URL https://crm-domain.oracleoutsourcing.com/foundationCustExtn/CrmCommonReferenceService?wsdl

    5. click Next, next if all methods to winow than wsdl, mix to the right and click Finish button

    6 refresh "data control" in your right side panel to request

    7 expand control of data and select only control data that you have already given

    8. then you can see the methods that comes from your wsdl.

    9. Select the method and expand it, you will get the return values

    10. drag and drop the return as a table value, you will get the af:table on the page

    11. don't want to operatet this table.

  • How to create table selectable line or not based on the value of the line

    Hello.

    JDeveloper 11.1.1.2

    Is it possible to make a selectable table row or not based on a value in the line.

    That is to say. lets say that the row contains a Boolean LOCKED = TRUE.
    This line should not be selectable.

    A line whose value LOCKED = FALSE should be selectable.

    / Erik

    Erik,

    No particular reason to disable a selection of lines for a particular line? If I'm an end user, I would be clicking on the same line of thought again and again my mouse does not ;) (call me dumb :)). How do you differentiate this line (using inlineStyle / styleClass) based on the value of line? In addition, you can disable the other buttons when a row with a particular value is selected (so that the user knows that the selected line is not treatable).

    Arun-

  • How to create a broad Web search button

    I created a website and I need to put a search button on it... and I don't know how to do this. I bought a software program that is to create and it gives me a code and I don't know where to put it with the SWS file.

    No one knows who to create a feature of research Web site.

    Lucrertia

    GoTo google and create a free account and then do a custom with just your site like search target I made and they work well and doesn't cost anything

  • How to create table containe blob column view?

    Hi, I would like to aske any type of blob data
    I have data containe blob clolumn type table

    I want to create view this table how do?
    and


    If I created the table view blob column data will be responsible for memory or what because that will cause some performance issues because the table contains enormous data?


    Thank you

    You must create the view as

      CREATE OR REPLACE VIEW 
      AS
         SELECT col1, col2, col3.....
         FROM    
         WHERE   
         ...etc...
    

    The Act of creating the view will not otherwise the data in the table underlying, all it will do is create a view definition.
    Select only the view will select data.

    If you don't need to select the BLOB column in the view, then you would not include it in the list of the columns in the view definition.
    If your LOB data are stored online, then it may be a significant selection of the view, even if the BLOB column is not indicated in the list of the columns in the view.

    Published by: dombrooks on June 1, 2009 10:12

  • Qosmio G35: How to create Qosmio Player CD image

    Hello

    I am Brazilian and I have a Qosmio G35 AV600.
    A month ago, I deleted all my partitions and after I reinstalled the operating system, I realized that he lacked QosmioPlayer.

    Software based on the web that I discovered that I need the Qosmio player recovery CD to reinstall linux to research.

    I called 10 times in the Toshiba Support centre, opened a ticket and all the times that I have been informed that the
    Relations with international consumers would call me in 1 hour.

    In any case, is - anyone can help me create an ISO (image) on the real CD and UPLOAD the image in a GMAIL account or somewhere else?

    I appreciate really.

    Thank you...

    Hello

    Sorry, but you have to order this utility at the Toshiba service partner in your country.
    But I wonder why you didn't get this CD with your laptop. Usually these CDs come with laptops.
    Anyway, the CD is not expensive and you will get the original.

    CU

Maybe you are looking for