Well that definatly clears up a few things that were confusing me.

Basicaly what I am doing is that we have several intrAnet 
applications that we are trying to create a central reporting system 
for.

In all cases the reports will be based on a person or list of 
people.  We have a tabed interface where the first tab lets the 
manager build the list of people.  They can do this either by 
searching for and selecting individual people which builds a list of 
people's unique campus wide ID, or using departments and department 
codes, or eventually companies and company codes.

When you click on the next tab it takes whichever type of list the 
manager built and generates a list of whatever in a dataGrid.  You 
can then double click on a row and it uses a accordian to show a 
viewstack with all the details for that record.

However instead of coding the visual part all in one mxml file I have 
a main mxml file with the search, then each additional tab I have in 
a seperate mxml file as a component.  So in the tabNavigator I simply 
add lines like <local:otdTab id="otdTabHandle"/>

When I am inside one of the components I want to access the same 
doubleclick function I use in the main mxml.  However since the as 
file the doubleclick code is in is included in the main mxml the 
component can't see the function.  I have to add the 
mx.core.Application.application.____ in order for the component to 
see it.

So what I would rather do is just be able to add a include or 
something in the component making the functions already loaded in the 
main file available to the component file.
--- In flexcoders@yahoogroups.com, "Roger Gonzalez" <[EMAIL PROTECTED]> 
wrote:
>
> This seems like you're talking about a couple different things here.
> I'm not sure I understand where mx.core.Application.application 
comes
> into it.
> 
> You can do the same thing with source as you can with a SWC;
> 
> Make a new directory tree, looks like you're using mrstd.
> 
> Then, you'll make one source file per class (that you are currently
> putting in one file).  Name the source file the same as the 
classname.
> 
> BTW - several of your utility functions should probably really be 
static
> - there's no reason to create a class instance just to call a 
function
> when there are no vars on the object!
> 
> Add the directory one level above the mrstd directory to your
> actionscript-classpath (either via the flex-config file or by 
setting it
> in FlexBuilder; Project > ActionScript Build Path > Class path.
> 
> When you want to use these classes from some other file, just do
> import mrstd.*;
> 
> Use the classes as you would expect.
> 
> This should get you most of the way there.
> 
> Ok, so what if you want to hand your mrstd classes off to someone 
else?
> Or maybe you don't want to keep compiling them?  That's when you 
need a
> SWC.  Unfortunately, the alpha build of FlexBuilder doesn't have 
any SWC
> support built-in, so you need to drop down to the command line.
> 
> Run compc.exe -i source source source -o mrstd.swc
> 
> Go back into FlexBuilder, and remove the mrstd directory from the
> classpath, and add the mrstd.swc file to the library path tab.
> 
> Is this what you need?
> 
> -Roger
> 
> Roger Gonzalez
> mailto:[EMAIL PROTECTED]
>  
> 
> > -----Original Message-----
> > From: flexcoders@yahoogroups.com 
> > [mailto:[EMAIL PROTECTED] On Behalf Of Greg Johnson
> > Sent: Tuesday, November 01, 2005 11:45 AM
> > To: flexcoders@yahoogroups.com
> > Subject: [flexcoders] Re: Flex 2:Package/Class problem
> > 
> > This is a part I didn't even get a chance to get into with 1.5 so 
im 
> > coming kinda late in 2.
> > 
> > In my post you saw the functions that I want to make so I can use 
> > them all over without having to 
> > use "mx.core.Application.application." every time I use one.
> > 
> > Most of them I use in .as files not .mxml files.  And the ones I 
use 
> > in the .mxml files I usually use as function calls.  Like for a 
grid 
> > column that contains a date, I use the dateFunction parameter and 
> > give the function name.
> > 
> > I have looked at the interface and class builder "wizards".  But 
> > didn't really get anywhere with them.  I definatly need to 
optimize 
> > as much as I can as the applications I will be working on are 
going 
> > to be extensive in some cases.
> > 
> > Can you point me somewhere that shows how to build a "library" 
that I 
> > can use in any code I have by just putting in the import 
> > mylib.whatever.*?
> > 
> > Thanks
> > Greg
> > 
> > --- In flexcoders@yahoogroups.com, "Roger Gonzalez" 
<[EMAIL PROTECTED]> 
> > wrote:
> > >
> > > How so?  A library isn't one file.
> > > 
> > > You should package everything up by making a manifest file so 
that 
> > you
> > > can use your classes as MXML tags, and then use compc.exe to 
bundle 
> > a
> > > SWC.  You can also bundle in additional stuff like icons and 
CSS and
> > > whatnot.
> > > 
> > > Its a much more efficient distribution and packaging mechanism!
> > > 
> > > -Roger
> > > 
> > > Roger Gonzalez
> > > mailto:[EMAIL PROTECTED]
> > >  
> > > 
> > > > -----Original Message-----
> > > > From: flexcoders@yahoogroups.com 
> > > > [mailto:[EMAIL PROTECTED] On Behalf Of Greg Johnson
> > > > Sent: Tuesday, November 01, 2005 8:05 AM
> > > > To: flexcoders@yahoogroups.com
> > > > Subject: [flexcoders] Re: Flex 2:Package/Class problem
> > > > 
> > > > Hmm, well that pokes a hole in that plan.  If I have to 
create a 
> > > > bunch of different files it kinda is contrary to my goal of 
> > combining 
> > > > things into one main generic library :(
> > > > 
> > > > --- In flexcoders@yahoogroups.com, "Geoffrey Williams" 
> > <[EMAIL PROTECTED]> 
> > > > wrote:
> > > > >
> > > > > You can only have one public function / class / prop 
per .as 
> > file. 
> > > > Also, the
> > > > > .as files name must match that of the function / class / 
prop.
> > > > > 
> > > > > -----Original Message-----
> > > > > From: flexcoders@yahoogroups.com 
> > > > [mailto:[EMAIL PROTECTED] On
> > > > > Behalf Of Greg Johnson
> > > > > Sent: Tuesday, November 01, 2005 9:43 AM
> > > > > To: flexcoders@yahoogroups.com
> > > > > Subject: [flexcoders] Flex 2:Package/Class problem
> > > > > 
> > > > > I am tryinig to create a class with functions that I use 
> > repeatedly 
> > > > > so I can just include them in different 
> > components/applications.  
> > > > As 
> > > > > far as I can tell I have written it correctly, but when I 
use 
> > an 
> > > > > include, and they try calling one of the functions, it 
doesn't 
> > work.
> > > > > 
> > > > > Here is the package
> > > > > package mrstd{
> > > > >       // Imported Libraries
> > > > >       import mx.managers.PopUpManager;
> > > > >       import mx.containers.TitleWindow;
> > > > >       import mx.controls.gridclasses.DataGridColumn;
> > > > >       import mx.managers.DragManager;
> > > > >       import mx.events.DragEvent;
> > > > >       import mx.formatters.*
> > > > >       import flash.util.Timer;
> > > > > 
> > > > >       // Standard Library Class
> > > > >       public class stdlib {
> > > > >               // Does what it says, used when a 
> > function has to be 
> > > > > called, but you don't actually want to do anything
> > > > >               public function doNothing():Void {}     
        
> > > > > 
> > > > >               // Get Today's Date as a string
> > > > >               public function getToday():String {
> > > > >                       var today_date:Date = new Date();
> > > > >                       var date_str:String = 
> > ((today_date.getMonth()
> > > > > +1)+"/"+today_date.getDate()+"/"+today_date.getFullYear());
> > > > >                       return date_str;
> > > > >               }
> > > > >       }
> > > > >       
> > > > >       // Mouse Related Functions
> > > > >       public class mouseHandlers {
> > > > >               // Handles drag and drop events.
> > > > >               public function 
> > doDragDrop(event:DragEvent):Void {
> > > > >                       private var items:Array = 
> > > > > event.dragSource.dataForFormat("items");
> > > > >                       private var dest:Object = 
> > event.currentTarget;
> > > > >                       private var dropLoc:int = 
> > dest.getDropLocation
> > > > > ();
> > > > >                       dest.hideDropFeedback(event);
> > > > >                       items.reverse();
> > > > >                       var l:int = items.length;
> > > > >                       for(var i:int = 0; i < l; i++) {
> > > > >                               
> > dest.dataProvider.addItemAt(items[i], 
> > > > > dropLoc);
> > > > >                       }
> > > > >                       event.preventDefault();
> > > > >               }               
> > > > > 
> > > > >               // Variables used for detectDoubleClick 
function
> > > > >               private var lastClick:int = 0;
> > > > >               private var lastObject:Object = new Object();;
> > > > >               private var lastIndex:int = 0;
> > > > >               private var maxTicks:int = 300;
> > > > > 
> > > > >               // Detect if a double click was made 
> > and if so, call 
> > > > > a function
> > > > >               public function detectDoubleClick
(event:Object, 
> > > > > functionToCall:Function, ... args):Void {
> > > > >                       var currentClick:int;
> > > > >                       var currentObject:Object;
> > > > >                       var currentIndex:int;
> > > > >                       var clickDif:int;
> > > > >                       currentClick = getTimer();
> > > > >                       currentObject = event.target;
> > > > >                       currentIndex = event.index;
> > > > >                       clickDif = currentClick - lastClick;
        
> > > > >                       if( clickDif <= maxTicks && 
> > currentObject == 
> > > > > lastObject && currentIndex == lastIndex ) {
> > > > >                               lastClick = currentClick;
> > > > >                               lastObject = currentObject;
> > > > >                               lastIndex = currentIndex;
> > > > >                               if (args[0] == null) {
> > > > >                                       functionToCall();
> > > > >                               } else {
> > > > >                                       functionToCall(args);
> > > > >                               }
> > > > >                       }
> > > > >                       lastClick = currentClick;
> > > > >                       lastObject = currentObject;
> > > > >                       lastIndex = currentIndex;
> > > > >               }
> > > > >       }
> > > > >       
> > > > >       // Standard Formaters
> > > > >       public class formaters {
> > > > >               private var 
> > StdMoneyFormat:CurrencyFormatter = new 
> > > > > CurrencyFormatter();
> > > > >               private var StdDateFormat:DateFormatter = new 
> > > > > DateFormatter();
> > > > >               StdMoneyFormat.precision=2;
> > > > >               // Formats a dataGrid cell as money
> > > > >               public function formatMoney(dpItem:Object, 
> > > > > dgColumn:DataGridColumn):String {
> > > > >                       return StdMoneyFormat.format(dpItem
> > > > > [dgColumn.columnName]);
> > > > >               }
> > > > > 
> > > > >               // Formats a dataGrid cell as a date    
        
> > > > >               public function formatDate(dpItem:Object, 
> > > > > dgColumn:DataGridColumn):String {
> > > > >                       return StdDateFormat.format(dpItem
> > > > > [dgColumn.columnName]);
> > > > >               }
> > > > > 
> > > > >               // Formats a dataGrid cell as a string 
> > that is x 
> > > > > characters long followed by an elipse
> > > > >               public function shortString(dpItem:Object, 
> > > > > dgColumn:DataGridColumn, x:Number):String {
> > > > >                       var tmpString:String;
> > > > >                       tmpString = dpItem
[dgColumn.columnName];
> > > > >                       if (tmpString.length > x) {
> > > > >                               tmpString = 
> > tmpString.substr(0,x);
> > > > >                               tmpString = 
> > tmpString.concat('...');
> > > > >                       }
> > > > >                       return tmpString;
> > > > >               }
> > > > >       }
> > > > > 
> > > > >       // General Error Window Handlers        
> > > > >       public class errHandlers {
> > > > >               // CFC Error Handler Function
> > > > >               public function cfcerr(cfcName:String, 
> > > > > functionName:String, faultCode:String, faultString:String, 
> > > > > description:String, details:String):Void {
> > > > >                       var cfcErrPopUp:cfcError = cfcError
> > > > > (PopUpManager.createPopUp(this, cfcError, true));
> > > > >                       cfcErrPopUp.cfcName.text = cfcName;
> > > > >                       cfcErrPopUp.functionName.text = 
> > functionName;
> > > > >                       cfcErrPopUp.faultCode.text = 
faultCode;
> > > > >                       cfcErrPopUp.faultString.htmlText = 
> > > > > faultString;
> > > > >                       cfcErrPopUp.description.htmlText = 
> > > > > description;
> > > > >                       cfcErrPopUp.detail.htmlText = details;
> > > > >               }
> > > > > 
> > > > >               // Error Handler Function
> > > > >               public function err(message:String, 
> > > > > source:String):Void {
> > > > >                       var errpop:stdErr = stdErr
> > > > > (PopUpManager.createPopUp(this, stdErr, true));
> > > > >                       errpop.source.text = source;
> > > > >                       errpop.message.text = message;
> > > > >               }
> > > > >       }
> > > > > }
> > > > > 
> > > > > In the .as file I put
> > > > > 
> > > > > import mrstd.errHandlers.err;
> > > > > 
> > > > > and then down in the script I make a call to the err 
function
> > > > > 
> > > > > err("sometext","sometitle");
> > > > > 
> > > > > But I get an error at that line saying "Access of undefined 
> > > > property 
> > > > > err"
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > --
> > > > > Flexcoders Mailing List
> > > > > FAQ: 
> > > > 
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > > > > Search Archives: http://www.mail-archive.com/flexcoders%
> > > > 40yahoogroups.com 
> > > > > Yahoo! Groups Links
> > > > >
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > ------------------------ Yahoo! Groups Sponsor 
> > > > --------------------~--> 
> > > > Get Bzzzy! (real tools to help you find a job). Welcome to 
> > > > the Sweet Life.
> > > > http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM
> > > > --------------------------------------------------------------
> > > > ------~-> 
> > > > 
> > > > --
> > > > Flexcoders Mailing List
> > > > FAQ: 
> > http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > > > Search Archives: 
> > > > http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> > > > Yahoo! Groups Links
> > > > 
> > > > 
> > > > 
> > > >  
> > > > 
> > > > 
> > > >
> > >
> > 
> > 
> > 
> > 
> > 
> > 
> > ------------------------ Yahoo! Groups Sponsor 
> > --------------------~--> 
> > Get Bzzzy! (real tools to help you find a job). Welcome to 
> > the Sweet Life.
> > http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM
> > --------------------------------------------------------------
> > ------~-> 
> > 
> > --
> > Flexcoders Mailing List
> > FAQ: 
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives: 
> > http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> > Yahoo! Groups Links
> > 
> > 
> > 
> >  
> > 
> > 
> >
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to