Check the manuals , developers guide and building flex components , there is plenty of documentation.
However , for your particular case , just add a click listener to the button , and on it do something like
var foo:Button = new Button();
container.addChild(foo);
for the shape thing , for each shape or object you want make a component. .
Flex knows about dragging , on mouse down just call startDrag and on mouse down call endDrag , and create a new instance
of that particular component you want to place and init it's x and y properties with contentMouseX and contentMouseY.
Hope this helps.
However , for your particular case , just add a click listener to the button , and on it do something like
var foo:Button = new Button();
container.addChild(foo);
for the shape thing , for each shape or object you want make a component. .
Flex knows about dragging , on mouse down just call startDrag and on mouse down call endDrag , and create a new instance
of that particular component you want to place and init it's x and y properties with contentMouseX and contentMouseY.
Hope this helps.
----- Original Message ----
From: jack_freud <[EMAIL PROTECTED]>
To: flexcoders@yahoogroups.com
Sent: Wednesday, October 4, 2006 9:48:01 PM
Subject: [flexcoders] Dynamically adding components to a panel?
From: jack_freud <[EMAIL PROTECTED]>
To: flexcoders@yahoogroups.com
Sent: Wednesday, October 4, 2006 9:48:01 PM
Subject: [flexcoders] Dynamically adding components to a panel?
I'm still very new to Flex so what I thought should be hard is easy and
what I thought should be easy is hard!
I'm trying to find out how, to make an easy example, by pressing a
button, another new button would appear in the panel.
Ultimately I want to make a kind of toolbar or palette, where I could
drag a shape from the palette into the workspace, and a copy of that
shape would remain where I performed the drop.
I can't find any examples that do anything like this.
Thanks for anyone's help or direction.
__._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
Software development tool | Software development | Software development services |
Home design software | Software development company |
Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___