Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

ReferenceError: Error #1065: Variable TestMain is not defined

New Here ,
Oct 22, 2013 Oct 22, 2013

I'm loading a .swf and trying to find a class based on an embedded xml document in it. I've looked this problem up endlessly and everyone has either said "Your class isn't public", "Your classname is interfering with your document class", or "You aren't using the same ApplicationDomain", none of which are true. Here's my code:

In CoCMain.as, with a CoCMod.fla:

    private function pluginLoadingComplete(e:Event😞void {
       
var testXML:XML = new XML(new e.target.content.description);
        trace
(e.target.applicationDomain.hasDefinition("blah.blaah.testPlugin.TestMain"));//returns false
        trace
(ApplicationDomain.currentDomain.hasDefinition("blah.blaah.testPlugin.TestMain"));//returns false
        trace
(testXML.main[0]);//returns blah.blaah.testPlugin.TestMain
       
var pluginClass:Class = e.target.applicationDomain.getDefinition(testXML.main[0]) as Class;//error here
   
}

And in TestMain.as, with a TestMod.fla (this is the swf I am loading):

package blah.blaah.testPlugin {

   
public class TestMain {
       
public function TestMain():void {
           
super();
       
}      

       
public function onEnable():void {
            trace
("blah");
       
}
   
}  
}

And in frame 1 of TestMod.fla:

import blah.blaah.testPlugin.TestMain;

[Embed(source = 'main.xml', mimeType = "application/octet-stream")]
const description:Class;

The xml file:

<mod>

          <name>Test Mod</name>

          <description>Please ignore</description>

          <author>Bleachisback</author>

          <version>1.0</version>

          <main>blah.blaah.testPlugin.TestMain</main>

</mod>

The error I am getting:

ReferenceError: Error #1065: Variable TestMain is not defined.
    at flash
.system::ApplicationDomain/getDefinition()
    at me
.bleachisback.cocMod::CoCMain/pluginLoadingComplete()

TOPICS
ActionScript
839
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 22, 2013 Oct 22, 2013
LATEST

copy and paste code where you add the listener that calls pluginLoadingComplete and the load method code.

also, make sure your loaded swf is using TestMain in blah/blaah/testPlugin by using a trace statement in TestMain.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines