Skip to main content
May 6, 2010
Question

Accessing Library Items in Loaded SWF from a SubClass?

  • May 6, 2010
  • 1 reply
  • 1110 views

Hi everybody,

I've learned how to access library items in the main SWF directly from a SubClass by doing this:

package
{

import SubClass;

public class Main extends MovieClip
{
public var mySubClass:SubClass = new SubClass;
this.addChild(mySubClass);

}//class

}//package


package
{

import Box;

public class SubClass extends MovieClip

{

public function SubClass():void
{
var train:Box = new Box;
this.addChild(box);
}//SubClass constructor function

}//class

}//package

But how do I access library items of a loaded SWF in the same fashion? Importing is different from loading and I'm not sure how or where to piece instances together at runtime.

Any help with this is much appreciated. Thanks!

This topic has been closed for replies.

1 reply

May 7, 2010

So...I guess what I'm trying to do makes no sense?

riquigley
Inspiring
May 7, 2010

I'm not sure you can do what you're trying to do.  I think (and someone can correct me if I'm wrong) that once the FLA has been compiled into an SWF, there is no library from which to pull MovieClips from.

But, as always, I might be wrong.

May 7, 2010

If that is true, then that would save me a lot of headache. That would make sense since that is the big difference between the two is compile time vs. runtime acquisition of assets.

I'll just put the stuff on the stage for now and ask questions later.

Thanks again riquigley!