Re: [flexcoders] Is it possible to add Flex components to the Stage?

2011-09-23 Thread ganaraj p r
Flex is a complete framework and each and every component follows the rules
of the framework. Without the framework running in the background its
probably impossible to get a component working unless you do a lot of work
to make it work. Perhaps much easier to write a separate AS3 component.

On Thu, Sep 22, 2011 at 11:22 PM, Jeffry Houser jef...@dot-com-it.comwrote:

 **



  addElement is only defined in spark components; that will just throw a
 compile time error.

  I'm not sure why you want to add a Flex Component directly to the stage.
 I suppose in theory you could; but that would bypass all the Flex Framework
 code to position and size the component.  You'd, in essence, need to write
 your own layout manager. that performs the same functionality as the Flex
 Layout manager.

  In the context of Flex; it probably isn't a good idea to access the stage
 directly.

 On 9/22/2011 2:33 PM, grimmwerks wrote:



 Try stage.addElement  rather than addChild?


  On Sep 22, 2011, at 2:30 PM, Hogs Haven wrote:

  From everything I've read, Flex components can only be added to Flex
 Components (ie: VBox to Application, VGroup to Panel, etc)

 I'm working in an AS3 view library (no Flex, just Sprites) where I need to
 add a Scrollable container component to the Stage on a click event. There's
 no way to do this as I see it unless I write my own Scroll container, use
 Flex SDK (don't think this works), or use fl.containers.ScrollPane (which is
 not an option since we're not using a .fla)

 So basically, I'm trying to accomplish this, as simple runnable example,
 but it fails silently and nothing appears...any ideas? Thanks.


 ?xml version=1.0 encoding=utf-8?
 s:Application xmlns:fx=http://ns.adobe.com/mxml/2009;
 xmlns:s=library://ns.adobe.com/flex/spark
 xmlns:mx=library://ns.adobe.com/flex/mx
 creationComplete=application1_creationCompleteHandler(event)
  fx:Script
  ![CDATA[
   import mx.containers.Panel;
   import mx.core.UIComponent;
   import mx.events.FlexEvent;


 protected function
 application1_creationCompleteHandler(event:FlexEvent):void
 {
  addEventListener(Event.ADDED_TO_STAGE, onAdded);
 }

 private function onAdded(e:Event):void
 {
var myPanel : Panel = new Panel();
myPanel.width=100;
myPanel.height=100;
stage.addChild(myPanel); //nothing happens
 }
  ]]
  /fx:Script
  fx:Declarations/fx:Declarations

 /s:Application




 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location:
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo!http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo%21Groups
  Links




   Garry Schafer
 grimmwerks
 gr...@grimmwerks.com
 portfolio: www.grimmwerks.com/







 --
 Jeffry Houser
 Technical Entrepreneur203-379-0773
 --http://www.flextras.com?c=104
 UI Flex Components: Tested! Supported! Ready!
 --http://www.theflexshow.comhttp://www.jeffryhouser.comhttp://www.asktheflexpert.com
 --
 Part of the DotComIt Brain Trust

  




-- 
Regards,
Ganaraj P R


Re: [flexcoders] Is it possible to add Flex components to the Stage?

2011-09-22 Thread grimmwerks
Try stage.addElement  rather than addChild?


On Sep 22, 2011, at 2:30 PM, Hogs Haven wrote:

 From everything I've read, Flex components can only be added to Flex 
 Components (ie: VBox to Application, VGroup to Panel, etc)
 
 I'm working in an AS3 view library (no Flex, just Sprites) where I need to 
 add a Scrollable container component to the Stage on a click event. There's 
 no way to do this as I see it unless I write my own Scroll container, use 
 Flex SDK (don't think this works), or use fl.containers.ScrollPane (which is 
 not an option since we're not using a .fla)
 
 So basically, I'm trying to accomplish this, as simple runnable example, but 
 it fails silently and nothing appears...any ideas? Thanks.
 
 
 ?xml version=1.0 encoding=utf-8?
 s:Application xmlns:fx=http://ns.adobe.com/mxml/2009; 
  xmlns:s=library://ns.adobe.com/flex/spark 
  xmlns:mx=library://ns.adobe.com/flex/mx
 creationComplete=application1_creationCompleteHandler(event)
   fx:Script
   ![CDATA[
   import mx.containers.Panel;
   import mx.core.UIComponent;
   import mx.events.FlexEvent;
   
   
 protected function application1_creationCompleteHandler(event:FlexEvent):void
 {
  addEventListener(Event.ADDED_TO_STAGE, onAdded);
 }
   
 private function onAdded(e:Event):void 
 {
var myPanel : Panel = new Panel();
myPanel.width=100;
myPanel.height=100;
stage.addChild(myPanel); //nothing happens
 }
   ]]
   /fx:Script
   fx:Declarations/fx:Declarations
   
 /s:Application
 
 
 
 
 
 
 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location: 
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives: 
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
 
 
 

Garry Schafer
grimmwerks
gr...@grimmwerks.com
portfolio: www.grimmwerks.com/







Re: [flexcoders] Is it possible to add Flex components to the Stage?

2011-09-22 Thread Jeffry Houser


 addElement is only defined in spark components; that will just throw a 
compile time error.


 I'm not sure why you want to add a Flex Component directly to the 
stage.  I suppose in theory you could; but that would bypass all the 
Flex Framework code to position and size the component.  You'd, in 
essence, need to write your own layout manager. that performs the same 
functionality as the Flex Layout manager.


 In the context of Flex; it probably isn't a good idea to access the 
stage directly.


On 9/22/2011 2:33 PM, grimmwerks wrote:


Try stage.addElement  rather than addChild?



On Sep 22, 2011, at 2:30 PM, Hogs Haven wrote:

From everything I've read, Flex components can only be added to Flex 
Components (ie: VBox to Application, VGroup to Panel, etc)


I'm working in an AS3 view library (no Flex, just Sprites) where I 
need to add a Scrollable container component to the Stage on a click 
event. There's no way to do this as I see it unless I write my own 
Scroll container, use Flex SDK (don't think this works), or use 
fl.containers.ScrollPane (which is not an option since we're not 
using a .fla)


So basically, I'm trying to accomplish this, as simple runnable 
example, but it fails silently and nothing appears...any ideas? Thanks.



?xml version=1.0 encoding=utf-8?
s:Application xmlns:fx=http://ns.adobe.com/mxml/2009;
  xmlns:s=library://ns.adobe.com/flex/spark
  xmlns:mx=library://ns.adobe.com/flex/mx
creationComplete=application1_creationCompleteHandler(event)
fx:Script
![CDATA[
import mx.containers.Panel;
import mx.core.UIComponent;
import mx.events.FlexEvent;


protected function 
application1_creationCompleteHandler(event:FlexEvent):void

{
 addEventListener(Event.ADDED_TO_STAGE, onAdded);
}

private function onAdded(e:Event):void
{
   var myPanel : Panel = new Panel();
   myPanel.width=100;
   myPanel.height=100;
   stage.addChild(myPanel); //nothing happens
}
]]
/fx:Script
fx:Declarations/fx:Declarations

/s:Application






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Alternative FAQ location: 
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
Search Archives: 
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! 
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo%21 
Groups Links



flexcoders-fullfeatu...@yahoogroups.com 
mailto:flexcoders-fullfeatu...@yahoogroups.com





Garry Schafer
grimmwerks
gr...@grimmwerks.com mailto:gr...@grimmwerks.com
portfolio: www.grimmwerks.com/ http://www.grimmwerks.com/









--
Jeffry Houser
Technical Entrepreneur
203-379-0773
--
http://www.flextras.com?c=104
UI Flex Components: Tested! Supported! Ready!
--
http://www.theflexshow.com
http://www.jeffryhouser.com
http://www.asktheflexpert.com
--
Part of the DotComIt Brain Trust