1
votes

I have a an SWF that loads another SWF. In the external swf, I'm trying to instantiate an object of a class that is defined in the first SWF.

I'm using flash builder, and each SWF is a different project. The external swf has a build path configured linking to the main swf, so the external swf has access to all the classes of the main swf.

The problem is that when I try to instantiate one of the classes that are defined in the main swf, it gives me a ReferenceError:

ReferenceError: Error #1065: Variable GraphicRadioButton is not defined.

When the main swf loads the second swf, it loads fine, and I can interact with the buttons and stuff from the external swf. But when I click a button that leads to an instantiation of this GraphicRadioButton class, it gives me this run-time error. Here is the exact line of code that throws the error (don't mind the params, I believe they have nothing to do with this issue):

maleGenderButton = new GraphicRadioButton(genderButtonGroup, nameInputRightBorder.x + nameInputRightBorder.width + 50,nameInputRightBorder.y, LoginAssets.MALE_GENDER, LoginAssets.MALE_GENDER_OVER, LoginAssets.MALE_GENDER_DOWN);

And this error happens after some other classes are instantiaded, and these other classes are also linked from the project of the main swf, so the problem is specifically with this GraphicRadioButton class.

And one last important info. When I run the exernal swf by itself, the error isn't thrown, it runs fine all the way. The error only happens when the swf is run as an external swf that is loaded from another swf, using Loader, URLRequest and these stuff.

2
Are you using the same package for all classes? if not, then include each package required. Please provide the ZIP file or code so i can have the idea of the flow you're using to implement your functionality. - Ronnie Depp
I can even help you using TeamViewer. I'm Adobe Flex Expert. I use Flash Builder 4.6 for development. - Ronnie Depp
What exactly do you mean by including each package? - Felipe Müller
I'm not able to share the entire code because I'm working on a company that have concerns about sharing the company code with other people. But if you want to help me with team viewer I guess there would be not much problem, and I would be happy - Felipe Müller

2 Answers

0
votes

@felipe Are you importing the class packages properly?

make sure you import GraphicRadioButton class properly before creating objects.

please post more code so i can have an idea the about how are you structuring your app.

0
votes

I have tested some more stuff and found out that actually the issue is with getQualifiedClassName(). On that class that I was constructing, one of its super classes have this line on its constructor

_class = Class(getDefinitionByName(getQualifiedClassName(this)));

There is one thing I need to say first, that is that I have relocated a bunch of classes from one project to another (and one of these classes was GraphicRadioButton), and this other project is also linked in the project that is throwing the error. Once I did that, the GraphicRadioButton doesn't throw any error anymore, but now another class throws.

This other class was called ComposedTextButton, but I renamed the class to be TextComposedButton (with the rename tool in flash builder that updates all its references), but the error keeps saying...

ReferenceError: Error #1065: Variable ComposedTextButtonis not defined.

...even though I have changed the name to TextComposedButton. So there must be something that is not being updated in one of my projects, that makes flash doesn't understand that the class has been changed, or moved, or something like that.