If a single DisplayObject instance is added to LzResourceLibrary, it won't be possible to display that resource for more than one view, because a DisplayObject can only have exactly one parent. And we also need to consider how to make dynamic resources work in DHTML - adding a DisplayObject won't work here. Maybe providing a user hook is sufficient, so a simple function to resolve resource names which is called before (or after) the LzResourceLibrary entry is looked up.

- André


On 3/4/2010 12:51 AM, Henry Minsky wrote:
Thanks Andre!

I was just trying to create an example for Antun for creating a custom
class like this.

If we want to make it easier for people to dynamically at resources at
runtime,
maybe we should extend the mechanism in LzResourceLibrary to  support
instances of DisplayObject, rather than requiring a class. Then we could
add an API
for defining a resource at runtime.





On Wed, Mar 3, 2010 at 6:42 PM, André Bargull <[email protected]
<mailto:[email protected]>> wrote:

    By installing a custom class as a 'fake resource', I could
    successfully use a drawview based cursor in swf10. I've attached an
    example application.
    I think the application is pretty self explanatory except for line
    where I add the entry for the 'fake resource':

        LzResourceLibrary['mycursor'] = {assetclass: CursorSprite};


    LzResourceLibrary is an internal map which holds all resources by
    name. Each entry in that map is an object referring to a class for
    the resource, in our case we want to point to the custom class
    CursorSprite. After changing the global cursor to 'mycursor' by
    calling lz.Cursor.setCursorGlobal('mycursor'), a new instance of
    CursorSprite is created and used for the cursor.


    - André



        Hi all,

        I need to be able to paramaterize some components of a cursor. I
        can set
        the cursor by first declaring a named resource this:

        <resource name="waitcursor" src="lzwaitcursor_rsc.swf"/>

        ... then setting the cursor globally by calling:

        lz.Cursor.setCursorGlobal('waitcursor');

        Rather than using an image for the cursor, I'm thinking of
        drawing it
        with the drawview, then using SWF9 APIs to extract the BitmapData
        object. I can do this already in OL and set the BitmapData
        object to a
        view, to display it. But in this case, I'd need to somehow set
        the data
        for a named resource.

        Any ideas on how to go about this?

        Thanks,

        Antun





--
Henry Minsky
Software Architect
[email protected] <mailto:[email protected]>


Reply via email to