Juan,
Thanks for your comments and for sharing with us your approach.

I am doing almost the same thing, the only difference is that the user
should be able to access the methods with just one call without having to
instantiate or call any classes.

BaseClass.methodCall();

That's it, nothing else. The reasons behind it are

* We have all the flexibility, the user doesn't care when we make changes to
the API neither has to download new classes or update the methods they are
using.
* The SWC has to be as lean as possible, only listing the static methods to
be used and that is it. I am looking at about 500 bytes for the class plus
SWC = 4k
* The user doesnt have to remember to import classes or classes names, just
one quick SWC install and be done
* The calls can be done from anywhere without having scope issues

I am doing some "unit tests" and so far the dispatch event method seems to
provide all the items we need in order for it to work.

Thanks again for your comments, they have helped me out to see we are in the
right track

On Tue, May 27, 2008 at 2:19 PM, Juan Pablo Califano <
[EMAIL PROTECTED]> wrote:

> Once I did something similar, except we were not using SWC's but SWF's, and
> it was a Flash project (not flex).
>
> We gave a third party agency the url to an swf that they would load at
> runtime. That swf contained some library of classes, but there was just one
> base class that they had to use directly (the rest were for internal use of
> the library). They would create an instance of the class using the
> getDefinition() method.
>
> On their side, that class instance was typed as an interface to our main
> class. So, in the end, we handed them an interface that covered all the
> public methods in the main class (so they could compile in strict mode
> without errors), and an extra class where we put all the public event
> constants. It worked out fine.
>
>
> Cheers
> Juan Pablo Califano
>
>
> 2008/5/27, Helmut Granda <[EMAIL PROTECTED]>:
> >
> > I am creating a SWC file that will be given to the client with the basic
> > API
> > that they can use to reference to the main application.
> >
> > It all makes sense in my mind and in writing (create the methods that
> > delegate to the main application).
> >
> > I have a basic format working but in order for it to work I have to
> include
> > the classes that will handle all the process and that is what I am trying
> > to
> > avoid since we want full control of the base methods used within the
> > application.
> >
> > For example:
> >
> > API:
> > sumTwoNumbers(numA, numB) {
> > baseApp.sumTwoNumbers(numA,numB)
> > }
> >
> > but in order for this to work i need to import baseApp class or else i
> will
> > get compile errors. My second option would be to dispatch events when
> > necessary:
> >
> > sumTwoNumbers(numA, numB){
> > dispatchEvent(new CustomEvent ( CustomEvent.sumTwoNumbers, numA, numB))
> > }
> >
> > But i am not sure if this is the appropriate approach. Could some one
> that
> > has dealt with similar situations share some wisdom here?
> >
> > TIA....
> > _______________________________________________
> > Flashcoders mailing list
> > [email protected]
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
...helmut
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to