View Full Version : [Embed] in the flash ide
cjke.7777
March 16th, 2010, 08:39 PM
Flex users obviously have access to the [Embed] metatag to add library assets from a SWF.
In the Flash IDE, what options are available?
I know you can use the loader method, where you load the SWF then extract the library assets from the SWF at runtime.
But is the way to do this at compile time?
If this doesn't make sense, think of it this way.
Say you have a cool little animation, created in flash. You also have a class, called say Move. You want the Move class to add the animation every time the class is created, but unless you add the animation to the Flash file that calls the Class, you can't access the animation.
This probably still isn't making sense. Another way to look at it, is, can a Class carry resources with it?
Thanks
Krilnon
March 16th, 2010, 10:07 PM
It might have been a good idea to have posted this thread in one of the IDE subforums, since then at least we'd know which version you were using.
You can use the [Embed] metadata tag in Flash CS4: http://www.adobe.com/devnet/flash/articles/embed_metadata.html
Additionally, you can use one of the 'traditional' approaches. So, yes, classes can have associated resources. Here is perhaps the most common way to do that in Flash authoring with AS3: http://www.kirupa.com/developer/flashcs3/movieclips_classes_AS3_pg1.htm
cjke.7777
March 16th, 2010, 10:52 PM
In regards to the offtopic, I had considered that but I didn't think it would vary from IDE to IDE, and that my question was more specific to the languages ability to embed. But anyway.
Interesting about the CS4, but our business isn't quite there yet, still on CS3.
The last link is good but is sort of the other way round. The library asset is initiating the class, which is fine, when you only need one library asset, but I am (which i guess in hind site, didn't actually fully explain) looking for a class to draw on several library assets.
Krilnon
March 17th, 2010, 12:20 AM
Maybe I am misunderstanding, but couldn't you just reference the linked classes inside your class that needs to use several library assets? For example:
class A {
private var _b:B = new B(); // where B is associated with some library symbol
private var _c:C = new C(); // '' C '' '' ''
}
cjke.7777
March 17th, 2010, 12:26 AM
I appreciate the feedback but say for example I create a window class. The window class consists of a graphic for the Close button, a graphic for the max button, for the min button, for the toolbar, for the status bar, for the icon, for the content area, for the scrollbar, etc.
Each of these assets don't need to have a class or code associated with them, but the Window class needs to be able to access them.
So, regardless of the flash file, I would like to be able to go:
var _window:Window = new Window();
this.addChild(_window);
var _window2:Window = new Window();
this.addChild(_window2);
And then repeat this in another flash movie, then another. But all the various assets need to be included in every flash file, which seems redundant. I'm looking for a way to "import" assets similar to the way you can import classes.
Krilnon
March 17th, 2010, 01:31 AM
You can export one or more assets into a SWC and add that SWC as a library to use in various projects. However, the ActionScript interface (not interface) that you use to access those assets is still the class. The classes don't need to have any "actual" code in them, they're generated by the IDE. (Publish Settings > Script Settings > Library Path)
Why classes? Because it's what the SWF file format uses (via the SymbolClass tag) to link symbols to a concept that exists in ActionScript 3.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.