Click RadioButton event doesn't wok.

Hello.

I'm developing a mobile application from ActionScript 3.0 for PlayBook.

The following code does not work:

package
{
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    import flash.net.SharedObject;

    import qnx.ui.buttons.LabelButton;
    import qnx.ui.buttons.RadioButton;
    import qnx.ui.buttons.RadioButtonGroup;

    public class OptionsPage extends Sprite
    {
        private var selectedLanguage:String;

        public function OptionsPage(stageWidth:int, stageHeight:int)
        {
            super();
            createGUI(stageWidth, stageHeight);
        }

        private function createGUI(stageWidth:int, stageHeight:int):void {
            var spRb:RadioButton = new RadioButton();
            var caRb:RadioButton = new RadioButton();
            var frRb:RadioButton = new RadioButton();
            var deRb:RadioButton = new RadioButton();
            var itRb:RadioButton = new RadioButton();
            var rbGrp:RadioButtonGroup;
            var exitButton:LabelButton;

            spRb.label = "Español";
            spRb.groupname = "languageGroup";
            spRb.setPosition((stageWidth - spRb.width)/2, (stageHeight - spRb.height)/2);
            addChild(spRb);
            caRb.label = "Català";
            caRb.groupname = "languageGroup";
            caRb.setPosition(spRb.x, spRb.y + 40);
            addChild(caRb);
            frRb.label = "Française";
            frRb.groupname = "languageGroup";
            frRb.setPosition(spRb.x, caRb.y + 40);
            addChild(frRb);
            deRb.label = "Deutsch";
            deRb.groupname = "languageGroup";
            deRb.setPosition(spRb.x, frRb.y + 40);
            addChild(deRb);
            itRb.label = "Italiano";
            itRb.groupname = "languageGroup";
            itRb.setPosition(spRb.x, deRb.y + 40);
            addChild(itRb);

            rbGrp = RadioButtonGroup.getGroup("languageGroup");
            rbGrp.addButton(spRb);
            rbGrp.addButton(caRb);
            rbGrp.addButton(frRb);
            rbGrp.addButton(deRb);
            rbGrp.addButton(itRb);
            rbGrp.addEventListener(MouseEvent.CLICK, rbClickHandler);
            rbGrp.setSelectedRadioButton(spRb);
            selectedLanguage = "es";

            exitButton = new LabelButton();
            exitButton.label = "Exit";
            exitButton.setPosition(spRb.x, deRb.y + 40);
            exitButton.addEventListener(MouseEvent.CLICK, exit);
            addChild(exitButton);
        }

        private function rbClickHandler(event:MouseEvent):void {
            if (event.target != null) {
                selectedLanguage = event.target.toString();
            }
        }

        private function exit(event:MouseEvent):void {

            var mySo:SharedObject;
            mySo = SharedObject.getLocal("userPreferences");

            mySo.data.userLanguage = selectedLanguage;
            mySo.flush(10000);

            var lprogram:ProgramClass;
            lprogram = this.parent as ProgramClass;

            lprogram.startWindow(null);
        }
    }
}

rbClickHandler is not executed.

Any advice?

You are right.

I copied this code of Blackberry Developer's Guide.

Thank you.

Tags: BlackBerry Developers

Similar Questions

  • now, click on event for movieclip not pulling - don't think it's clickable?

    Hey everyone, I am working on the conversion of the old .fla files made with AS2 for HTML5 Canvas. I have some difficulty to get the mouse to work with my clips events.

    MovieClip named menu1 is my step 1. I have an Actions layer. On this layer, I have this code (taken directly from the Code Snippets Panel):

    this.menu1.addEventListener("click", fl_MouseClickHandler.bind(this));
    
    function fl_MouseClickHandler()
    {
        // Start your custom code
        // This example code displays the words "Mouse clicked" in the Output panel.
        alert("Mouse clicked");
        // End your custom code
    }
    

    For some reason any when I test it, the movieclip doesn't get the hand cursor and clicking on it does nothing. It is as if he is there no click top event. Any ideas? Thank you!

    It turns out that Animate does like it when you try to put an event click on an element 0% alpha value. He works at 1% and it leaves you clicky again.

  • Button Click event doesn't work

    I installed the latest update of flash media and labour component (the one in the toolbar) collapsed button flash. More precisely it gets not the click event. I use:
    on click me
    Alert ("x")
    end

    and nothing happens. I reinstalled and everything went well until what I replaced with new flash support.

    Anyone have this problem?

    Thanks in advance.

    Where and how you apply this code to this component? How are you
    definition of the function "click"?

    If you are using a component in Flash, you must select the sprite, then
    Open the tab "Flash component" from the window of the property inspector. Define the
    'eventPassMode' to #passAlways. This will allow the mouse event pass
    out of the component and back to the Director. Otherwise, the mouse event
    will be captured by the component and runs any code you have
    within the component itself.

    --
    Rob
    _______
    Rob Dillon
    Adobe Community Expert
    http://www.DDG-designs.com
    412-243-9119.

    http://www.Macromedia.com/software/trial/

  • Double-click the event on a specific part of an Image to the screen

    Hi all.

    Thank you very much for reading this post and be able to help.

    I want to catch an event of doble click on an Image to the screen.

    The poblem is that I don't want to catch it if the user has clicked on 'Section of the Image' the display of the Image, I want to catch it only if the user has clicked on the edge of the Image to the screen. Is it possible to know where in the Image was clicked by the user?

    Thank you very much!!

    In fact, you can obtain the coordinates of the mouse click, and if it is not within your area of the image, you can catch it.

  • Double-click the event on a specific element in a FrameMaker document

    Using the Notification/Notify (FA_Note_PostMouseCommand/FA_Note_PostMouseCommand), I can check where in the structure or which element has been activated, and if a specific item has been clicked, a dialog window opens to perform certain actions. But I would like to have this action occur only on a double click.

    Any suggestions?

    Thank you

    Trent Schwartz

    This seems to work with FrameMaker 12:

    #target framemaker
    
    setupNotifications ();
    
    function setupNotifications () {
    
        // Set notifications for after mouse command.
        Notification(Constants.FA_Note_PreMouseCommand, true);
    
    }
    
    function Notify (note, object, sparam, iparam) {
    
        // Handle the mouse events.
        switch (note) {
            case Constants.FA_Note_PreMouseCommand :
            if (iparam === 16777269) {
                alert ("double-click on element");
            }
            break;
    
        }
    }
    
  • Click the event Script has stopped working. Help, please!

    I must have forgotten a step in the preparation of an email button that will extract the data from a field in the subject line of an e-mail and I would like to create the body of an email.

    I'm taking a button and adding a click event to:

    var Mailto = " " [email protected] "; "

    var BetreffSubject = Legal_Name.rawValue;

    var NachrichtMessage = "it's 1.\r\rConfidentiality line opinion! \rThis is the beginning of the third line ';

    var email = ' mailto: ' + Mailto + '? Subject = Report Site for "+ BetreffSubject +"& Body ="+ NachrichtMessage;"

    event.target.submitForm({)

    cURL: Mail,.

    bEmpty: true,

    cSubmitAs: 'PDF '.

    });

    When I click on the button, nothing happens.  what I am doing wrong?

    Hi RudyLou36,

    Please download the file https://workspaces.acrobat.com/?d=0n * uLjnmLGX8VlHRCW5n7A and check the click event of the button "control of email through script.

    Kind regards

    Rous

  • How to make a click null event

    All-

    I have a button on the main stage with a success inside event.  This area called lables framework on other symbols (these 'other symbols' are also on the scene, not dynamic).  How to make the click event of the affected area null if one of these symbols is / are visible?  I have added another button to set the visibility to false, but then I also need that the click event automatically resets to its original state

    hope that make sense

    THX

    It's very simple & easy!

    Let me explain you more:

    for example, we want to run this code by clicking on a button

    SYM.$("mySymbol"). Show();

    but we want to disable the button click after that, quite simply, we can use variables to make the if() statement more

    If we write this line to the stage > compositionReady

    Flag = 0;    We define a variable named flag and we set its value to zero

    now back on the button click, change us or button code for this:

    If (flag == 0) {/ / this line check us the value of the indicator to see if its value is zero by}

    below the actions

    SYM.$("mySymbol"). Show(); We do our work

    Flag ++; then we increase our flag a value / / now or flag value is equal to 1

    }

    So next time, we click on the button it would not work because it would run or if statement our flag have the value zero, so our flag is not so it won't run!

    for example, if you add this code to the stadium > click

    Flag = 0;

    After that click on the scene then now our button is active again, because clicking on the scene, we changed from 1 to 0 indicator value and if we click on the button again, it would execute our code for once more! because the flag will have the value 0 now!

    It's very simple and easy, if you have a problem let me know, I'll help you

    Zaxist

  • Click on event properties



    Q1) can I get the properties of the sprite for the image pressed from the 'e' variable in the doSomething function?

    private var sp:Sprite = new Sprite();

    public void ClassImg (myimg:String, xx:int, yy:int) {}

    img1 = myimg;
    MYX = xx;
    myy = yy;
    var loader: Loader = new Loader;
    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, imageLoaded);
    Loader.Load (new URLRequest (img1));

    }

    private void imageLoaded(event:Event):void
    {
    Bitmap of the image: var = new Bitmap (event.target.content.bitmapData);

    sp.addChild (image);
    SP.x = myx;
    SP.y = myy;
    addChild (sp);
    sp.addEventListener (MouseEvent.CLICK, doSomething);
    trace ("OK");

    }

    private void doSomething(e:MouseEvent):void
    {
    e.currentTarget.sp.x = 5;  does not work
    SP.x = 5;

    }

    var sp:Sprite = Sprite (e.currentTarget);

    SP.x += 5;
    do something with sp...

  • Click on event for datagrid checkbox control

    Greetings,

    I would like to be able to present the State of a cell in a datagrid when clicked through a HTTPService or what sound you have, but I'm having a time difficult to understand how the itemEditEnd event. Here's what I thought about so far:

    <? XML version = "1.0"? >
    "" < mx:Application xmlns:mx = ' http://www.adobe.com/2006/mxml " height ="700"width ="700">

    < mx:Script >
    <! [CDATA]

    Import mx.controls.Alert;
    Import mx.events.DataGridEvent;
    Import mx.controls.CheckBox;



    [Bindable]
    public var myDP:Array =]
    {label1: "Order #2314", contact: "John Doe", as: 3, solddate: new Date (2005, 0, 1), sent: true},
    [{label1: "Order #2315", contact: 'Jane Doe', as: 3, solddate: new Date (2005, 0, 5), sent: false}] ;

    public void EditFunction(event:DataGridEvent):void
    {
    var myCheckBox:Boolean is CheckBox (myDG.itemEditorInstance) .selected;.
    var newVal:Boolean = myCheckBox;
    Alert.Show (String (newVal));
    }

    []] >
    < / mx:Script >

    < mx:DataGrid id = "myDG" dataProvider = variableRowHeight "{merge}" = "true" width = "500" height = "250" editable = "true" itemEditEnd = "EditFunction (event); ">
    < mx:columns >
    < mx:DataGridColumn dataField = "label1" headerText = "Order #" editable = "false" / >
    < mx:DataGridColumn dataField = "as" headerText = "Quantity" itemEditor = "mx.controls.NumericStepper" editorDataField = "value" / > "
    < mx:DataGridColumn dataField = "solddate" headerText = "Date" itemRenderer = "mx.controls.DateField" rendererIsEditor = "true" editorDataField = "selectedDate" / > "
    < mx:DataGridColumn dataField = "Sent" itemRenderer = "mx.controls.CheckBox" rendererIsEditor = "true" editorDataField = "selected" / > "
    < / mx:columns >
    < / mx:DataGrid >
    < / mx:Application >

    I have a version that uses a "submit" button and cycles just through the matrix, but want to send the label1 data values and the check box when the user clicks the check box. Any ideas would be greatly appreciated!

    Figured that it based on the example of hsivaram:

    CheckRenderer.mxml
    ------------------------------------------------

    http://www.Adobe.com/2006/mxml"width ="400"height ="300">

    public var _sel:Boolean
    public var _ix:Number
    override public function set data(value:Object):void
    {
    _sel = value. Data;
    _ix value = .idx
    CX. Selected = _sel
    }
    ]]>


    Main.MXML
    -----------------------------------

    http://www.Adobe.com/2006/mxml"layout ="absolute"creationComplete =" setData () ">"

    Import mx.collections.ArrayCollection;
    Import mx.controls.Alert;

    public var arr:ArrayCollection

    public void setData (): void
    {
    ARR = new ArrayCollection()
    for (var i: int = 0; i<>
    {
    arr.addItem ({label: "image" +(i+1), data:false,idx:i})})
    }
    dg.dataProvider = arr;
    }

    public void modifyData(ix:Number,sel:Boolean):void
    {
    dg.dataProvider.getItemAt (ix) .data = salt
    Alert.Show (dg.dataProvider.getItemAt (ix) .label + ":" + dg.dataProvider.getItemAt (ix) .data);
    }
    ]]>







  • Click external event?

    Version: CS3, Flash AS3.

    I want to detect whether the mouse was clicked outside a sprite (ie. a mouse event click anywhere on the screen, except the sprite).

    The idea is that you click outside a sprite activated to disable. This is how menus function and comboboxes, but I cannot see any way to do it in actionscript.

    use a stadium and a sprite click listener to the listener to sprite the first execution and apply the stopPropagation() method to the click event. If the scene is currentTarget of the event, you have a mouse DESACT your sprite. If the sprite is the currentTarget, you have a mouse click your sprite.

  • Double click in iTunes doesn't work for a song

    Hello

    I have iTunes 12.3.3.17 on an iMac running 10.10.5 Yosemite.  I have a strange problem where in iTunes, I double-click on a particular song, but the next time song.  The next song played depends on whether or not I shuffle defined or not.  If shuffle is set, the next song is random.  If shuffle is not defined, then this is the next song in the album.  I can double click on any other song in any list, and it will play.  It's the only song that I found that will not play.  Still, it climbs to the next song.  I can be in a playlist.  I can be in 'my music '.  When I double-click on this song, always plays the next song.

    Something that may be related or not... a strange thing happened when I was downloading this album on the iTunes store.  My iMac has encountered an unexpected error and restarted itself.  When I logged in, things are although had downloaded all the songs.  But I'm running into this issue with this one song.  This is the first song in the album.  Any ideas would be appreciated.  Thank you very much.

    The audio file may be damaged. Since you downloaded from the iTunes store, you should be able to remove it and then re - download the purchase without problem.

  • Click ListField event

    Hello

    It is possible to capture the click envent in a ListField?

    If so, how can I do it?

    Thank you.

    You can overrride, navigationclick, keyup or keydown methods.

  • Click on event/signal for touch Toast?

    What is the generated Signal the Toast button is clicked?

    I would have assumed it is this one, although I've not yet tried it myself: https://developer.blackberry.com/cascades/reference/bb__system__systemtoast.html#function-finished-v...

  • Convert dvr - ms with a right-click format .wtv doesn't exist despite what instructions help Windows say. ___

    Windows 7 help and support says to "convert recorded TV (.wtv) file to an older format go the folder where your recorded TV files are stored (usually C:\Users\Public), right click on the file you want to convert and then click on convert to .dvr-ms Format.»

    When I right-click on these files there is no option to "Convert to .dvr-ms Format." is there a way to do this, or a parameter in the folder to allow this?

    I don't know why your computer does not have this option.  If your computer has the conversion program: C:\windows\ehome\wtvconverter.exe.  If this is the case, you can run it from a command prompt window (Start >all programs > Accessories > prompt ) by entering these commands:

    CD /d c:\windows\ehome
    wtvconverter
    sourcefile targetfile /ShowUI

    where:

    sourceFile = full path of the .wtv file you want to convert
    TargetFile = full path of the .dvr-ms file that you want to create
          /ShowUI (as an option).  If so, show the progress of the conversion in a separate window

    For example:

    CD /d c:\windows\ehome
    wtvconverter
    "C:\users\public\public tv\TV Show.dvr - ms recorded" /ShowUI 'C:\users\public\public tv\TV Show.wtv recording'  

    To convert a whole folder of .wtv files .drv-ms format, use this command:

    wtvconverter sourcefolder\*.wtv/ShowUI

    For example:

    wtvconverter "C:\users\public\public recorded tv\ * .wtv ' /ShowUI

  • ScriptUI listbox, click CC events

    Looking for confirmation: in CC it is not recognized click is even a double click?

    but will not be triggered if the item is already selected.

    If you want to the list to serve as buttons in the onChange item you should uncheck the item.

    var w = new Window ("dialog");
    var myList = w.add ("listbox");
    myList.add ("item", "one");
    myList.add ("item", "two");
    myList.add ("item", "three");
    myList.onChange = function(){
        if(myList.selection != null){
            alert('Item ' + myList.selection + ', "' + myList.selection.text + '" just got pressed');
            myList.selection = null;
        }
    }
    w.show ();
    

Maybe you are looking for