dynamic component positioning in Panel

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default dynamic component positioning in Panel

    Ok, here is the problem description which I have been trying to solve out for
    couple of weeks.
    I have a static ViewStack component in Flex Application, where I dynamically
    create a Panel component.
    I set up Style for Panel width and height, using setStyle("width",200)
    command.
    Then, in "for" loop I create a dynamic Grid 3x4 component (I also set up
    Styles for width and height ) where I load thumbnails of images (twelve
    images).
    In a loop I check whether number of images is bigger than 12.
    If so, then in a Panel I create also a dynamic Button that has a onclick event
    to proceed to another dynamic Panel with new thumbnail images, embedded in new
    Grid.
    The problem that I am having is that I cannot specify x and y position for
    dynamic button. So if I want to put it on the bottom of the dynamic Panel it is
    always placed under the grid, on the left. But that is not what I want.
    I have tried to use setStyle for x and y position but with no effect as well.
    I hope that I explained the problem well.
    Does anybody have similar problem? Or maybe I am doing something wrong here?
    Thank!
    Here is a bit of code:



    for ( nr of all images){
    var g:Grid = new Grid();
    var p:Panel = new Panel();
    p.setStyle("layout","Absolute");
    p.setStyle("width",200);
    p.setStyle("height",360);

    if (nr_of_images>12)
    {
    var nextbutton:Button = new Button();
    nextbutton.label = ">";
    nextbutton.addEventListener(MouseEvent.CLICK,moveT oGrid);
    }

    for() // for embedding images to a grid
    {
    here I am adding images to griditem }
    } //end for
    g.setStyle("width",200);
    g.setStyle("height",320);
    g.setStyle("layout","Absolute");

    p.addChild(g); //add a dataGrid to dynamic Panel

    if (more than 12 images)
    {
    nextbutton.y = 300
    nextbutton.x = 100;
    p.addChild(nextbutton);
    }

    ThumbStack.addChild(p);//where Thumbstack is my ViewStack component
    }//for

    forkiada Guest

  2. Similar Questions and Discussions

    1. Panel component
      How do I round all 4 corners of a panel component? I can use CSS to round the top corners with: cornerRadius: 5; However, this does not round the...
    2. Flex 2.0 - Panel Component
      Hello All, I am facing a problem in Flex-panel component. This component does not have a Minimize/Maximize functionality.Really appreiciate if...
    3. CSS positioning navigational panel in the wrong spot
      HI all, I have a partion on my site that is not positioned where I want it. This is what I want. I want to have the navigational panel vertical...
    4. how to resize panel by dynamic adding a component on thelayout?
      how to resize mx:Panel - look at this sample http://flexapps.macromedia.com/flex15/charts/DragDrop.mxml and click chart checkbox, how to resize...
    5. industry positioning for flash MX using dynamic content
      hello there have your say or any great links would be great santhi
  3. #2

    Default Re: dynamic component positioning in Panel

    Anyone ? Please.
    How to place a dynamic button into a dynamic panel with specific x and y coordinates?
    forkiada Guest

  4. #3

    Default Re: dynamic component positioning in Panel

    You can't set dimensions, or x,y using setStyle, since they are properties.

    To explicitly place a component, you need a container that has absolute
    positioning. This can be a canvas, or a Panel with layout="absolute"

    If you need both, wrap the vertical layout component in an absolute one.

    Also look into contraint-based layout, if you haven't yet. using that you can
    specify, for instance, botton="5"

    Tracy

    ntsiii Guest

  5. #4

    Default Re: dynamic component positioning in Panel

    I do think this is a functionality that would be useful: Being able to position
    components, including z-order and visibility in style.

    You can accomplish similar stuff using the live compiler and config files, but
    from a 'pawn that off on the CSS design guy' mentality it would be nice.

    As far as your dynamic panel, you can use something like FlowBox or
    Flowsomething in the Flexlib on google to have things auto position, and then
    use setChildIndex to move them around and watch them reflow.

    But in general, you will use Canvas for absolute positioning, and simply put
    one of those into your Panel (or panel) and set the x and y of your new
    component in AS.

    So for instance in the above, you would simply do:
    p.width=300;
    rather than
    p.SetStyle('width','300');

    or

    g.x = 10;
    g.y = -5;

    slaingod Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139