Flex apps override addChild to only allow things that implement
IUIComponent. If you need to add a child that's just a plain display
object, manipulate the rawChildren property instead.

On 2/14/08, Gregory N <[EMAIL PROTECTED]> wrote:
> Glen,
>  > ...you can have your class in the app folder
>
> > called SystemCore.as this looks like it extends a display object
>
>
> Not exactly :-)
>  If It extends Sprite, the result is "grey-gradient" standard flex bg,
>  w/o any traces of my objects. Trace commands are executed nice,
>  however.
>  If I make the main class extending mx.core.Application then, in
>  addition to tracing messages,  I can see my (white) background and
>  "initializing" progress bar.
>  But:
>  ===
>  [Fault] exception, information=TypeError: Error #1034: Type Coercion
>  failed: cannot convert mx.core::[EMAIL PROTECTED] to
>  mx.core.IUIComponent.
>  Fault, addingChild() at Container.as:3301
>  ===
>  where FlexSprite is used in code:
>
>  var triangle:FlexSprite = new FlexSprite( );
>  // drawing a triangle...
>  addChild(triangle);
>
>  And it's addChild() that causes the error (no error with addChild() 
> commented).
>
>  So far, it looks strange for me, as the argument's type of
>  mx.core.Application.addChild() is DisplayObject.
>
>  Thoughts?
>
>
>
>  Glen Pike wrote:
>  > You can write pure AS3 files for Flex - all MXML gets "compiled
>  > down" to AS3 before it is compiled to bytecode.
>  >
>  > (I had done followed an example online which has a pure AS3
>  > component - once it is written, you add the package to your namespace
>  > and add an MXML tag in your code to add it to the stage.)
>  >
>  > Like with the workaround on the forum you posted - if you have added
>  > your package path to the namespace ( xmlns:app="app.*"), you can write
>  > your code in an AS file rather than an MXML file, then you write it as
>  > you would any other class file - no need for Script tags & mixing mxml /
>  > as code.
>  > <?xml version="1.0" encoding="utf-8"?>
>  > <mx:Application horizontalScrollPolicy="off"
>  > xmlns:mx="http://www.adobe.com/2006/mxml"; xmlns:app="app.*"
>  > layout="absolute" frameRate="30">
>  > <app:SystemCore id="sysCore" width="100%" height="100%"/>
>  > </mx:Application>
>  >
>  > So the above example, you can have your class in the app folder
>  > called SystemCore.as this looks like it extends a display object or
>  > similar as it has width and height attributes - not sure about extending
>  > other classes.
>
>
> --
>
> Best regards,
>  GregoryN
>  ================================
>  http://GOusable.com
>  Flash components development.
>  Usability services.
>  _______________________________________________
>
> Flashcoders mailing list
>  Flashcoders@chattyfig.figleaf.com
>  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>


-- 
Cory Petosky : Lead Developer : PUNY
1618 Central Ave NE Suite 130
Minneapolis, MN 55413
Office: 612.216.3924
Mobile: 240.422.9652
Fax: 612.605.9216
http://www.punyentertainment.com
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to