Flex sort script

I am using
Flex 1.5
I am trying to sort a grid by date. But it is not working as
expected. I have attached the code here. Please let me know the
problem in this code.

I noticed that the argument passed to date_sortCompareFunc is
directly the string value not the object. After replacing itemA.dob
to itemA, every thing worked fine.
In some application the argument passed is object, But in
other application it pass directly the string value.
I don't know when to use what.

Similar Messages

  • How to use classes of packages in flex mx:Script/ or mxml/

    Hi.I am just learning Flex using Flex Builder 3 facing one problem,
    Suppose I declare one package with name alert.as
    package
    import mx.controls.Alert;
    public class alert
    public function alertBtn()
    Alert("Hello btn 1");
    Now in want to use the function in mxml that I declared in a package.
    <mx:Button label="btn1" click="alertBtn();"  />
    I have few questions
    1)How to Import the class alert.as in <mx:Script> and where should i store the file alert.as in the directory folder of flex?
    2)How to call the function alertBtn() when btn1 is clicked.
    Thanks so much!
    Regards
    Ankur

    Hi Greg.I think I was not able to clear my problem properly.Let me try this time again.
    What I wanted to do was that in the below written code I have the full access of the id=panel1 in the  script tag .This works properly.
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script><![CDATA[
    import flash.display.Sprite;
    import mx.core.UIComponent;
    private function addChildToPanel():void {
    var circle:Sprite = new Sprite();
    circle.graphics.beginFill(0xFFCC00);
    circle.graphics.drawCircle(0, 0, 20);
    var c:UIComponent = new UIComponent();
    c.addChild(circle);
    panel1.addChild(c);
    ]]></mx:Script>
    <mx:Panel id="panel1" height="100" width="100"/>
    <mx:Button id="myButton" label="Click Me" click="addChildToPanel();"/>
    </mx:Application>
    This above functionality when I tried to do using class Outside the code ,its not working !
    Here is with the package:-
    But suppose I make One package 
    package
    import flash.display.Sprite;
    import mx.core.UIComponent;
    class getPanel extends Sprite
    public function addChildToPanel():void {
    var circle:Sprite = new Sprite();
    circle.graphics.beginFill(0xFFCC00);
    circle.graphics.drawCircle(0, 0, 20);
    var c:UIComponent = new UIComponent();
    c.addChild(circle);
    panel1.addChild(c);
              }//class
                        }//package
    Now in MXML
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script><![CDATA[
    import getPanel;
    ]]></mx:Script>
    <mx:Panel id="panel1" height="100" width="100"/>
    <mx:Button id="myButton" label="Click Me" click="getPanel.addChildToPanel();"/>
    </mx:Application>
    So My problem is that this code doesnt do anything.
    Neither the addChild function is working in it ,Nor the Panel1 is accessible here.
    Can u pls help me here.
    Thanks
    Ankur

  • Adobe Flex - Sort

    Hi All,
    We are using Adobe Flex 2 to develop internet applications.
    My question is how to lock initial mutiple rows in Flex.
    Right now, locked row feature is locking the chrome but not the
    data. Therefore, when we sort new data appear in the locked rows.
    I want the sort not to affect some number of initial rows?
    Many Thanks
    Naga

    <mx:DataGrid's  lockedRowCount attribute is for locking rows when using the scroller .
    meaning if you set it to 3 , and if you use the scroll bar, the first three rows will stay fixed and other rows will scroll. however this doesnt affect the sorting behaviour.
    by defult there is not option to ignore the locked rows from sorting, you may have to say have two datagrids first one with locked rows and the second normal one without column header and in this case, you have to code the sorting yourself.
    Raja

  • Passing record properties to a sort script object

    Hello,
    I'm still at the beginning of the Applescript learning curve, and as a fairly seasoned programmer on mainframes and VB, I'm anxious to start off in the right direction.
    I have developed / purloined a fast sorting algorithm to sort records. It is a stand alone script that is loaded by the script that requires its services. The problem is that in its current guise, it sorts on a specific property within the record. What I would like to do is to make this script truly 'utility' by adding the capability to sort on any property of a record. The 64,000 dollar question is, how do I pass the name of the records property on which to sort into the script?
    If possible, could a sample of the code that will be required be included.
    Thanks

    Hello
    AppleScript's record label is not easy to deal with programmatically because it must be statically defined at compile time. E.g., you cannot do this :
    set k to "key1"
    {key1:10, key2:20}'s k -- Error -1728 : Can't get k of {key1:10, key2:20}.
    Because of this, any attempt to pass record label as handler's parameter would fail in plain AppleScript.
    The simplest way to implement universal sort handler would be to define comparator as external handler and pass the handler's reference to the sort handler as its parameter.
    Having the comparator encapsulate the comparing logic of the data, the sorting logic of sort handler can be independent of the internal structure of the data.
    Something like the code below, which is using my sort handler in service.
    Hope this may help,
    H
    --SCRIPT
    return sortrecordseg()
    --return sortscalarseg()
    on sortrecordseg()
    set rr to {}
    repeat 20 times
    set end of rr to {key1:random number 20, key2:random number 20}
    end repeat
    msort(my cmpreco_key1a, rr) -- ascending by key1
    --msort(my cmpreco_key2d, rr) -- descending by key2
    --msort(my cmpreco_key1_a_key2d, rr) -- ascending by key1, descending by key2
    return rr
    end sortrecordseg
    on sortscalarseg()
    set rr to {}
    repeat 20 times
    set end of rr to random number 20
    end repeat
    msort(my cmpscalara, rr) -- ascending
    --msort(my cmpscalard, rr) -- descending
    return rr
    end sortscalarseg
    on cmpscalara(x, y)
    (* compartor for msort handler
    sort scalars in ascending order *)
    x > y
    end cmpscalara
    on cmpscalard(x, y)
    (* compartor for msort handler
    sort scalars in ascending order *)
    x < y
    end cmpscalard
    on cmpreco_key1a(x, y)
    (* comparator for msort handler
    sort records in ascending order by key1 *)
    x's key1 > y's key1
    end cmpreco_key1a
    on cmpreco_key2d(x, y)
    (* compartor for msort handler
    sort records in descending order by key2 *)
    x's key2 < y's key2
    end cmpreco_key2d
    on cmpreco_key1_a_key2d(x, y)
    (* compartor for msort handler
    sort records in ascending order by key1, descending order by key2 *)
    local xk, yk
    set xk to x's key1
    set yk to y's key1
    if xk = yk then
    return x's key2 < y's key2
    else
    return xk > yk
    end if
    end cmpreco_key1_a_key2d
    on msort(cmp_, aa) -- v1.2f2
    Basic recursive merge sort handler having list sorted in place
    handler cmp_ : comparator
    * cmp_(x, y) must return true iff list element x and y are out of order.
    list aa : list to be sorted in place
    script o
    property parent : {} -- limit closure to minimum
    property xx : aa -- to be sorted in place
    property xxl : count my xx
    property yy : {}
    property cmp : cmp_
    on merge(p, q, r)
    property xx: source list
    integer p, q, r : absolute indices to specify range to be merged such that
    xx's items p thru r is the target range,
    xx's items p thru (q-1) is the first sublist,
    xx's items q thru r is the second sublist.
    (p < q <= r)
    local i, j, k, xp, xr, yi, yj, ix, jx
    if r - p = 1 then
    set xp to my xx's item p
    set xr to my xx's item r
    if my cmp(xp, xr) then
    set my xx's item p to xr
    set my xx's item r to xp
    end if
    return -- exit
    else
    if p < q - 1 then merge(p, (p + q) div 2, q - 1)
    merge(q, (q + r + 1) div 2, r)
    end if
    At this point, sublits xx[p, q-1] and xx[q, r] have been already sorted (p < q <= r)
    if my cmp(my xx's item (q - 1), my xx's item q) then
    else -- xx[p, q-1] & xx[q, r] are already sorted
    return
    end if
    set yy to my xx's items p thru r -- working copy for comparison
    set ix to q - p
    set jx to r - p + 1
    set i to 1
    set j to q - p + 1
    set k to p
    set yi to my yy's item i
    set yj to my yy's item j
    repeat
    if my cmp(yi, yj) then
    set my xx's item k to yj
    set j to j + 1
    set k to k + 1
    if j > jx then
    set my xx's item k to yi
    set i to i + 1
    set k to k + 1
    repeat until k > r
    set my xx's item k to my yy's item i
    set i to i + 1
    set k to k + 1
    end repeat
    return
    end if
    set yj to my yy's item j
    else
    set my xx's item k to yi
    set i to i + 1
    set k to k + 1
    if i > ix then
    set my xx's item k to yj
    set j to j + 1
    set k to k + 1
    repeat until k > r
    set my xx's item k to my yy's item j
    set j to j + 1
    set k to k + 1
    end repeat
    return
    end if
    set yi to my yy's item i
    end if
    end repeat
    end merge
    on cmp(x, y)
    (* primary comparator *)
    return x > y
    end cmp
    local d, i, j
    if xxl ≤ 1 then return
    if cmp_ = {} then set my cmp to cmp -- comparator fallback
    my merge(1, (xxl + 1) div 2, xxl)
    end script
    tell o to run
    end msort
    --END OF SCRIPT

  • Track/album article sorting script

    Hi
    Am sorting/tidying my iTunes library and exporting to a new external hard drive.
    I am being a tad OCD about this....lol.
    I have found scripts that are great and are helping but.....
    I would like to sort using the full title including 'A' 'The' and so on for artist, track and album.
    I can't find either a script app that would turn off aotosort or blank the relevant sibling field, I am hoping there is one.
    (There is a scipt for windows).
    My library is 100,000+ tracks compiled over the last few years so going through one by one would be extremely tedious.
    Many thanks
    Stephen

    Thank you.
    I am aware of what iTunes is doing
    and of the option of editing each the sibling sort fields.
    I am doing that at the momement but it is extremely tedious and prone to error.
    However there is a script for windows which overrides auotsort function.
    I want to know if a script or app is available that would over ride autosort on a mac.
    Thanks
    Stephen

  • Calling C Program in Flex (Action Script)

    Hello,
             I have a C program which i want to use in my Flex application.
            I have installed Cygwin on my machin to compile a C Program.
            But i don't know How to access this code from Flex.

    You should start by downloading FlasCC and building its samples: http://gaming.adobe.com/technologies/flascc/

  • Flex datagrid french sorting

    Hi,
    I am using flex datagrid to develop an application in french,
    as french is having special character in it,
    i need to sort datagrid column in french. Flex datagrid
    unable to sort data in french. i need french sorting,
    if somebody has solution of this please help me to get out of
    this.
    If possible please reply me on
    [email protected]

    i am using inbuilt flex sorting, i am not using sortcompare()
    function.
    its just a string sorting but as its in french ,character
    &quot;
    É&quot; is comig after character &quot;
    V&quot; , because flex treated it as a special character
    . it should come before &quot;
    V&quot;. so do we need to change character set for
    flex?

  • Script to Sort Images with/without transparency?

    I've made this a new thread because I posted a similar question that was answered correctly in another thread about a sorting script for images with and without clipping paths.. I'm hoping the trend continues. (I could probably modify the script myself if I knew the proper syntax for image transparency.)
    So, my question simply is: Is there a script that will sort images (in my case psds) into two separate folders, one containing images with transparency, and one with images with no transparency (or, no layers).
    Any help with this, as always, would be very very much appreciated,
    Thanks!
    Andy

    Another reason to create this as a new thread of course is to help anyone else who may do a search on this particular scripting need .

  • How can i Upload Files from my Flex 2.0 Application?

    How can i do a Upload File funtionality with Flex 2.0? Do i
    have to make the component? How is the code in Flex/ Action Script
    to make this possible?. I'm new in this Flex world and it seems to
    me very interesting to make RIA's Applications; in fact i'm making
    a little Employees Application for my company and i'm trying this
    technology and of course i need the functionality that i asking
    for.
    Regards.
    Andres.

    I haven't tried this, but I believe what you could do is
    append
    requestHeaders to the urlrequest object that you pass into
    the file.upload()
    method. The requestHeaders is an array of name/value pairs
    that would be
    included with your post. At least in theory, I believe that
    shoudl work.
    Good luck.
    Phil
    "tantalo" <[email protected]> wrote in
    message
    news:e3q3mt$138$[email protected]..
    > Hi. Phil, how i commented in the forum the examples
    works ok, with a
    > little
    > changes to make a file Upload. Now i have another doubt,
    i need to make a
    > submit of a form with another fields and the file
    selected.
    >
    > I made a HHTP Service for that purpose with the tags
    Requests like:
    >
    > <mx:HTTPService id="empleadoRequest"
    > url="
    http://andresbarrios:8080/directorio/empleados/insertarEmpleado.jsp"
    > useProxy="false" method="POST">
    > <mx:request xmlns="">
    >
    <empresa>{empresa.selectedItem.data}</empresa>
    >
    <ubicacion>{ubicacion.selectedItem.data}</ubicacion>
    >
    <departamento>{departamento.selectedItem.data}</departamento>
    > <cedula>{cedula.text}</cedula>
    > <nombre>{nombre.text}</nombre>
    > <apellido>{apellido.text}</apellido>
    > <!--Falta Fecha de Nacimiento -->
    > <sexo>{sexo.selectedItem.data}</sexo>
    >
    <estado_civil>{estado_civil.selectedItem.data}</estado_civil>
    >
    <telefono_celular>{telefono_celular.text}</telefono_celular>
    > <extension>{extension.text}</extension>
    >
    <correo_electronico>{correo_electronico.text}</correo_electronico>
    > </mx:request>
    > </mx:HTTPService>
    > I have the global variable called "file" that contains
    the file selected.
    > I
    > want to send this file variable in the HHTPservice call
    EmpleadoRequest,
    > can i
    > do that with a Request tag like another field? or the
    only way is trougth:
    > file.upload(upload.cfm) ?;
    >
    > I want only make a one call to the server to submit the
    fields of the form
    > and
    > to upload the file at th e same time can you help me How
    can i do that?
    >
    > Thanks.
    >
    > Regards.
    >
    > Andres.
    >
    >
    >

  • Can Bridge sort my images into folders based on an Exif date?

    All my Adobe products are pre-CS/CS2 and I don't yet have access to Adobe Bridge. My trial copy has also timed out. However, I would like to know if Bridge has the capability to take a folder of images (Canon Raw) and move them to new folders based on the original exposure date as stored in the Exif metadata (ideally creating the required target folders automatically). I'm thinking in terms of one folder per year, probably with subfolders for each month.
    I'm simply trying to avoid having all my images in a single humongous folder with Bridge re-creating (or at least re-displaying) thousands of thumbnails every time I just want to look at a few images. Sorting them into folders by date just seems a simple solution to that problem. However, I'd be very happy to hear about alternative image filing ideas.
    Once I have used Bridge to create extended metadata for image categories, etc, I'm also assuming that Bridge will let me search for images that match defined criteria no matter how many folders those images are stored in.

    I don't know of any functionality to do that in Bridge now; however, it certainly can be done via scripting.
    Perhaps one of our forum contributors might want to take on a "picture sorter" script...
    Bob
    Adobe Workflow Scripting

  • How to send xml to javascript from flex?

    Hello,
    I am using Flex Builder......I read blogs and wonderful tutorials on adobe website. But I found that I can only have data from Flex to script placed within main.template.html file.....when i tried to get same data by in my other .html or .aspx page, it did not work. Another thing I noticed in following tutorial
    http://blog.flexexamples.com/2008/03/09/calling-javascript-functions-from-your-flex-applic ations-using-the-externalinterface-api/
    is that we placed <iframe> in our html page to host flex object instead of using <object> tag etc.
    Please just let me know how to do very same thing as defined in tutorial but by hosting out flex object using <object><embed> tags etc and how to get data into our .html or .aspx page rather putting javascript (to receive data) in main.template.html file generated by Flex Builder...???

    Thanks for replying,
    Now I am facing another problem....I have added a script tag in index.template.html file that also contains other useful code used in my aspx page. I wanted to have that reply on my aspx page. So I placed all the script in a Core.js file and also the recieving method from flex in same Core.js file. I thought this way i will be able to access data coming from flex project to my aspx page. But something strange is happening, when i run .html file in bin-debug folder it fires receiving method placed in Core.js........but when I host that flex project .html file in my aspx page, it is not firing method. And also not firing when I run .html in bin-release folder....what am I doing wrong?

  • Calling Flex function from loaded SWF

    Hello,
    I need to load an external SWF file, wity ability to call functions from the base FLEX code script .
    Is that possible ? noting that the loaded SWF can be either in AS2 or AS3
    Thanks in advance ..

    There are some third party ways of talking to an as2 swf.  Google
    as2interface (or maybe as3interface)

  • Sorting folders base on extended attribute?

    I created a subclass of folder and added custome
    attribute 'sort'. I added several folders with the 'sort' value
    set. Now I want to retrive these folders sorted by the 'SORT'
    attribute. Below is my code, note if I put 'NAME' as my
    sortqualifier value the sort works, but using 'SORT' does not
    work, it returns 0 results.
    How can I specify the sort order which I want my folders to
    appear when the order is not based on the Folder class
    attributes? Does if not possible with subclassing what about
    other options?
    Vector liblist = new Vector();
    Folder po = null;
    PublicObject[] libraries = null;
    SortSpecification sort = new SortSpecification();
    SortQualifier sq = new SortQualifier("SORT", true); // <<< note
    attr.
    sort.addSortQualifier(sq);
    String rootDir = m_Root + curloc;
    po = (Folder)getPublicObject(session, rootDir);
    po.setSortSpecification(sort);
    libraries = po.getItems();
    for (int i = 0; i < libraries.length; i++) {
         liblist.addElement(libraries.getName());

    I don't know of any functionality to do that in Bridge now; however, it certainly can be done via scripting.
    Perhaps one of our forum contributors might want to take on a "picture sorter" script...
    Bob
    Adobe Workflow Scripting

  • What is the Need for communication between Flex ActionScript to Javascript

    Hi ,
    Flex has made it communication possible from FLEX Mx:script to Java Script .
    Can anybody could please tell me what is the need or any scenario  for communication Flex with Javascript
    Thanks in advance .

    1- Printing in Flex is terrible (although for simpler requirements it can do fine), true, but it's not incredibly better elsewhere in the browser unless I'm missing the point.  This can be gotten around for many by streaming PDFs or Excel spreadsheets from a server, though.
    2- If it has to be web, I guess you're stuck.  If it can be an installed app (AIR) I'd prefer to hook into Java.  Like I said, there may be some limited specific uses, but good reasons to base the majority of your app on JS hacks are hard to come by.

  • Multi page help flex 2 and CF

    hey guys
    I am creating this apps and so far, I have a search page
    that display data once user fills out a form (form and result) are
    all in one state/page. Now what I would like to do is when user
    clicks on one of the search result I would like to go to a details
    page. How do I do this? Currently user can move between pages via
    view stack and wipe up/down effect between pages. I want to keep
    the same effect, but now when user clicks on a record/row the page
    wipe's up and the down effect is the details page. If you can point
    me to a tutorial or some sample code that would be great. I am
    completely new to flex/action scripting.
    thanks
    Jay

    Look for the CF Extensions in the Flex 2 install directory.
    On Windows, the default location is:
    C:\Program Files\Adobe\Flex Builder 2\ColdFusion Extensions for Flex Builder
    There's a zip file there (the extension) and a "installation" html file. Read that .

Maybe you are looking for

  • ITunes syncing the wrong songs to my iPod

    I have recently been trying to sync my iPod with my iTunes library, and have been repeatedly failing. After slowing the process and attempting to do it a few songs at a time, I noticed that it was including songs I had not asked it to include. While

  • How to use HR_MAINTAIN_MASTERDATA to terminate an employee

    Greetings experts: I'm working on an inbound interface that, among other things, can terminate an employee.  I'm new to ABAP and so it was recommended to me early on to record PA40 for this action.  That seemed to be working great until they added a

  • Workflow creating task for user in Outlook

    Is it possible to create a task in outlook for a specific user via workflow? My Boss want to have every user informed via mail that there is a new element in a list (that works fine) and one User should have a task (even better a complete to do list)

  • Can anybody help me up? Spry variable heights?

    Hey everybody! I need help! I would like to make on a Spry Accordion variable heights... Actually it shoudl look exactly like this one... http://labs.adobe.com/technologies/spry/samples/accordion/AccordionSample.html#VariablePan elHeights But where t

  • Simple UI test

    I've managed to get check boxes working. No vast feat I know but I'm happy with it! Feast your eyes on the incredible red or grey box script! /// simple UI script that creates an image and fills it red or grey preferences.rulerUnits = Units.PIXELS va