[Pixlib] Converting MovieClip in MovieClipHelper

Tim Will thedigitalartist at gmail.com
Sat Jan 27 17:44:48 EST 2007


Sounds a bit like Decorator pattern!  I use __resolve when I employ that one
so I can make use of multiple wrappers.
For sure I'm going to check out Neo - thanks!
I need five lifetimes to do everything....he heh

-tim.


On 1/27/07, eka <ekameleon at gmail.com> wrote:
>
> Hello :)
>
> The MovieClipHelper use composition but you can use in your
> MovieClipHelper a component or a class who inherit MovieClipHelper :)
>
> PS : if you want use components based on Pixlib you can use my OpenSource
> library based on Pixlib : Neo
> http://neo.riaforge.org/index.cfm
>
> I use this library when i work with Francis ;)
>
> For example you can use my neo.util.factory.DisplayFactory class to create
> a dynamic movieclip in your MovieClipHelper with your custom class who
> inherit MovieClip.
>
> http://svn.riaforge.org/neo/neo/trunk/src/neo/util/factory/
>
> PS : if you want control the internal Movieclip in the MovieClipHelper
> with the MovieClipHelper you can add a __resolve method in you
> MovieClipHelper class
>
>     /**
>      * Resolve the specified property name.
>      */
>     public function __resolve( name:String )
>     {
>         if ( _proxy == null ) return ;
>         if( !_proxy.hasOwnProperty( name ) ) {
>             if( _proxy.__proto__[name] == undefined ) return ;
>         }
>         if( typeof(_proxy[name]) == "function" ) {
>             var p = _proxy ;
>             return function() {
>                 return p[name].apply( p, arguments );
>             };
>         } else {
>             return _proxy[name];
>         }
>     }
>
> with proxy is the reference of your internal MovieClip (replace this value
> with the getView() method)
>
> exemple :
>
> var display:MyDisplayUI = MyDisplayUI ( MovieClipHelper.*
> getMovieClipHelper*( UIList.MY_DISPLAY ) ) ;
>
> display.play() ; // launch the play() method of the internal MovieClip of
> this MovieClipHelper :) the __resolve delegate the method
>
> EKA+ :)
>
>
>
> 2007/1/27, Stef X <stefx.lists at gmail.com>:
> >
> > Eka, yes i red this but my problem isn't there ;)
> >
> > I  don't want to attach any classes to my assets but only want to use
> > the power of MovieClipHelper such as move() , setSize(), resolveUI().
> > I acknowledge that i'm a bit lazy so it will be very much easier to
> > write
> >
> > resolveUI(data.forecast).hide()
> >
> > than
> >
> > GraphicLibLocator.getInstance().getGraphicLib( data.forecast ).hide()
> >
> > or
> >
> > resolveUI( data.tendency ).move( 100, 100 );
> >
> > than
> >
> > var mc : MovieClip = GraphicLibLocator.getInstance().getGraphicLib(
> > data.tendency ).getView();
> > mc._x = 100;
> > mc._y = 100;
> >
> > Thanks a lot Eka, Tim for your help...
> >
> > What do you think Francis about to put the constructor or
> > MovieClipHelper public to have a simple way to extend our MovieClips ?
> >
> > St3fX
> >
> > 2007/1/27, Tim Will <thedigitalartist at gmail.com>:
> > >
> > > It's not a silly question Stef!  It's a good question, because this is
> > > a fundamental change for people who are used to developing in Flash.  This
> > > is the essential difference with Inheritance and Composition.
> > > Traditionally, Flash is set up for Inheritance, but Composition is more
> > > flexible.
> > > So...a MovieClipHelper is a wrapper for a movieclip - it is composed
> > > of a movieclip, plus extra functionality.  You don't convert your MovieClips
> > > to MovieClipHelpers, you compose a MovieClipHelper with a MovieClip.
> > > Here is the order you must use:
> > > 1. Instantiate GraphicLib (you can use LibStack if you have a lot of
> > > Graphics to load).  You should pass in a name that you get from your
> > > UIList...because later on you will need that name.
> > > 2. Call the Load() method of GraphicLib to get your swf to load in.
> > > When it does, it will become the content of the GraphicLib.  The whole point
> > > of the GraphicLib is basically just to get the thing into memory, and
> > > monitor the progress as it loads.
> > > 3. Once fully loaded, you can instantiate your UI, which should be an
> > > extension of MovieClipHelper.  When you do, you pass in the same name you
> > > used to make the GraphicLib (e.g. UIList.somename).  Using that name,
> > > a Locator finds the GraphicLib, gets it's contents (your movieclip) and
> > > registers it to the UI as 'view'.  Now the UI can affect the movieclip by
> > > addressing it as 'view'.
> > >
> > > Does this make a bit of sense?  Once you get the hang of it, it is not
> > > hard, just takes some practise.
> > >
> > > -tim.
> > >
> > >
> > >  On 1/27/07, Stef X < stefx.lists at gmail.com> wrote:
> > >
> > > > Hello there,
> > > >
> > > > Now i solved my first problem i face a second.
> > > > In my main UI i load differents assets using a LibStack.
> > > > The question i asking me is why the loaded assets are MovieClips
> > > > instead of MovieClipHelpers that are a bit more powerfull and will the
> > > > MovieClipHelper's constructor is private, how to convert my MovieClips in
> > > > MovieClipHelpers ?
> > > > Sorry for these silly questions but i would like to become a real
> > > > pixLiber too ;)
> > > >
> > > > Cheers
> > > >
> > > > St3fX
> > > >
> > > > _______________________________________________
> > > > Pixlib mailing list
> > > > Pixlib at osflash.org
> > > > http://osflash.org/mailman/listinfo/pixlib_osflash.org
> > > >
> > > >
> > > >
> > >
> > > _______________________________________________
> > > Pixlib mailing list
> > > Pixlib at osflash.org
> > > http://osflash.org/mailman/listinfo/pixlib_osflash.org
> > >
> > >
> > >
> >
> > _______________________________________________
> > Pixlib mailing list
> > Pixlib at osflash.org
> > http://osflash.org/mailman/listinfo/pixlib_osflash.org
> >
> >
> >
>
> _______________________________________________
> Pixlib mailing list
> Pixlib at osflash.org
> http://osflash.org/mailman/listinfo/pixlib_osflash.org
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/pixlib_osflash.org/attachments/20070127/d52afb66/attachment-0001.htm


More information about the Pixlib mailing list