See how to access custom symbols in SWF library from Adobe Flash Builder.
Use TinkSpark library which has APIs for easily accessing the symbols from a SWF from within Flex apps.
Create a fla file and design a symbol, name it say MySymbol and save the file as library.fla.
Check "Export for ActionScript" and place the base class as flash.display.Sprite / flash.display.MovieClip
Compile and keep the swf in appropriate directory.
Download the TinkSpark source from http://code.google.com/p/tink/source/checkout and add the package to your flex project:
Then write the following code:
import ws.tink.core.Library;
import ws.tink.events.LibraryEvent;
import ws.tink.managers.LibraryManager;
private function loadLibrary():void
{
var library:Library = LibraryManager.libraryManager.createLibrary( "assetsLibrary" );
library.addEventListener( LibraryEvent.LOAD_COMPLETE, onAssetsLibraryLoadCompleteHandler, false, 0, true );
library.loadSWF("library.swf" ); //provide the path of library.swf, pls note library.swf is alos exported as AS3.0
}
private function onAssetsLibraryLoadCompleteHandler( event:LibraryEvent ):void
{
EventDispatcher( event.currentTarget ).removeEventListener( event.type, arguments.callee );
var library:Library = LibraryManager.libraryManager.getLibrary( "assetsLibrary" );
var AssetSymbol:Class = library.getDefinition( "MySymbol" );
addChild( new AssetSymbol() as Sprite );
}
And you are done :)
Warm Regards
Deepanjan Das
http://deepanjandas.wordpress.com/
+