# Flash Library Items as .swc files for Flex - with custom functionality

**URL:** https://forum.kirupa.com/t/flash-library-items-as-swc-files-for-flex-with-custom-functionality/287813
**Category:** flash
**Created:** [May 6, 2009, 4:25pm UTC](https://forum.kirupa.com/t/flash-library-items-as-swc-files-for-flex-with-custom-functionality/287813 "2009-05-06T16:25:37Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![stephank](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@stephank](https://forum.kirupa.com/u/stephank)
#### Post date: [May 6, 2009, 4:25pm UTC](https://forum.kirupa.com/t/flash-library-items-as-swc-files-for-flex-with-custom-functionality/287813/1 "2009-05-06T16:25:37Z")

</div>

Hi Forum

I would like to use multiple library items, created in the Flash IDE, with the same baseclass in Flex Builder3. In my case it would be a timeline containing 4 strips. Each strip has the same movieClip instances, but with slight variations created by the designer.

My Process:

1. create multiple strip movieClips in flash each with a uniquely designed background, header and title and call their instances: bodyBg, headerBg, headerTxt.

2. in the properties window for each Strip use the Class names: Strip0, Strip1, Strip2… and for all of the use the same baseclass: Strip.as

3. create the Strip.as class (see below)

4. export the flash file under Publish Settings \> flash \> export .swc file

5. link the Flex Builder actionscript project to the .swc file

6. start using the Strip0 class: strip0 = new Strip0();

The Problem:

- Flex does not recognize the manually created movieClips inside Strip0, Strip1, Strip2, Strip3.
- Flex does not throw an error, it just silently ignores the line where I try to set the bodyBg.alpha to 0
- No compile, and no runtime error… ?

Interesting observation:

- Flex does recognize the bodyBg, headerBg, and headerTxt movieClips if I simply use flash.display.MovieClip as the baseclass…

Any ideas what is wrong with my thought process? it’s driving me a little mad… any leads or thoughts would be much appreciated.

Thank you!

-sk

* * *

Library Items

- Strip0  
Class: Strip0  
Base Class: Strip.as  
Contains MovieClips with instance names: headerBg, bodyBg, headertxt

- Strip1 (same as Strip0)

[…]

* * *

## MainClass.as

tlStrip0 = new Strip0();  
tlStrip1 = new Strip1();  
tlStrip2 = new Strip2();  
tlStrip3 = new Strip3();

tlStrip0.setup(0,tlStrip0.bodyBg); //\>\> bodyBg movieClip is not being recognized by Flex?  
tlStrip0.setup(1,tlStrip1.bodyBg);  
tlStrip0.setup(2,tlStrip2.bodyBg);  
tlStrip0.setup(3,tlStrip3.bodyBg);

strips = new Sprite();  
strips.addChild(tlStrip0);  
strips.addChild(tlStrip1);  
strips.addChild(tlStrip2);  
strips.addChild(tlStrip3);

InstanceManager.STAGE.addChild(strips);

* * *

## Strip.as class

//id  
private var id:int = 0;

//layout  
private var bodyBgMC:Sprite;

public function TimelineStrip():void  
{  
}

public function setup(\_id:int,\_bodyBg:Sprite):void  
{  
this.id = \_id;  
this.bodyBgMC = \_bodyBg;  
this.bodyBgMC.alpha = 0; // \>\> this won’t work???  
}  
}

* * *
