Solved

Not able to pass ValueObject to component

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now