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:
-
create multiple strip movieClips in flash each with a uniquely designed background, header and title and call their instances: bodyBg, headerBg, headerTxt.
-
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
-
create the Strip.as class (see below)
-
export the flash file under Publish Settings > flash > export .swc file
-
link the Flex Builder actionscript project to the .swc file
-
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???
}
}