Ultrashock Forums > Flash > Flex
Error #2007: Parameter child must be non-null.

You are currently viewing our website as a guest which gives you limited access to forums, files and other resources.

Click here to join now for free, and start interacting with our members, download files and much more!

Click here if you are looking for our Flash files and other professional assets.
 
Post Reply | View first unread | Rate Thread Search this Thread | Thread Tools | Display Modes

#1
Bookmark and Share!
Error #2007: Parameter child must be non-null.
Old 2008-08-06 Last edited by JJSAM : 2008-08-06 at 12:05.

I'm having a prob. with calling mxml component from a view stack.
Here is the Code:
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="src.*"> <!-- creationComplete="initApp()">-->
<!--<mx:Script>
        <![CDATA[
        	import mx.controls.Alert;
			import mx.collections.*;
			import mx.rpc.events.ResultEvent;
			import mx.rpc.events.FaultEvent;
			import mx.controls.dataGridClasses.DataGridColumn;
			import mx.utils.ObjectUtil;
		
		
			private function initApp(event:Event):void {
			if((event.currentTarget.selectedItem.ReferenceTable == "GAPs Report - &lt;5 Days Out") && (event.currentTarget.RecordCount == 0))
			{ Alert.show("Nothing Here");
			vsrep.selectedChild=vsrepGapTR;}
			}
        ]]>
    </mx:Script> -->
    
  <!--  <mx:Script>
		<![CDATA[
			import mx.controls.Alert;
			import mx.collections.*;
			import mx.rpc.events.ResultEvent;
			import mx.rpc.events.FaultEvent;
			import mx.controls.dataGridClasses.DataGridColumn;
			import mx.utils.ObjectUtil;
	
			private function initApp():void {
				 vsrep.selectedChild=vsrepGapTR;
			}
		]]>
	</mx:Script>-->

	<mx:Panel x="10" y="10" width="1331" height="751" layout="absolute">
		<mx:Text text="Welcome to Reporting Dashboard"
                    fontWeight="bold"
                    paddingTop="10" paddingLeft="10"  height="66" width="462" fontFamily="Georgia" fontSize="25" color="#800040"/>
       	<mx:HBox width="1037" height="84" x="10" y="74">
		<mx:Button label="Trafficing Dashboard" width="201" height="45" fontSize="15" fontFamily="Georgia" click="vs.selectedIndex=1"/>
		<mx:Button label="Planning Dashboard" width="201" height="45" fontSize="15" fontFamily="Georgia" click="vs.selectedIndex=2"/>
		<mx:Button label="Management Dashboard" width="201" height="45" fontSize="15" fontFamily="Georgia"/>
		<mx:Button label="Auditing Dashboard" width="201" height="45" fontSize="15" fontFamily="Georgia"/>
		<mx:Button label="Misc. Dashboard" width="201" height="45" fontSize="15" fontFamily="Georgia" x="982" y="10"/>
		</mx:HBox>   
			<mx:Panel x="10" y="157" height="458">
					
				<mx:ViewStack id="vs"

				       width="793" height="418"
				       selectedIndex="0">
				       <mx:Canvas>
				       <mx:Text text="SELECT   A   REPORTING   TAB" fontWeight="bold"
                    paddingTop="10" paddingLeft="10"  height="45" width="386" fontFamily="Georgia" fontSize="20" color="#800040" x="178.5" y="150"/>
				       </mx:Canvas>
				       
				       <mx:Canvas id="TRep1" backgroundColor="#f8f8f8" fontWeight="bold" width="793" height="542">
				       	<mx:Text text="TRAFFICING REPORTS" fontWeight="bold" paddingTop="10" paddingLeft="10"  x="246.5" y="0" width="322" fontFamily="Georgia" fontSize="20" color="#800040"/>
				       	<mx:Button x="59" y="68" label="GAPs Report - &lt;5 Days Out" width="217" height="65" fontFamily="Georgia" color="#800040" fontSize="15" fontWeight="bold" click="vsrep.selectedChild=vsrepGapTR"/>
				    	<mx:Button x="278.5" y="297" label="Summary Report" color="#800040" fontFamily="Georgia" width="217" height="65" fontSize="15" fontWeight="bold"/>
				       	<mx:Button x="484" y="68" label="Active Campaigns" width="217" height="65" fontSize="15" fontFamily="Georgia" color="#800040" fontWeight="bold"/>
				       	<mx:Button x="109" y="185" label="Blanks" width="217" height="65" fontSize="15" fontWeight="bold" fontFamily="Georgia" color="#800040"/>
				       	<mx:Button x="428" y="185" label="Creative Category" width="217" height="65" fontSize="15" fontWeight="bold" fontFamily="Georgia" color="#800040"/>
				       	</mx:Canvas>
				       
				       <mx:Canvas id="TRep2" backgroundColor="#f8f8f8" fontWeight="bold" width="793" height="418">
				       	<mx:Text text="PLANNING REPORTS"
				       	    fontWeight="bold"
				       	    paddingTop="10" paddingLeft="10"  x="288" y="10" width="217" fontFamily="Georgia" fontSize="15" color="#800040"/>
				       	<mx:Button x="297" y="68" label="GAP Report - &lt;5 Days Out" width="177" height="31" fontFamily="Georgia" color="#800040" fontSize="10" fontWeight="bold"/>
				       	<mx:Button x="26" y="68" label="Summary Report" color="#800040" fontFamily="Georgia" width="177" height="31" fontSize="11" fontWeight="bold"/>
				       	<mx:Button x="566" y="68" label="LAUNCH Report - Next 5 Days" width="200" height="31" fontSize="10" fontFamily="Georgia" color="#800040" fontWeight="bold"/>
				       	<mx:Button x="26" y="141" label="HOT Report - 5+ Days Out" width="177" height="31" fontSize="10" fontWeight="bold" fontFamily="Georgia" color="#800040"/>
				       	<mx:Button x="566" y="141" label="INCOMING Report - 2 Weeks+ Out" width="200" height="31" fontSize="10" fontWeight="bold" fontFamily="Georgia" color="#800040"/>
				       </mx:Canvas>
				       		<mx:ViewStack id="vsrep" width="1331" height="751" click="vs.selectedIndex=vs.numChildren-1"> 
				       			<local:GapTR id="vsrepGapTR" width="100%" height="100%" />
							</mx:ViewStack>	
				</mx:ViewStack>
		
				
			</mx:Panel>       
	</mx:Panel>				
</mx:Application>
whenever I call click for my report to show up it gives the following error:
TypeError: Error #2007: Parameter child must be non-null.
at flash.display:isplayObjectContainer/getChildIndex()
at mx.core::Container/getChildIndex()
at mx.containers::ViewStack/set selectedChild()
at TDB/___Button6_click()
need some help...
postbit arrow 7 comments | 3255 views postbit arrow Reply: with Quote   
Registered User
JJSAM is offline
seperator
Posts: 16
2008-08-01
JJSAM lives in United States
seperator

Ultrashock Member Comments:
JJSAM JJSAM is offline JJSAM lives in United States 2008-08-06 #2 Old  
someone plz reply
Reply With Quote  
JJSAM JJSAM is offline JJSAM lives in United States 2008-08-06 #3 Old  
Error #2007: Parameter child must be non-null.
i guess i did not explained the prob.
I have viewstack in a viewstack....
when i try to call an mxml component from the child view stack thru parent viewsatck
Code:
<mx:Button x="59" y="68" label="GAPs Report - &lt;5 Days Out" width="217" height="65" fontFamily="Georgia" color="#800040" fontSize="15" fontWeight="bold" click="vsrep.selectedChild=vsrepGapTR"/>
it gives me the foolowing error on localhost

TypeError: Error #2007: Parameter child must be non-null.
at flash.display:isplayObjectContainer/getChildIndex()
at mx.core::Container/getChildIndex()
at mx.containers::ViewStack/set selectedChild()
at TDB/___Button6_click()
any help is appreciated
Reply With Quote  
tiran tiran is offline tiran lives in United States 2008-08-06 #4 Old  
that typically means you are trying to access something before it has been defined or exists.
Reply With Quote  
worthyashes worthyashes is offline worthyashes lives in United Kingdom 2008-08-07 #5 Old  
A viewstack only creates the children as required unless explicitly told to. Try adding the parameter creationPolicy="all" to the ViewStack tag. This forces it to create all the kids so you should be able to access it.
Reply With Quote  
JJSAM JJSAM is offline JJSAM lives in United States 2008-08-07 #6 Old  
creationPolicy="all"
I did added the above tag. The error is gone.
However when I hit GAPs button it does nothing... Is it because the above tag...
Code:
					
				<mx:ViewStack id="vs"

				       width="793" height="418" creationPolicy="all"				       selectedIndex="0">
				       <mx:Canvas>
				       <mx:Text text="SELECT   A   REPORTING   TAB" fontWeight="bold"
                    paddingTop="10" paddingLeft="10"  height="45" width="386" fontFamily="Georgia" fontSize="20" color="#800040" x="178.5" y="150"/>
				       </mx:Canvas>
				       
				       <mx:Canvas id="TRep1" backgroundColor="#f8f8f8" fontWeight="bold" width="793" height="542">
				       	<mx:Text text="TRAFFICING REPORTS" fontWeight="bold" paddingTop="10" paddingLeft="10"  x="246.5" y="0" width="322" fontFamily="Georgia" fontSize="20" color="#800040"/>
				       	<mx:Button x="59" y="68" label="GAPs Report - &lt;5 Days Out" width="217" height="65" fontFamily="Georgia" color="#800040" fontSize="15" fontWeight="bold" click="vsrep.selectedChild=vsrepGapTR"/>
				    	<mx:Button x="278.5" y="297" label="Summary Report" color="#800040" fontFamily="Georgia" width="217" height="65" fontSize="15" fontWeight="bold"/>
				       	<mx:Button x="484" y="68" label="Active Campaigns" width="217" height="65" fontSize="15" fontFamily="Georgia" color="#800040" fontWeight="bold"/>
				       	<mx:Button x="109" y="185" label="Blanks" width="217" height="65" fontSize="15" fontWeight="bold" fontFamily="Georgia" color="#800040"/>
				       	<mx:Button x="428" y="185" label="Creative Category" width="217" height="65" fontSize="15" fontWeight="bold" fontFamily="Georgia" color="#800040"/>
				       	</mx:Canvas>
				       
				       <mx:Canvas id="TRep2" backgroundColor="#f8f8f8" fontWeight="bold" width="793" height="418">
				       	<mx:Text text="PLANNING REPORTS"
				       	    fontWeight="bold"
				       	    paddingTop="10" paddingLeft="10"  x="288" y="10" width="217" fontFamily="Georgia" fontSize="15" color="#800040"/>
				       	<mx:Button x="297" y="68" label="GAP Report - &lt;5 Days Out" width="177" height="31" fontFamily="Georgia" color="#800040" fontSize="10" fontWeight="bold"/>
				       	<mx:Button x="26" y="68" label="Summary Report" color="#800040" fontFamily="Georgia" width="177" height="31" fontSize="11" fontWeight="bold"/>
				       	<mx:Button x="566" y="68" label="LAUNCH Report - Next 5 Days" width="200" height="31" fontSize="10" fontFamily="Georgia" color="#800040" fontWeight="bold"/>
				       	<mx:Button x="26" y="141" label="HOT Report - 5+ Days Out" width="177" height="31" fontSize="10" fontWeight="bold" fontFamily="Georgia" color="#800040"/>
				       	<mx:Button x="566" y="141" label="INCOMING Report - 2 Weeks+ Out" width="200" height="31" fontSize="10" fontWeight="bold" fontFamily="Georgia" color="#800040"/>
				       </mx:Canvas>
				       	<mx:ViewStack id="vsrep" width="1331" height="751">
				       			<local:GapTR id="vsrepGapTR" width="100%" height="100%" />
				       			<local:ActiveCampaign id="vsrepActiveCampaign" width="100%" height="100%" />
				       			<local:Blanks id="vsrepBlanks" width="100%" height="100%" />
				       			<local:CreativeCategory id="vsrepCreativeCategory" width="100%" height="100%" />
							</mx:ViewStack>	
				</mx:ViewStack>
Reply With Quote  
JJSAM JJSAM is offline JJSAM lives in United States 2008-08-07 #7 Old  
Another Question I can create a viewstack ia another viewstack. Do i need to assign any priority to show up. Previously I had click="vs.selectedIndex=vs.numChildren-1" in ViewStack id="vsrep" I took it off.
Reply With Quote  
JJSAM JJSAM is offline JJSAM lives in United States 2008-08-07 #8 Old  
I changed the code to call local mxml components in the same viewstack. It worked!!!
Reply With Quote  
Thread Tools
Display Modes Rate This Thread
Rate This Thread: