Solved

Not able to pass ValueObject to component

Posted on 2011-02-18
2
450 Views
Last Modified: 2012-05-11
Hi Expert,

I am trying to pass one ValueObject from my main application to one of the component which is used in the main application.
It is showing null.
could you please tell where i am wrong.
Here is my code attached.
In Main Application:
--------------------
<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"
				   xmlns:comp="com.att.ntscp.view.component.*" 
				   skinClass="com.att.ntscp.view.style.CommandApplicationContainerSkin"
				   width="100%" height="700" creationComplete="init();">
<fx:Script>
    <![CDATA[
    public var commandName:String;
    public var cardType:String;
    public var commandType:String;
    public var attuid:String;
    public var cmd:CommandVO;

    public function init():void{
				commandId = FlexGlobals.topLevelApplication.parameters['commandId'];
				commandName = FlexGlobals.topLevelApplication.parameters['commandName'];
				cardType = FlexGlobals.topLevelApplication.parameters['cardType'];
				commandType = FlexGlobals.topLevelApplication.parameters['commandType'];
				cmd = new CommandVO();
				cmd.commandId = commandId;
				cmd.commandName = commandName;
				cmd.cardType = cardType;
				cmd.cmdType = commandType;
				comp.fetchCmdDtls();
				
			}
		]]>
</fx:Script>

	<mx:VBox id="cmdbox5" resizeEffect="{resize}" width="100%" height="700" backgroundColor="0xEEF9F8" horizontalScrollPolicy="off" >
		<comp:SomeComponent id="comp"/>
	</mx:VBox>
</s:Application>

SomeComponent.mxml
-------------------
<s:VGroup xmlns:fx="http://ns.adobe.com/mxml/2009" 
xmlns:s="library://ns.adobe.com/flex/spark" 
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:comp="com.att.ntscp.view.component.*" width="100%" 
>

<fx:Script>
    <![CDATA[
     import com.att.ntscp.vo.CommandVO;	
     import mx.core.FlexGlobals;		
     private var commandId:int;			
     private var commandName:String;
     private var commandType:String;
     private var cardType:String;
     private var attuid:String;	      	             public var cmdVO:CommandVO;

public function fetchCmdDtls():void{
Debug.echo(producer,this.toString(),"::SubComp In fetchDetls()","#0000FF")// after this statement, control is not going
commandId = int(cmdVO.commandId);
Debug.echo(producer,this.toString(),"::SubComp In fetchDetls() commandId = "+commandId,"#0000FF")
if(commandId<=0) {
commandId = -1;
}
commandName = cmdVO.commandName;
Debug.echo(producer,this.toString(),"::SubComp In fetchDetls() commandName = "+commandName,"#0000FF")
commandType = cmdVO.cmdType;
cardType = cmdVO.cardType;				
ntscpSrv.getCommandHelp(commandId,commandName,commandType,cardType);//calling remote method	
}

Here is the CommandVO.as
------------------------
[RemoteClass(alias="nscom.FrameWork.Command")]
	public class CommandVO
	{
		public function CommandVO()
		{
		}
		public var commandId:String;
		public var commandName:String;
		public var cardType:String;
		public var cmdType:String;
		public var commandDescription:String;
		public var argumentList:ArrayCollection;
		...

Open in new window

0
Comment
Question by:Alpita
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
deepanjandas earned 500 total points
ID: 34931239
Try this:
 
public function init():void{
                                commandId = FlexGlobals.topLevelApplication.parameters['commandId'];
                                commandName = FlexGlobals.topLevelApplication.parameters['commandName'];
                                cardType = FlexGlobals.topLevelApplication.parameters['cardType'];
                                commandType = FlexGlobals.topLevelApplication.parameters['commandType'];
                                cmd = new CommandVO();
                                cmd.commandId = commandId;
                                cmd.commandName = commandName;
                                cmd.cardType = cardType;
                                cmd.cmdType = commandType;
                                comp.cmdVO = cmd;
                                comp.fetchCmdDtls();
                                
                        }
                ]]>

Open in new window


Warm Regards
Deepanjan Das
0
 

Author Closing Comment

by:Alpita
ID: 34931507
Thanks. Now, it is fine.
0

Featured Post

Surfing Is Meant To Be Done Outdoors

Featuring its rugged IP67 compliant exterior and delivering broad, fast, and reliable Wi-Fi coverage, the AP322 is the ideal solution for the outdoors. Manage this AP with either a Firebox as a gateway controller, or with the Wi-Fi Cloud for an expanded set of management features

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
enable compression/gzip on oracle XML DB HTTP Server 3 577
adobe air: a simple question 3 371
Flash AS3 & color circles animation 3 1,090
Consuming Web Service output 2 400
First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question