Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Flex > Flex 2, 3 & 4

Thread Tools Rate Thread Display Modes
Old 03-04-2008, 06:25 PM   #1
Banned by AS.org Staff
Join Date: Jun 2006
Posts: 17
Default Validating TabNavigator Tabs Before They Are Viewed

I have a TabNavigator instance that I'm using as a container for a form. The form is split up in this way to conserve screen space. When the user clicks the 'submit' button on the bottom, I have a method that uses validators to validate all of the fields in each of the tabs.

The problem is that the tabs that have not been viewed by the user have not initialized their respective fields. This results in the 'source' property of each of the un-initialized fields to return 'null.' Flex then complains: 'unable to access null object reference.'

Is there a way to programmatically initialize the Containers in each tab so that I can validate the fields inside of them? I've tried to use the following code, but it doesn't seem to have any effect...

var arr:Array = tabNavigator.getChildren();

for(var x:Number = 0; x < arr.length; x++){


suicidePills is offline   Reply With Quote
Old 03-05-2008, 05:32 PM   #2
dr_zeus's Avatar
Join Date: Mar 2005
Location: Silicon Valley
Posts: 1,999

Check out the creationPolicy property. By default, components on tab pages don't get created until they're viewed. If you set creationPolicy to "all", they will be created immediately.

However, you might want to consider using binding with variables so that your data is always available rather than relying on the creation of your controls. Not only is it better object-oriented design, but it will also allow you to take advantage of the optimization Adobe made by setting the default creationPolicy to "auto" rather than "all".
Josh Tynjala | Feathers
dr_zeus is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
i need to call a function each time the canvas component is viewed ranjeeth ActionScript 3.0 0 11-15-2007 06:09 AM
Differencing viewed btns from non-viewed btns nichol_e ActionScript 2.0 3 07-26-2007 01:05 PM
Does someone knows how to actionscript Validating sobehind ActionScript 2.0 2 04-20-2006 12:08 AM
detect swf viewed duration dancinkid6 HTML and JavaScript 0 02-07-2006 06:15 AM
Button: load previously viewed external swf dssground ActionScript 2.0 2 03-09-2005 07:09 PM

All times are GMT. The time now is 09:23 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.