Solved

Pop Ups & PureMVC woes

Posted on 2009-04-08
19
617 Views
Last Modified: 2013-11-11
I asked a question early today. Located here. I thought it solved my problem with the Flash Event, but after trying multiple times. The problem still exists. My list is populated with data on the first opening of the pop up, but every time you open it afterwards, it's empty.

Here is the constructor, and case statement that is executed after the pop up is opened.

And this is the original post. Extremely frustrated....
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/Flex/Q_24306064.html

//CONSTRUCTOR: _onGetColumns retrieves the columns from another component successfully after pop up opened

public function ManageColumnsMediator(viewComponent:Object)

{

	super( NAME, viewComponent );

	viewComponent.addEventListener(FlexEvent.CREATION_COMPLETE, _onGetColumns);

	

}
 

//CASE statement in mediator that executes after columns are retreived successfully
 

case ApplicationFacade.COLUMNS_RETRIEVED:

	trace("Got Columns"); //JUST TO MAKE SURE I MAKE IT TO THIS CASE STATEMENT AFTER POP UP OPENED (TRUE)

	var list:List = new List();

	var cols:Array = new Array();

	cols = note.getBody() as Array;

	list.dataProvider = cols;

	list.labelField = cols.headerText;

       trace(mx.utils.ObjectUtil.toString(col));  //THIS PRINTS ALL THE DATA EACH TIME

	manageColumns.addChild(list);	

	break;
 

//GETTING VIEW COMPONENT

public function get manageColumns():ManageColumns

{

	return viewComponent as ManageColumns;

}

Open in new window

0
Comment
Question by:hallikpapa
  • 8
  • 8
  • 3
19 Comments
 
LVL 37

Expert Comment

by:zzynx
ID: 24104788
Just a question:

>> manageColumns.addChild(list);

is it needed to build up that (=the content of the popup window) every time?
Can't you build it up once and then for all other times just alter the list's dataprovider?
0
 

Author Comment

by:hallikpapa
ID: 24107417
No, I didn't think so. I had tried it like that based on an expert's suggestion. Originally I just had an  in my view component with cols being my dataProvider there. It's the same problem, it is showing the data in my trace after CREATION_COMPLETE is fired, but not in the list; only the first time.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 24107467
can I see _onGetColumns?
0
 

Author Comment

by:hallikpapa
ID: 24107654
sure
private function _onGetColumns(fe:FlexEvent):void

		{

			trace("getting columns");

			this.sendNotification(ApplicationFacade.RETRIEVE_COLUMNS);

		}

..

...

...

...

...

case ApplicationFacade.RETRIEVE_COLUMNS:

		   			var col:Array = this.analyticsView.reportsGrid.columns;		   			

		   			this.sendNotification(ApplicationFacade.COLUMNS_RETRIEVED, col);

		   			break;

Open in new window

0
 
LVL 37

Expert Comment

by:zzynx
ID: 24107868
So you send the retrieved columns with the notification
>> this.sendNotification(ApplicationFacade.COLUMNS_RETRIEVED, col);

And here
>> cols = note.getBody() as Array;
you get them out.
Are you sure that here they are available?

What does getBody() looks like?
0
 

Author Comment

by:hallikpapa
ID: 24107965
It's a trace/dump of the col array that was sent. I went through and checked and all the columns are there. I also hit a breakpoint in Flex Builder and it is displaying everything correctly. I am using the most current version of PureMVC, but not the multi core one if that means anything
0
 
LVL 37

Expert Comment

by:zzynx
ID: 24108083
Running out of ideas to help. Sorry.
0
 

Author Comment

by:hallikpapa
ID: 24108169
Yeah, I am going to abandon the pop up, and just do it in a panel on the right. It works great that way.

How about this. I have put this list in a panel to the right of the grid. I can drag it open and closed, but is there some component that will "snap" it open and closed?

I have seen collapsible menus, but they are horizontal. I would like to make it vertical, along the right side of the screen.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 24108226
>> is there some component that will "snap" it open and closed?
We made our own OurHDevidedBox (extending HDevidedBox) and OurBoxDivider (extending BoxDivider) having that functionality
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.

 
LVL 37

Accepted Solution

by:
zzynx earned 500 total points
ID: 24108259
0
 
LVL 37

Expert Comment

by:zzynx
ID: 24108283
0
 

Author Closing Comment

by:hallikpapa
ID: 31568387
I like this much better. Thanks!
0
 
LVL 37

Expert Comment

by:zzynx
ID: 24108304
Thanx 4 axxepting
0
 
LVL 5

Expert Comment

by:Fuzzy_Logic_
ID: 24110207
I realise that you are dropping the popUp window, but its bugging me why the popUp is not being populated.

My line of thinking at the moment is that an object gets added to the popUp everything works fine initially. When you close the popUp this object is left stranded, this stranded object receives the 'columns' but a new blank object gets added to the popUp.
 
0
 

Author Comment

by:hallikpapa
ID: 24110462
Trust me. It's bugging me too. I have another app I was trying to accomplish the same thing. And it behaves in the exact same manner. First initial pop up it works fine. Every time it opens afterwards, it is blank.

The really puzzling thing is the final step, after the pop up is created, I am populating/tracing the dataProvider. And it's all there.

The ONLY thing I can think of is I had a problem similar to this with an older version of PureMVC (I am using the current build though). And this one function that dealt with a pop up would not let me set it without passing the data, and retrieving through notification.getBody() in a switch statement.

I was going to ask Cliff from PureMVC about this. I am going to create a dummy project tonight with the exact same scenario, and post it if you like.
0
 
LVL 5

Expert Comment

by:Fuzzy_Logic_
ID: 24110668
That would be really helpful.

FL
0
 

Author Comment

by:hallikpapa
ID: 24118711
Here is a link to the project archive. I am printing all the objects the first time, but every other time you open the pop up window, the list is empty.

http://www.mediafire.com/?czyxntnmydg 

Watch the trace logs, you see the cols field being populated.
0
 
LVL 5

Expert Comment

by:Fuzzy_Logic_
ID: 24119527
Well I was nearly right.

You are not removing the mediator.

What is happening is first run:

PopUpMediator1 built (Name = "popUpMediator") PopUpWindow1 built List added by first Mediator with name "popUpManager" which references PopUpWindow1

PopUpManager removes PopUpWindow1 but PopUpMediator1 still has reference so it is not destroyed.

second run:

PopUpMediator2 built (Name = "popUpMediator" ) PopUpWindow2 built List added by the first Mediator with name "popUpManager" which is the first one that was built which references PopUpWindow1

PopUpManager removes PopUpWindow2 but PopUpMediator2 still has reference so it is not destroyed.

Essentially you end up with a load of PopUpMediators each one with its own PopUpWindow. But when pureMVC looks for the Mediator it will got to the first one in the list which has a reference to PopUpWindow1 and thats the one that always receives the column list. You only ever see that PopUpWindow on the first run.

 Think thats as clear as mud :-)

PopUpMediator.as
 

        public function PopUpMediator(viewComponent:PopUp):void

        {

            

            super(NAME, viewComponent);

            viewComponent.addEventListener(FlexEvent.CREATION_COMPLETE, popUpCreation_Complete);

            viewComponent.addEventListener(CloseEvent.CLOSE, popUp_Close);

             

            

        }
 

        private function popUp_Close(ce:CloseEvent):void

        {

            

           sendNotification(AppFacade.CLOSE_POPUP, viewComponent as PopUp);

            

        }
 
 

and in ClosePopUpWindowCommand.as
 

        override public function execute(notification:INotification):void

        {

           // Remove the mediator

            facade.removeMediator(PopUpMediator.NAME);

           

        }

 

Open in new window

0
 

Author Comment

by:hallikpapa
ID: 24121030
That totally makes sense now that I can see that. THank you for taking the time and pointing it out. It will definetly help out in future projects!
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

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 been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
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.

912 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

24 Experts available now in Live!

Get 1:1 Help Now