0
votes

I have a weird issue with importing external SWF in ActionScript 3.0. I want to import a SWF made with EasyPano TourWeaver 7.96 but when I'm doing this I'm getting the Error #2007: Parameter child must be non-null. Here is the code:

var VRArea:MovieClip = new MovieClip();

VRArea.x = 0;
VRArea.y = 96;

addChild(VRArea);

var my_Loader:Loader = new Loader();
var urlRequest : URLRequest = new URLRequest("vr/vr_Candela.swf");

my_Loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderComplete);
my_Loader.load(urlRequest);

function loaderComplete(event:Event):void {
    VRArea.addChild(my_Loader);
}

The complete error is shown below:

TypeError: Error #2007: Il valore del parametro type deve essere diverso da null.
at flash.events::EventDispatcher/addEventListener()
at `[::-V/5?()
at ->::4J/Step4_2_startUI()
at ->::4J/`Z()
at [A::&=/1?()
at [A::%c/dispatch()
at !A::%D/load()
at ->::4J/Step3_1_LoadConfig()
at ->::4J/Step3()
at ->::4J/Step2_createContext3D()
at ->::4J/%$()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at  $::TWLoadingWindow/+&()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at 0M::1X/;$()
at 0M::1X/3@()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at 0M::>5/&S()

Additional info: I'm getting only the loading screen of the external SWF.

2
I think that your mentioned code is fine and the problem is in the loaded swf. - akmozo

2 Answers

0
votes

You should use event.target in your listener to add the loader object. More, since you've assigned the listener to loaderInfo property, you need to get the object's content that is the object with loaded SWF.

function loaderComplete(event:Event):void {
    var li:LoaderInfo=event.target as LoaderInfo;
    if (!li) return; // failed typecast
    VRArea.addChild(li.content); // add content
}
0
votes

I solved the issue: The SWF I tried to embed was made with Flash 11.x (at least Flash CS6) and mine was Flash 10.0 (Flash CS5). I solved by upgrading to Flash CS6 and publishing again. Now it's fine.