artus
02-01-2011, 08:11 AM
Hello,
I'm posting a thread because I'm stuck on something...
I am trying to call a function of my main document class from an external swf
but I can't seem to work around this error :
TypeError: Error #1034: Type Coercion failed: cannot convert Dragger_fla::MainTimeline@29e5f121 to Main.
at Dragger_fla::Dragger_1/down()
The code in my main docuemnt class is :
package {
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.display.Stage;
import flash.events.Event;
public class Main extends MovieClip {;
public static var stage:Stage;
public static var root:DisplayObject;
public static var tester:String;
public function Main():void {
}
public function Drag_ON():void {
trace("Drag_ON called");
}
}
}
and the code in my external swf is (code is on timeline and not in a seperate class ) :
//
BT.addEventListener(MouseEvent.MOUSE_DOWN, down);
function down(event: MouseEvent) {
//MovieClip(parent.parent.parent.parent.parent.paren t.parent).tout.startDrag()
//Stage.tout.startDrag();
//TopLevel.tester="changed"
//trace(TopLevel.tester)
Main(root).Drag_ON();
}
Does anybody know why I have this error ?
Any help will be appreciated. Thanks.
I'm posting a thread because I'm stuck on something...
I am trying to call a function of my main document class from an external swf
but I can't seem to work around this error :
TypeError: Error #1034: Type Coercion failed: cannot convert Dragger_fla::MainTimeline@29e5f121 to Main.
at Dragger_fla::Dragger_1/down()
The code in my main docuemnt class is :
package {
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.display.Stage;
import flash.events.Event;
public class Main extends MovieClip {;
public static var stage:Stage;
public static var root:DisplayObject;
public static var tester:String;
public function Main():void {
}
public function Drag_ON():void {
trace("Drag_ON called");
}
}
}
and the code in my external swf is (code is on timeline and not in a seperate class ) :
//
BT.addEventListener(MouseEvent.MOUSE_DOWN, down);
function down(event: MouseEvent) {
//MovieClip(parent.parent.parent.parent.parent.paren t.parent).tout.startDrag()
//Stage.tout.startDrag();
//TopLevel.tester="changed"
//trace(TopLevel.tester)
Main(root).Drag_ON();
}
Does anybody know why I have this error ?
Any help will be appreciated. Thanks.