0

Is there any way possible to say, have A.swf use only certain items from B.swf, without having to load the entire swf as a child first? What i'm trying to do is have A as lite as possible and pull some items from time to time from B without having to cache the entire file in flash memory somehow. I've looked at other similar questions but none seem to really answer or fit this exact problem.

Before anyone asks, yes I do know how to use loader, loadercontext, and create instances of classes from the library. This is more of a methodology question rather than a "how to" question.

Only idea I can come up with, is to export all of the children as individual swf objects and then have A request B to compose itself of the seperated items that get requested by A. Would this be efficient?

dns
  • 79
  • 10

2 Answers2

0

A swf is a compiled package, and is not meant to be split into parts. One solution would be to pull all of the common elements out of A and B into a swc (a compiled Flash library, not meant to be run). You can then include the swc in the compilation of A and B.

Unless you will be creating lots of files with only a few common elements, I don't see why you would need to export each of the children as individual swf files.

  • Ok i'll go a little more into detail on what i'm trying to do.. I've created a chat client and the final component of it is going to be the smilies. I intend on the smilies being in a seperate file as to not have the chat client have to load them within itself so as to keep the filesize of the client itself lower. The smilies are going to be animated and there are going to be tons of them in the long run, so I want to go ahead and structure this properly from the get-go. The smilies will also be layered, meaning multiple can be used as once on top of each other to combine diff combinations. – dns Oct 24 '12 at 22:36
0

I don't think you can do what you want to do, however since the assets are strictly graphical in nature, it doesn't seem inefficient to just export them as individual assets and load them when you need them. ( In fact it seems very efficient to me... )

I haven't tried it, but to save time you could probably automate the export process with jsfl. ( Jsfl lets you script the Flash IDE itself, to automate tasks that you would otherwise have to do manually. ) Take a look at this Stack Overflow answer here:

Generating individual SWF's with classes from a fla with a large library

That example shows how to batch export swfs out of the library.

Note than in Flash CS6 you can export a MovieClip from the library by right clicking and selecting export, but unfortunately it doesn't let you export a group all at once.

Community
  • 1
  • 1
null
  • 1,187
  • 1
  • 8
  • 20
  • Yeah I have CS5 and it has the export as swf feature as well. Didn't know about the batch export tool, though. Ok so I guess what i'll do is export them individually after creating them (with appropriate class names/linkages), and then call the ones requested using a string query split into an array by a delimiter, and finally load them each using getClassByName instantiation. Then I can create a single child containing all the seperate smilie instances and return it to the caller. Thanks everyone for the help! Both answers to me seem correct here, lol. – dns Oct 24 '12 at 23:01
  • Oops I meant getDefinitionByName earlier, not getClassByName. – dns Oct 24 '12 at 23:45