View Full Version : PopUpManager Class
fu-meng
01-31-2005, 10:32 PM
hi.
i'm having problems referencing a datagrid component in a pop-up window that i created with the PopUpManager class. i have a showWindow() method that contains the script to create a pop-up.
here's how i invoke my showWindow() method:
showWindow( "myMovieTitle", "contents_mc", 400, 250, 200, 200 );
and then here's the actual method:
function showWindow( title, contents, width, height, x, y )
{
// create the Pop Up
_global.windowMgr = PopUpManager.createPopUp( _root, Window, true,
{ closeButton: true, title: title, contentPath: contents } );
}
and then within "contents_mc" i have a dataGrid component with an instance name of "myDataGrid".
so, how can i target it? i've tried everything but am lost. anyone tips or suggestions are very much appreciated.
thanks. -- fumeng.
hi
shoud by :
_global.windowMgr.content.MYTARGET
but (it's seams so) it's not instantly there
fu-meng
02-01-2005, 02:17 PM
hi xeef. thanks for continuing to provide assistance. i really appreciate it.
unfortunately, that's still not working. but i want to ask you, how'd you come up with the "content" part of _global.windowMgr.content.MYTARGET?
here's the code i'm using to provide a dataProvider for my datagrid:
_global.windowMgr.content.myDataGrid.dataProvider = result;
i can see the record being returned in my netconnection debugger, but i just can't pass it up to my datagrid.
hi
_global.windowMgr = PopUpManager.createPopUp( _root, Window, true,{ closeButton: true, title: title, contentPath: contents } );
//and next line :
_global.windowMgr.content.myDataGrid.dataProvider = result;
//will NOT work because the data is not loaded yet
//don't ask how to catch the onLoad form it or somthing like but you will need it !!
}
and how i come up whit it ?
me best frend is
for (var a in _global.windowMgr){trace(_global.windowMgr[a])}
but as i said and one more whit this is the same as whit any other load it takes it time for the data to by ready !!!!!!!!!!!!!!!!
so give a message if you find out how to catch the event of the loadfinished
fu-meng
02-01-2005, 04:55 PM
very cool. i should be using for-in loops a lot more.
ok. i have changed things a little bit -- i'm not populating the datagrid with the result from my app server anymore. now i'm using an array -- and i'm still having problems targeting the datagrid.
i still create the window the same:
function showWindow( title, contents, width, height, x, y )
{
// create the Pop Up
_global.windowMgr = PopUpManager.createPopUp( _root, Window, true,
{ closeButton: true, title: title, contentPath: contents } );
// Place onStage
windowMgr.setSize( width, height );
windowMgr.move( x, y );
gotoAndPlay( "main" );
}
// *********************************** launch popup ******
showWindow( "myMovieTitle", "contents_mc", 400, 250, 200, 200 );
and on "main" i have this code:
var myArray:Array = new Array( {column1:"Screenshot1", column2:"movie1"},
{column1:"Screenshot2", column2:"movie2"},
{column1:"Screenshot3", column2:"movie3"});
if( companyID == 1 )
{
_global.windowMgr.content.myDataGrid.dataProvider = myArray;
}
and "companyID" is a value that is returned from another query i do on the first frame. i can trace it out and it returns the right value, but i still can't fill that datagrid....
it's very frustrating but i'm hoping i'm getting it. thanks for your help.
fumeng.
ash_ljs
02-01-2005, 08:45 PM
The window dispatches an event once it has completed initializing it's contents.
Try adding an event listener for "complete", then do your stuff there.
Or you can also do your stuff on the next frame by using doLater (inherited from mx.core.UIObject)
fu-meng
02-02-2005, 05:47 PM
good idea, i should use the listener. however, i also instantiated an instance of the datagrid about 10 frames before i set the dataProvider and it still didnt' work.
for the time being, i moved the dataProvider code to the movie clip i load in the popup window. this way i'm not having to reference the clip's contents from the _root timeline....which obviously i'm having a very hard time doing.
thanks for your help.
fumeng.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.