Henry,
   As far as I'm aware, duplication of existing instances of objects
is still something sadly lacking in Flash. There are a number of
hacks,  but none of them seem to work for all cases (I've tried a
bunch!).

  In your case, I have two suggestions; both are a change of approach:

i) Use the loaded SWF simply as a container for a symbol definition
(in the loaded SWF's library) and create lots of new instances of that
symbol - that is perfectly normal and works fine.

or

ii) Actually load multiple instances of the SWF. This isn't anything
like as heavyweight/slow as you might expect (and was the way to do it
in AS2) as the SWF will be in the browser's cache.

HTH,
   Ian

On Fri, Apr 3, 2009 at 12:49 PM, Henry Cooke
<[email protected]> wrote:
> hej folks,
> I'm writing an assetloader class, with the intention of attaching a whole
> bunch of instances to the stage of a loaded asset. Because I want to attach
> more than one instance of the loaded SWF, I'm having to duplicate the asset
> instead of just using addChild, because you can only addChild one instance
> of an object to the stage at a time.
>
> So, I've written the following function in a class which extends Loader:
>
> public function get asset():DisplayObject{
>
> var cn:String = getQualifiedClassName( contentLoaderInfo.content );
>
> var c:Class = Class( contentLoaderInfo.applicationDomain.getDefinition( cn )
> );
>
> return( DisplayObject( new c() ) );
>
> //return( contentLoaderInfo.content );
>
> }
>
> However, when I try to use the duplicated asset, I can't control its
> timeline, and any sound on that timeline is heard whether it's attached to
> the stage or not. Basically, I suspect that duplicating the asset is
> mangling its timeline somehow. Uncommenting the commented return and
> commenting everything else out gives me a movieclip that behaves how I
> expect, but of course can only be attached to the stage once.
>
> Has anyone tried stuff like this before (duplicating a loaded SWF with
> timeline intact)?
>
> h.
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to