0

I have an external SWF file that I need to load at runtime. However, contained inside the SWF is a single MovieClip - in fact, it is a custom class that extends MovieClip. This custom class has its own instance variables and methods. So, there is an AS class that this MovieClip is linked to.

However, when I load the SWF file in the normal way (i.e. with Loader and URLRequest), I cannot access the methods and variables of my custom class. Flash just thinks that it is of type MovieClip, and I have no access to the properties of my custom class.

All that remains is the graphics inside the movie clip.

Does anyone know what's going on here?

0

1 Answer 1

1

try casting it:

loadedMC.getChildAt(0) as YourCustomClass

You can even set up an interface, say IYourCustomClass, which can be implemented by YourCustomClass and import the interface in you main movie, to save some bytes. Then you code would be:

loadedMC.getChildAt(0) as IYourCustomClass -- this provides access to all the methods and getters/setters.

Sign up to request clarification or add additional context in comments.

1 Comment

Oh right, silly me. I didn't do getChildAt(0) to obtain the actual MC I was after. Oh and I already had an abstract class set up that is extended by MyCustomClass :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.