A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Table with points 'n that

  1. #1
    Junior Member
    Join Date
    Oct 2009
    Posts
    11

    sortOn() dynamic text, and values

    Updated question:
    Is there a way to sort dynamic texts based on the variable (or simple value) they represent?



    Old dribble:
    I'm looking for some pointers for a problem with making a table. It may be that I have started off in the wrong direction - anyways, I'm stuck now.

    The .png displays my objects, and how they are connected/grouped.
    The highlighted (red) shows the variable containing the points. The pink with the most points should be displayed higher than the rest, and 2nd most points should ofc be 2nd highest. I have tried taking the red variable out of the pink, but I could not think of a way of moving the red variable based on its own value.

    So, if anyone have anything to help me here, I'm a happy man.

    I'm going to edit the red variables (as the world cup goes on), and there is no need for cookies and such.

    And if there is a simpler way of doing the setup, let me know. I'm using SwishMax3 (SM2 up till a few days ago, so I'm more used to as2..)


    cheers
    Zcaarch
    Attached Images Attached Images
    Last edited by zcaarch; 02-14-2010 at 08:00 PM.

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    If you have these in an array you should be able to sort it based on that variable and adjust the position from there -

    PHP Code:
    var a:Array = [pRSApMEXpURUpFRA];

    a.sortOn('urup');

    for(var 
    i:int 0a.length; ++i){
        
    a.30;

    That's assuming 'urup' is a visible property on each of those objects.
    Please use [php] or [code] tags, and mark your threads resolved 8)

  3. #3
    Junior Member
    Join Date
    Oct 2009
    Posts
    11
    urup is the name for just the one dynamic text displaying the one variable. I have 4 dynamic text, each displaying the variable containing the points for just that team.

    But I'm guessing I can make it the name of all the text fields, as long as the variable being displayed differ from each one..
    I put that bit of code in "grupa" (green)? I am trying as I type, but no luck as of yet.

    Thnx for replying, how ever. Feel more confident it will eventually work now

  4. #4
    Junior Member
    Join Date
    Oct 2009
    Posts
    11
    Ok.. so I have come to this:
    Actionscript Code:
    onSelfEvent (enterFrame){
    var a:Array = [pRSA, pMEX, pURU, pFRA];
    a.sortOn(pRSA.rsap | pMEX.mexp | pURU.urup | pFRA.frap);
    for(var i:int = 0; i < a.length; ++i){
        a[i++]._y = 55-35;
        a[i++]._y = 80-35;
        a[i++]._y = 105-35;
        a[i++]._y = 130-35;}}
    A little change from neznein9s code. And it sorts and outputs as it sorts. Only problem is it sorts on letter in var a:Array, and not the values inside a.sortOn().

    Can't seem to get my head around this.

    pRSA, pMEX, pURU and pFRA are all groups containing the variables in my sortOn(**HERE**)
    pRSA.rsap, pMEX.mexp, pURU.urup and pFRA.frap are variables containing points for each group (they are located in the groups mentioned before aswell (as you can see).

    Any pointers?

  5. #5
    Junior Member
    Join Date
    Oct 2009
    Posts
    11
    I think the problem is that the sortOn() does not look at the variable defining pRSA.rsap and the other dynamic texts inside the sortOn()-function. It only sorts on the name of the dynamic text and not what it displayes.

    Is there a way to sort dynamic texts based on the variable (or simple value) they represent?
    Last edited by zcaarch; 02-11-2010 at 01:23 PM.

  6. #6
    Junior Member
    Join Date
    Oct 2009
    Posts
    11
    bump

    Is there a way to sort dynamic texts based on the variable (or simple value) they represent?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center