Solved

issue with viewstack

Posted on 2009-05-18
7
310 Views
Last Modified: 2013-11-11
Hi experts,

i have viewstack., i wan to perform something when view is changed,  because the view is not instantiated at the time i click the button  i have to listen for the creation complete event but still i am getting error

TypeError: Error #2007: Parameter listener must be non-null.
at flash.events::EventDispatcher/addEventListener()



//code- part of function called on button click to change the view

		

	viestack.selectedChild = view2;

	viestack.addEventListner(IndexChangedEvent.CHANGE, vchange);

	

                     function vchange():void{

	view2.addEventListner(FlexEvent.CREATION_COMPLETE, startn);

	viestack.removeEventListner(IndexChangedEvent.CHANGE, vchange);

	}

	function startn():void{

	trace("inst view stack here")

	view2.removeEventListner(FlexEvent.CREATION_COMPLETE, startn);

	}

Open in new window

0
Comment
Question by:rakesh16d
  • 4
  • 3
7 Comments
 
LVL 19

Expert Comment

by:Jones911
ID: 24417877
function startn(changeEvent:FlexEvent):void{

Try that
0
 

Author Comment

by:rakesh16d
ID: 24418129
thanks for reply.. i have tried startn(changeEvent:FlexEvent):void
also, vchange(event:IndexChangedEvent)

i tried debugging but its not getting into the function vchange(),  that is the place where it is breaking.


0
 
LVL 19

Expert Comment

by:Jones911
ID: 24418167
This this event is never occuring: IndexChangedEvent.CHANGE
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:rakesh16d
ID: 24418170
more code..
function changeviewnoe():void{

 switch(e.cuttenttarget.id){

 case"button2":

      viestack.selectedChild = view2;

      viestack.addEventListner(IndexChangedEvent.CHANGE, vchange);

      

      function vchange():void{

	view2.addEventListner(FlexEvent.CREATION_COMPLETE, startn);

	viestack.removeEventListner(IndexChangedEvent.CHANGE, change);

      }

      function startn():void{

         trace("inst view stack here")

	view2.removeEventListner(FlexEvent.CREATION_COMPLETE, startn);

      }
 

}

}

Open in new window

0
 

Accepted Solution

by:
rakesh16d earned 0 total points
ID: 24436283
solved myself
0
 
LVL 19

Expert Comment

by:Jones911
ID: 24436453
How?  You shoudl post the solution and give yourself the points.
0
 

Author Comment

by:rakesh16d
ID: 24441659
i was suppose to dispatch custom event on creation on that view. so on creation complete of that view i added the code for dispatching event, which happens only for the first time when view is created.. after that since view is there, no null reference error will come so i had a code to dispatch the same event when user select the same view again,, which happens in switch statement. there should be some efficient way to do it but for now it works for me :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Flex AS3 image Compression 2 705
High Internet Explorer CPU on Flash site in Citrix 2 766
flash in chrome 4 85
Play RTMP without Flash 3 427
I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

920 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

13 Experts available now in Live!

Get 1:1 Help Now