That's super cool. So the sub only has to have a _single_ library item from the shared library in order to have access to the whole library. That's not very intuitive, but I'm really glad it works!


Hans Wichman wrote:
Hi Andrew,

i've put a sample together at:
http://www.objectpainters.com/downloads/runtimesharinghack.zip

user/pass is blog/blog

There are 2 demos, the first of how you probably do it at the moment, you
load a sub into main and try to attach a clip from main to sub. The sample
shows that doesnt work by default.

The second sample added a couple of things:
-main exports a hack_clip at main.swf for runtime sharing.
-sub imports a hack_clip from main.swf for runtime sharing AND puts it on
the stage.

If you run the 2nd example you see there is no problem attaching a clip from
main to sub, even though the attached clip had nothing to do with runtime
sharing, only the hack_clip did.

In practice you need to account for a couple things:
- runtime library sharing is not without it's own problems, but since you
can be sure main.swf is already in the cache by the time sub.swf requires
it, you're on the safe side
- i've never ever used this hack in a real project, so there is some risk
involved in using it (but ain't it spiffy ;)).

regards,
JC




On Tue, Sep 22, 2009 at 7:43 PM, Hans Wichman <
j.c.wich...@objectpainters.com> wrote:

Hi,

calling a function in the root that would instantiate the symbol is not
going to work, neither is using reflection to get classes by name. The issue
you are dealing with is that by default flash will only let you attach
clips to a clip from the library from whence it came.
I'll try to whip up a sample up of the runtime share hack.

greetz
JC

  On Tue, Sep 22, 2009 at 2:08 PM, jonathan howe <jonathangh...@gmail.com>wrote:

Totally forget in AS2, but maybe research getDefinitionByName() - it can
retrieve a class based on a classname string -  and maybe there are some
comments about AS2 vs. AS3

-jonathan



On Tue, Sep 22, 2009 at 2:54 AM, Hans Wichman <
j.c.wich...@objectpainters.com> wrote:

Hi,

I don't remember the exact details, but if I remember correctly there
are 2
ways:
1.
let the child attach the clip at the root, copy its bitmap data and use
that
to create a clip in its own root, but this will result in static bitmaps
only

2.
-declare an empty clip with linkage id in the root and export it for
runtime
sharing
-in the child import the clip from the parent for runtime sharing
It was one of those hacks, but it's been a long time, so I'm not sure I
got
the steps all right, I might have those files somewhere.

Hope that helps!
Hans
On Tue, Sep 22, 2009 at 5:50 AM, Andrew Sinning <
and...@learningware.com
wrote:
How would one instantiate a symbol instance linked to the parent
movie's
library?

E.g., there's an asset in top most movie's library called "Asset".
 The
presentation engine is a separate swf that gets loaded into the top
most
movie.  From within this movie, using AS2, I need to create an
instance
of
Asset.

The child swf uses _lockRoot.

Thanks!
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


--
-jonathan howe
 _______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to