ListEvent.ITEM_CLICKED does not

Hi all

This is my first post so first off thanks to everyone in advance for their help! I am working on an application for the Playbook and things have been going very well. Unfortunately, I met an obstacle that I have been struggling with for the last few days. The problem I have is that her does not seem to be the ListEvent.ITEM_CLICKED event fires when the list is added to a sprite that is not the sprite of the main application. If I add the same list for the main sprite code everything works correctly. I've created a demo application to show what I'm doing and the result:

ListTest.as - point of entry of the Application.

package
{
    import flash.display.Screen;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;

    import caurina.transitions.Tweener;

    import qnx.ui.buttons.LabelButton;
    import qnx.ui.data.DataProvider;
    import qnx.ui.theme.ThemeGlobals;

    [SWF(width="1024", height="600", backgroundColor="#666666", frameRate="30")]
    public class ListTest extends Sprite
    {
        public var button:LabelButton;
        public var listScreen:Screen1;

        public function ListTest()
        {
            super();
            ThemeGlobals.currentTheme = ThemeGlobals.BLACK;

            button = new LabelButton();
            button.label = "Switch Screen";
            button.addEventListener(MouseEvent.CLICK, switchScreen);

            addChild(button);

            this.stage.nativeWindow.visible = true;

        }

        public function switchScreen(e:Event):void
        {
            listScreen = new Screen1();
            addChild(listScreen);
            Tweener.addTween(this, {x:0, y:-600, time:.3, transition:"linear"});
        }
    }
}

Screen1.as - the second Elf who comes alive in when you click on the button "Switch screen.

package
{
    import flash.display.Sprite;

    import qnx.ui.data.DataProvider;
    import qnx.ui.events.ListEvent;
    import qnx.ui.listClasses.List;
    import qnx.ui.listClasses.ListSelectionMode;
    import qnx.ui.theme.ThemeGlobals;

    public class Screen1 extends Sprite
    {
        public var testList:List;
        public var ar:Array = [ { label : 'bob', id:1234 }, { label : 'fred', id: 4567 } ];

        public function Screen1()
        {
            super();
            this.y = 600;
            ThemeGlobals.currentTheme = ThemeGlobals.BLACK;

            testList = new List();
            testList.width = 500;
            testList.height = 500;
            testList.x = 200;
            testList.selectionMode = ListSelectionMode.SINGLE;
            testList.dataProvider = new DataProvider(ar);
            testList.addEventListener(ListEvent.ITEM_CLICKED, onClick);

            addChild(testList);
        }

        public function onClick(e:ListEvent):void
        {
            trace("onClick called from ListeEvent.ITEM_CLICKED event");
        }
    }
}

If debug the application 'onClick' never fires. I hope that it is something simple but as I mentioned that this only happens with the list is a child of a Sprite that is not the sprite of the main application.

Hey,.

just an update to get the same effect you had initially without this "boring" workaround, I gave in my previous post, run the following code. This time the class Screen1 will this.y = 600, as you had originally. If this entire file remains the same. The only thing we ar change is the function switchScreen in your main application. Instead of the interpolation of the main application, we go to the just the Screen1 tween object.

ListTest.as (changes in bold):

package{   import flash.display.Screen;  import flash.display.Sprite;  import flash.events.Event;    import flash.events.MouseEvent;

  import caurina.transitions.Tweener;

  import qnx.ui.buttons.LabelButton;    import qnx.ui.data.DataProvider;  import qnx.ui.theme.ThemeGlobals;

  [SWF(width="1024", height="600", backgroundColor="#666666", frameRate="30")]  public class ListTest extends Sprite  {     public var button:LabelButton;        public var listScreen:Screen1;

      public function ListTest()        {         super();          ThemeGlobals.currentTheme = ThemeGlobals.BLACK;

          button = new LabelButton();           button.label = "Switch Screen";           button.addEventListener(MouseEvent.CLICK, switchScreen);

          addChild(button);

          this.stage.nativeWindow.visible = true;

      }

      public function switchScreen(e:Event):void        {         listScreen = new Screen1();           addChild(listScreen);         removeChild(button);          Tweener.addTween(listScreen, {x:0, y:0, time:.3, transition:"linear"});       }    }}

Screen1.as (original):

package
{
    import flash.display.Sprite;

    import qnx.ui.data.DataProvider;
    import qnx.ui.events.ListEvent;
    import qnx.ui.listClasses.List;
    import qnx.ui.listClasses.ListSelectionMode;
    import qnx.ui.theme.ThemeGlobals;

    public class Screen1 extends Sprite
    {
        public var testList:List;
        public var ar:Array = [ { label : 'bob', id:1234 }, { label : 'fred', id: 4567 } ];

        public function Screen1()
        {
            super();
            this.y = 600;
            ThemeGlobals.currentTheme = ThemeGlobals.BLACK;

            testList = new List();
            testList.width = 500;
            testList.height = 500;
            testList.x = 200;
            testList.selectionMode = ListSelectionMode.SINGLE;
            testList.dataProvider = new DataProvider(ar);
            testList.addEventListener(ListEvent.ITEM_CLICKED, onClick);

            addChild(testList);
        }

        public function onClick(e:ListEvent):void
        {
            trace("onClick called from ListeEvent.ITEM_CLICKED event");
        }
    }
}

hope that helps even more. Good luck!

Tags: BlackBerry Developers

Similar Questions

  • LinkButton click does not launch URL in the bin-release folder

    I have a 'xyz.mxml' project in which I use a datagrid control. The action script affects an ItemRenderer to object LinkButtonRenderer

    gdColumn.itemRenderer = new ClassFactory (LinkButtonRenderer);

    This LinkButtonRenderer.mxml is another file in my project "xyz.mxml".

    When I run the application in Flex builder, it works fine and click on the button that opens the url. But when I copy all the files from the record "/ bin-debug ' to any other folder, clicking on a button does not work. If I do an 'Export Release Build' all files created in the folder "bin-release". But the link button does not work here.

    <? XML version = "1.0"? >

    <! - LinkButtonRenderer.mxml - >
    " < = xmlns:mx mx:VBox ' http://www.adobe.com/2006/mxml "> "
    < mx:Script >
    <! [CDATA]
    Import mx.events.ListEvent;
    Import mx.controls.LinkButton;
    Import mx.controls.Button;
    Import mx.controls.Alert;
    import flash.net.navigateToURL;


    private void handleClick(eventObj:Event):void
    {
    var u: URLRequest;
    u = new URLRequest (data.url.toString ());
    navigateToURL (u, "_self");
    }
    []] >
    < / mx:Script >
    < mx:LinkButton id = "url" label = "{data.label}" click = "handleClick (event); "color ="blue"/ >
    < / mx:VBox >

    If this post has answered your question or helped, please mark it as such.

    You may need to set the--use-network argument of the compiler to true or false depending on your situation.

    Project - Properties - Flex Compiler - additional compiler arguments:

    Add - use-network = true and if it does not add - use-network = false.

  • Grid itemDoubleClick event does not

    Hello

    I have a grid in which I want to use an itemdoubleclick event.
    But my itemdoubleclick event does not respond. Pls see my code below.
    Is there something wrong with it?

    THX

    Import mx.events.ListEvent;

    public void itemClickEvent(event:ListEvent):void {}
    varid = event.currentTarget.selectedItem.id;
    }


    < mx:DataGrid horizontalScrollPolicy = 'auto '.
    ID = 'grd' itemDoubleClick = "itemClickEvent (event); "color =" #000080 ">".
    < / mx:DataGrid >

    Hello

    You must set the property to true on your DataGrid doubleClickEnabled to receive double click events.


    ID = 'grd' itemDoubleClick = "itemClickEvent (event); «color = "#000080"»
    doubleClickEnabled = "true" >

    Deepa
    Flex SDK

  • iPhone 7 more buttons outside does not

    I've had my iPhone 7 + for about 2 weeks now. Every once in awhile all buttons outside to stop, volume up/down, power, home. The home button will still record and push and give the sensation of taptic and touchID works. The phone itself still works and I can answer texts and which do not use notifications.

    The couple spent time he did, he came upon her in about 4-5 minutes, however it was about half an hour and still nothing. I want to restart my phone, but the switch does not work.

    Has anyone seen this issue or know how to fix?

    Thanks in advance.

    I just experienced the same problem on my iPhone 7, I think it's a bug in iOS, but I am using iOS 10.0.2. Power + button low Volume allowed me to turn it off then turn it back on... Apple please fix this bug!

  • App store, Safari and iTunes does not connect to the Internet after installing macOS Sierra

    App store, Safari and iTunes does not connect to the Internet after installing macOS Sierra

    After upgrade 'OS X El Capitan' to "macOS Sierra" window only empty "App store" and page "Safari" made its appearance, no error message shows. store "iTunes" and "Dictionary" does not connect too.

    But Google chrome works well.

    So have you tried the next steps in your original post that Safari does not work after installing macOS Sierra:

    (1) x OS: "Unable to connect" or "unable to connect to the App Store. An internet connection is required"- Apple Support

    2) Advanced the steps to correct the problems with the iTunes Store - Apple Support connection

  • Safari does not work after installing macOS Sierra

    Safari and apple store does not work after installing macOS Sierra

    Alas, my crystal ball is in the shop for cleaning, so you will need to provide more details on what "doesn't work" and above all error messages. First of all, let's start the App Store. Provide as much information as possible for those of us who do not sit on your shoulder.

  • My iPad Apple 3rd generation wifi + his cell phone does not work

    MY 3rd generation Apple iPad, wifi + cell

    model number MD408LL/a

    Serial number DM * VGL

    THE SOUND DOES NOT WORK

    < personal information under the direction of the host >

    All sounds, or simply notification and sounds apps (for example do music and videos app still have sound)? If notifications and apps you have notifications on mute: on the iPad side switch - Apple Support ? If the sounds in all applications which have tried for example soft-reset/reboot of the iPad, insert/remove the headphones?

  • After recent, iPhone, 6, update, Windows, Explorer, does not work, see, iPhone

    I installed the latest update required for my iphone ios 6 a few days ago, and now when I try to download pictures from my iphone to my PC (via USB connection), the PC does not see the iphone.   iTunes sees it yet, but windows Explorer does not work.  It seems that some setting has been broken through the update of ios.  A way to solve this problem?

    Restart the computer and the iPhone. Unlock the iPhone before connecting it to the computer. Any change?

    TT2

  • iPhone 7 more telephoto camera does not

    Is anyone having problems with iPhone 7 more telephoto does not activate. I'll go to the camera application and press the 2 x zoom feature, but it appears to be not to activate the camera of 56mm at the front. I cover the lens with my finger, the camera on the right side and the iPhone always displays an image despite me concealing one of the cameras teo. I can't activate the second camera. It seems to only be zooming digitally. I'll do this outside and he'll only digitally zoom when I hide the second lens.

    Im having this same problem. I heard from someone that he could not work until the next software update... but I have no idea and have not found anything in the online help. If someone else gets to know how.

  • Contact ID battery fast draining iPhone 5s does not

    5s fast drainage and Touch ID sinice 10.0.2 iOS iPhone battery update does not

    Restarted the iPhone since the update yet?

    1. Press and hold the sleep/wake button until the Red slider appears.
    2. Drag the slider to turn off your device completely off.
    3. Once the device turns off, press and hold the sleep/wake button again until you see the Apple logo.
  • Open the link behind Mail does not work

    Sierra using my link opened behind Mail does not work. The link opens on the top of the window.

    This option works for me in Sierra... is working for you with your previous version of the OS?

  • Update for Sierra and now my Apple music does not appear I have a subscription and I am unable to get my music on the cloud?

    Update for Sierra and now my Apple music does not appear I have a subscription and I am unable to get my music on the cloud?

    Hey there Scotchman2926,

    I understand that you are experiencing some problems with Apple music on Sierra. I have a few suggestions to help you solve this problem. First of all, if you are unable to access the iTunes Store as well as music from Apple, use the information in this article to help resolve this problem:

    If you cannot connect to the iTunes Store - Apple Support

    If this does not resolve the problem, you might try signing out of your Apple ID in iTunes and then connect again.

    Thanks to be come to the communities of Apple Support and let us know how it goes.

    See you soon.

  • iPhone 5 home button does not work after ios 10

    My 5 Iphone Home button does not work after update final IOS version of 10.

    The home button works on the first push to wake the phone but it will not open the phone the second button.

    I activated the assist button, which does not work either. But what I discover is if I open device for assistance then touch and lock screen click on the button home will work once to open the phone. If I open any app I can't close it unless I go through the same routine.

    You attempted to restart your phone?

    You can do so by holding the sleep/wake button and the Home button simultaneously until the Apple logo appears

  • New IMac does not, Apple does not change

    https://www.YouTube.com/watch?v=UdUY038FwCI

    I have this problem since I was the imac. I pointed out in 3 days. Apple does not change because I didn't buy that at its retailer. 3 months, still waiting.

    What should I do?

    Everyone pays even, but I get nothing (same lack offers as a freelancer). I think it's fair. What am I, I guess what to do?

    Run the Apple Hardware Test > Apple Hardware Test - Apple help

  • Why Safary does not load the content of pages?

    Why Safary does not load the content of pages? I mean, when I hover over the places where should be the content, he is always showing the "redirect to: [email protected]/" lower left. My Safari is 9.5 and worked fine until Safe Fimder Virus get inside my computer. Mozilla Firefox is a bit slower. If someone could give me an idea on how to deal with it, I would be happy.

    Sorry if my English is not good, I am a Brazilian who is still learning English

    Your English is very good!

    Redirects are usually due to adware or malware.

    Download the run MalwareBytes.

    It of free and takes only a minute or two. Which should remove all adware and malicious software on your Mac.

Maybe you are looking for

  • Need to buy the optical drive for M100 - problem accersories

    Hi everyone, my problem is not the compatibility of disks currently on the market. I just bought a beautiful M100 P 1.3 GHz IR/BT/LAN/WFb/g but without a drive. As I looked for a problem including the addition of accessories has occurred. A kind of g

  • Use of the SSD and HDD

    Hello world My poor old MP3.1 seems to be labour especially now with El Capitan so I thought that perhaps I should start by upgrading to SSD? Here's how my Mac Pro is right now with my HD installed as follows: Bay 1 Western Digital Black WD6401AALS 6

  • Help recover lost memos in Palm OS by Access 6.4.0

    Hello I use Palm OS by Access 6.4.0 Desktop software. I used to use a Palm Zire handheld computer, but now to store all my notes and contacts on the desktop version. I opened the software Palm OS today to discover that all my memos are not displayed.

  • With explanations wireless security options

    Hello team, I would like to have your base of knowledge up-to-date with the types of security options available in IEEE and security options supported on the NETGEAR router with detailed description. The current article which is available on your KB

  • How to clean WInSXS folder was updated without having to install on Server 2008 diskcleanup

    My question is possible to manually remove updates without installing diskcleanup on my 2008 R2 Windows server or any other server.  The reason is that they said that install diskcleanup causes the disk compression so I need to find alternative solut