Solved

Not able to pass ValueObject to component

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

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…
For months I had no idea how to 'discover' the IP address of the other end of a link (without asking someone who knows), and it drove me batty. Think about it. You can't use Cisco Discovery Protocol (CDP) because it's not implemented on the ASAs.…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

770 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