How to create "moveUp" and "moveDown" functionality for items in a TileList

I want to create "Move Up" and "Move Down" buttons for items in a TileList. They should have the same functionality as if they were dragged and dropped, except only moving one position up or down (and thus switch places with the item above/below). I have tried this using this code for the moveUp button:
private function moveItemUp(){
     var moveFromPos:Number = myTileList.selectedIndex;
     if(myTileList.selectedIndex > 0){
          var moveToPos:Number = myTileList.selectedIndex-1;
          var tempItem:Item = myTileListDataProvider.removeItemAt(moveFromPos);
          myTileListDataProvider.addItemAt(tempItem, moveToPos);
                trace("New selected Index: "+ moveFromPos - 1);
                myTileList.selectedIndex = moveFromPos - 1;
                trace("New selected Index: "+ myTileList.selectedIndex);
But my problem is that the selectedIndex of myTileList isn't correctly set. For instance; if I have a list of three items and I move the last item up this is what happens:
1. Item three (selectedindex is 2) switches places with Item two (So far, so good)
2. Item two is shown in GUI as selected (has Halo around it - so far, so good)
3. If i click "MoveUp" again, the same two (item three and two) switces places, instead of the intended item two and one.
The traces tell me that myTileList.selectedIndex variable isn't set correctly as the trace shows this:
New selected Index: 1
New selected Index: 2
Any idea on how to solve this problem?

I found a partial solution at http://www.ultrashock.com/forums/flex/tilelist-selected-element-removed-124313.html and modified it a bit. The answer was using the callLater() method as in this example:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp()" layout="vertical">
  <mx:Script>
  <![CDATA[
      import mx.events.FlexEvent;
      import mx.collections.ArrayCollection;
      var arr:ArrayCollection = new ArrayCollection();
      var temp:Number;
      var temp2:String;            
      private function initApp():void{                   
          arr.addItem("A");
          arr.addItem("B");
          arr.addItem("C");
          arr.addItem("D");
          arr.addItem("E");
          arr.addItem("F");
      public function traceEvent(event:FlexEvent):void{
          trace(event);
          trace(mtl.selectedIndex);
          if(mtl.selectedIndex==-1){
              callLater(setInd);
      private function setInd():void{
          trace("Changing selected index..");
          mtl.selectedIndex = temp;
      public function removeItem():void{
            temp = mtl.selectedIndex - 1;
            temp2 = arr.removeItemAt(mtl.selectedIndex) as String;  
            arr.addItemAt(temp2,temp);                
      public function notifyChange(e:Event):void{
          trace("CH mtl.selectedIndex:" + mtl.selectedIndex);
  ]]>
  </mx:Script>
  <mx:TileList id="mtl" width="100" height="200" dataProvider="{arr}" columnCount="1" change="notifyChange(event)" updateComplete="traceEvent(event)"/>
  <mx:Button id="mbt" label="delete" click="removeItem()"/>
  </mx:WindowedApplication>

Similar Messages

  • How to create the change document functionality for a dependent objects?

    May I please know how to create the change document functionality for a dependent objects?
    I have done it follow the same process as for business process objects. But when i try to test it in BOBT, there is no records under "FIELD_CHANGE_WITH_FILTER". It seems the change hasn't been recorded.
    If the way I did to create change document for dependent object is correct, please also kindly advise the possibilities for why there is no record during testing.
    thanks in advance.

    I also have some doubts about the business object.In this case,one abstract BO hase a subnode wihich is root extended.I added the change document for this node under the category "root_extended" and then tested the function in BOBT.I got some error message "can't find the root key".Shall i redefine the method /BOFU/IF_CDO_CREATION~IS_CDO_CREATION_ACTIVE so as to solve the problem?
    Thx.

  • How to create HUs and input SNs for a Inbound Delivery by BDC or Function?

    I need to create HUs and input SNs for Inbound Delivery Order as VL32N.
    At first, I create a BDC program using T-code VL32N, it does work for a few HUs in one Order, but when there are more than 5 HUs in one order, the later can't be input by this program, because the table control of HUs only display 5 records in my screen, so it need page down during BDC process, while in Ttl content, there 16 rows displayed, it need page down after 8 records. But different user have different screen size, so my program doesn't work for all user.
    What should we do for turn page in BDC program?
    OR
    Is there any function can be used for creating HUs and input SNs for Inbound Delivery?

    How did you solve this issue, Can you give me some clue?
    Regards,
    Mohan

  • HOW TO CREATE INVOICES AND BOOK RECEIPTS FOR THE SERVICE CUSTOMERS

    whenever a customer approaches our Customer Service Officer he create a
    customer account from "Contact Centre" but he does not check "Create account"
    checkbox so the client is not created as customer in Oracle Receivables.
    How to create invoices and receipts for service customers whose reciprocal
    accounts are not created in Oracle Receivables?
    Regards
    Ahmad Bilal
    Message was edited by:
    user531507

    I am on EP7.0 with NWDS 7.0 SP8, i am getting the exact same error though my Webservices are hosted on PI 7.1 ESR. Where to define the logical destinations of the WSDLs.

  • How to create Rescue and Recovery disc for Windows Vista Home Basic with G530 Lenovo Laptop?

    Hi All,
    I have purchased G530 Lenovo laptop 2 weeks back.
    I coudn't find installation/recovery discs in my laptop box.
    I went across the forums and came to know that it is not available now-a-days as it was coming previously.
    So, anybody can help me, how to create a recovery disc?
    This is needed when I format my laptop.
    Thanks in advance.
    Regards,
    Umesh.

    Click on what used to be the "Start" button and search for "create" or "recovery". It took me a while to find it but it is there.
    Use a cd for the first disc and 2 DVD's for the other discs.
    T60 2623-D7U, 3 GB Ram. Dual boot XP and Linux Mint.
    T400 2765-T7U Windows 7
    Registered Linux User #160145
    FYI: I am not employed by Lenovo

  • Help creating search and results function for my site. Please help!

    Hi guys,
    I'm making an eCommerce/PayPal website for some products I'm selling. The website is currently built with PHP and HTML.
    I want to add a search box so people can search for what the specifically want - then the results page will display a list of the products with links to the products' individual pages.
    From what I understand this will almost certainly need to be database driven. My only problem is that I barely know where to start.
    I've created a database on my host and have created dummy pages of how I want everything to look.
    Each product will need 3-5 search terms attached to them.
    Can someone please tell me where to begin and how difficult what I want to achieve will be?
    Thank you and I hope to hear from you.
    SM

    The solution is database-driven only if the information about your products is in a database.
    There are two approaches for a mySQL database, using the LIKE query and using MATCH AGAINST. These are SQL, not PHP, but the search results are processed by PHP.
    There are plenty of tutorials on the web for these two methods. I prefer MATCH AGAINST, but it is a little bit more involved than LIKE.

  • How to set Menu and Title functionality for a remote control in a menu?

    I have a main menu (countries) and under each country there is a submenu (regions). When I play my DVD on my Mac it seems to function alright:
    If I go to country C and hit the "menu" button, nothing happens (I see the "action prohibited" line popping up). And nothing should happen of you hit menu in a submenu. Only if you hit Title/Top menu you should be able to go to the main menu.
    However... When I play my DVD on a DVD player (and I tested it on 2 different ones) and I go to a the Country C and hit the "menu" button, I am suddenly transfered to Country A. And if I go from the main menu to Country D and I hit the "menu" button, I go to... Country A. The menu button seems to be linked to the first submenu. Which is very odd!
    So there is definately something going very wrong when using the menu/title buttons during playback when I am in a submenu (not while playing a track).
    Can someone help me? Is there a way to define what happens with the remote control buttons menu or title when you are in a submenu and NOT playing a track? I can not find any controls for that.
    Thanks!

    Does this mean I should select "not set" in the general tab at the dropdown menu's for Title, Menu and Return in the Remote Control section? I can't find any other place where I can select menu or title.
    But if I set these to "not set",the menu and title buttons still work in simulation mode... So I guess I should do something else in order to disable menu and title? Sorry for the amount of questions from my side!

  • How to create rescue and recovery partition for my thinkpad edge 11

    Hi,
    I'm using thinkpad edge 11 with win 7 home Premium 32 bit.
    Before, i tried to restore to factory setting, there is a drive partition of rescue and recovery in my thinkpad.
    But, when I was trying to restore to factory setting, I missed the steps and made the drive partition of rescue and recovery formatted.
    So, now, I don't have it again in my thinkpad.
    Then, after that, appeared another drive partition  in my thinkpad with name S: Sytem, beside C: WIndow7 and D: Data.
    So, I need the solution from you all as knowing more about thinkpad edge in this forum.
    1. How I remove the unkwon drive, S: System from my thinkpad?
    2. How I can create again the rescue and recovery partition on my thinkpad(wih Win 7 Home premium 32bit installer inside plus all the drivers)?
    Thanks...

    Hello mate,
    To restore the Q: partition you have to use the Lenovo Recovery Discs. Hope you burn them before erasing the partition, otherwise you have to order them from Lenovo.
    Knowledge is of two kinds. We know a subject ourselves, or we know where we can find information on it.
    ThinkPad T510 4313-CTO Windows 8 x64 - Intel Core i7-620M - NVIDIA NVS 3100M - 8GB RAM - 240GB SSD- Intel Centrino Ultimate-N 6300 - Gobi 2000.
    ThinkPad Helix 3697-CTO Windows 8.1 x64 - Intel Core i7-3667U - Intel HD Graphics 4000 - 8GB RAM- 256GB SSD - Intel Centrino Advanced-N 6205 - Ericsson C5621gw

  • Post data into Ajax function for Item type plugin

    Please advise how to post data into Ajax function for item type plugin
    Edited by: Casufi on Jan 16, 2013 7:44 AM

    Casufi wrote:
    Casufi wrote:
    Please advise how to post data into Ajax function for item type plugin
    Edited by: Casufi on Jan 16, 2013 7:44 AMI used the following code
    var get = new htmldb_Get(null, html_GetElement(''pFlowId'').value, ''NATIVE='||apex_plugin.get_ajax_identifier||''', $v(''pFlowStepId''));
    get.addParam(''x01'', node.data.key);
    gReturn = get.get();You should use this published true ajax API instaed. apex.server.process( pAjaxIdentifier, pData, pOptions )

  • How to create credit and debit for an account

    Please tell how to create credit and debit for an account in currencies like EURO,GBP other than functional currency(USD).

    hi,
    You will find Dr and Cr entry for Both currencies which are functional & Transaction currency.
    Regards,
    Srikanth.Kura

  • How to create a vi that counts for example 3 - 10 pulses in and then give a 1 puls out

    how to create a vi that counts for example 3 - 10 pulses in and then give a 1 puls out.
    I'm working with Labview 6.1
    Running with Labview 6.1
    Fieldpoint hardware

    Hi,
    You should be more specific, what kind of hardware you are using ???
    Which kind of pulse you are measuring ?? You are saying that you want to count a number of pulses and then when you get to a limit (which will be between 3 and 10) you want to output a pulse ?
    Andre Oliveira

  • How to Create a Remotely Enabled Function Module

    Hi All,
    How to Create a Remotely Enabled Function Module.
    I Want to Create a FM Using Sample Data , This for Practice
    What Fields can i give in the Import and Export Parameters.
    Please Give me one Example
    Can Any one Give me the Steps to do this.
    Regards
    Vamsi

    Hi Vamsi,
    Lets do simple example where you will first create a RFC in one server (say A) and create normal program in othere server (say B). Finally you will call the RFC in A from B.
    Do the following steps for creating RFC in server A.
    1. log on to server A
    2. go to se37
    3. Edit -> function groups-> create function group and give the function group name (say ZGRP).
    4. create a FM ( say Z_TEST_RFC) in se37 providing the function group which is created just now.
    5. go to attribute tab -> choose remote-enabled module from processing type.
    so that your FM will become RFC.
    6. provide the import parameter in import tab.
    we will provide only two import parameters.
    - parameter name : P_NUM1, typing: TYPE, associated type : I & <b>check the pass value</b> (all the parameters of RFC must pass by value).
    - parameter name : P_NUM2, typing: TYPE, associated type : I & <b>check the pass value</b>
    7. provide the export parameter in export tab.
    parameter name : P_SUM, typing: TYPE, associated type : I & <b>check the pass value</b>
    8. write the given simple code in source code tab.
    FUNCTION Z_TEST_RFC.
    P_TOT = P_NUM1 + P_NUM2.
    ENDFUNCTION.
    Do the following steps for creating ABAP program which will call the RFC in server B.
    1. se38 - > creat a program.
    2. write the given simple code.
    data tot type i.
    call function 'Z_TEST_RFC' destination '<b>XXXXXX</b>'
      exporting
        p_num1 = 10
        p_num2 = 15
      importing
        p_tot = tot.
    write tot.
    please note that <b>XXXXXX</b> is RFC connection which is avialable in <b>sm59</b> transaction in server A.
    -go to sm59 - > abap connection (list of RFC connection configurations are avialable). choose server B connection and replace it of <b>XXXXXX</b> in the code.
    finally you can execute the normal abap program that will call the RFC and display the result.
    Regards,
    Sukhee

  • How to create, deploy and test JSP program in Netweaver developer studio?

    Hi Experts,
       I am trying to integrate a JSP program with SAP function module (RFC) via XI using Java proxy. I am using Netweaver Developer studio for Java programming.
      Can somebody send me the steps or user guide on how to create, deploy and test JSP program in Netweaver developer studio?
      I will be greatful to you.
    Please help!
    Thanks
    Gopal

    Hi Gopal,
    Which version of NetWeaver are you using?
    Here the links for --
    SAP NetWeaver CE 7.1
    [Developing JSP Pages|http://help.sap.com/saphelp_nwce10/helpdata/en/f7/f7bc3d8af79633e10000000a11405a/frameset.htm]
    [Deploying Applications|http://help.sap.com/saphelp_nwce10/helpdata/en/3c/52413e7bcd561ee10000000a114084/frameset.htm]
    NetWeaver 7.0 (2004s) and 2004
    [Developing JSP Pages|http://help.sap.com/saphelp_nw70/helpdata/en/f7/f7bc3d8af79633e10000000a11405a/frameset.htm]
    [Deploying EARs|http://help.sap.com/saphelp_nw70/helpdata/en/f0/122abf61d4974eaea6b5d9c314cff1/frameset.htm]
    Testing is very straightforward - just access the web application by its alias,
    e.g. http://<host>:<post>/<context-root>/myJSP.jsp
    HTH!
    \-- Vladimir

  • How to create one more server node for SAP J2EE server?

    Hi,
    Can any one please suggest how to create one more server node for SAP J2EE server? I am using WAS700.
    Thanks and Regards,
    Smriti.

    Hai,
          Login into the Configtool(C:\usr\sap\SID\DVEBMGS<inst no>\j2ee\configtool) if ABAP+JAVA stack or C:\usr\sap\SID\JC<inst no>\j2ee\configtool) if JAVA stack
    click on the instance and and select the addserver button on the top to create a servernode for J2EE server.
    Thanks and Regards,

  • ? how to add page numbers in pages 5.2, starting with 2.  Pages '09 had an option to not show folio on page one.  Also any how to do left and right folios for a Tabloid?  Many trhanks

    ? how to add page numbers in pages 5.2, starting with page 2.  Pages '09 had an option to not show folio on page one.  Also any idea how to do left and right folios for a Tabloid?  Many thanks  . . .

    Hello jacquemac,
    Your first question:
    There might be a better way of achieving what you wish to do, but following these steps could help you out.
    You might want to blend in Thumbnails and Invisibles either with (cmd+shift+i and cmd+alt+p) or over the View section in the Menubar.
    1. go for Documents (right end of the Toolbar) -> Section
    2. place your cursor at the very top of your second page and click "Create new Section->Starting with this page" in the side bar on your right.
    (what you are actually doing next is setting the pagenumbers for each section you created. You can see your sections in the Thumbnail view.)
    3. click on your first page (the first and only page of your first section) and mark the checkbox "Hide on first page of section"
    4. click on your second page (the first page of your second section) and  "Insert page number" -> start at 1
    Your second question:
    Im not quite sure i understand what exactly you want to do here. One page, two columns, each column with another page number? As far as i know this is not possible.
    greetings jl

Maybe you are looking for