Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
forkiada #1
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
-
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... -
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... -
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... -
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... -
industry positioning for flash MX using dynamic content
hello there have your say or any great links would be great santhi -
forkiada #2
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
-
ntsiii #3
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
-
slaingod #4
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



Reply With Quote

