I seem to remember from my training class that if you're instantiating
UIComponents in ActionScript you have to call their initialize method before
you can interact with them.  You might give that a shot.

-Marty

On Wed, Jul 22, 2009 at 12:17 PM, Robert Green <
[email protected]> wrote:

>  Has anyone been able to successfully load a TileList into an ActionScript
> project without using MXML?
>
>
>
> If so, can you please help me out?
>
>
>
> Code Snippet:
> public var t:TileList = new TileList();
>
> public function Entertainment()
> {
>
> t.x = 5;
> t.y = 5;
> t.addItem( {label:'Robert', data:'Roebrt'} );
> t.setSize(316, 251);
> t.columnWidth = 310;
> t.direction = ScrollBarDirection.VERTICAL;
> t.cacheAsBitmap = true;
> t.allowMultipleSelection = false;
> //t.horizontalScrollPosition = 30;
> t.setStyle("cellRenderer", Thumb);
> addChild(t);
>
> }
>
>
>
> ERRORS:
>
> I am trying to simply add a TileList component to my application.  The
> error I am getting is that nasty Error: #1009:
>
>
>
> Main Thread (Suspended: TypeError: Error #1009: Cannot access a property
> or method of a null object reference.)
>
>             fl.containers::BaseScrollPane/drawBackground
>
>             fl.controls::TileList/draw
>
>             fl.core::UIComponent/callLaterDispatcher
>
>
>
> After review, the error occurs in the fl/containers/BaseScrollPane.as file
> on line 983. This is because the following method:
>
>
>
> *var* bg:DisplayObject = background;
>
>
>
> background = getDisplayObjectInstance(getStyleValue(*"skin"*)); // This
> returns a NULL
>
>
>
> background.width = width;  // Here is the ERROR because I try to use a
> property of a NULL object.
>
>
>
> //---------------------------
>
>
>
> I figured that this is something to do with the application trying to draw
> the TileList before its time, or something to that effect.  I have no
> trouble adding a TileList component using Flash CS3 but in this application
> it is complete as with NO Flash intervention nor any MXML files, therefore
> dragging a component to the stage is not an option.
>
>
>
> //----------------------------
>
>
>
> Has anyone run into a similar issue.  In the above example, I am simply
> using an AS file attempting to add a TileList component to the stage.  When
> I invoke the addChild(TileListComponentInstance) is when I get the above
> error. If I comment out this line (addChild) I will not get an error.!?!?
>
>
>
>
>
> -------------------------------------------------------------
> To unsubscribe from this list, simply email the list with unsubscribe in
> the subject line
>
> For more info, see http://www.affug.com
> Archive @ http://www.mail-archive.com/discussion%40affug.com/
> List hosted by FusionLink <http://www.fusionlink.com>
> -------------------------------------------------------------

Reply via email to