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
Solved

Not able to pass ValueObject to component

Posted on 2011-02-18
2
449 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
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

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

Suggested Solutions

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…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

839 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