Skip to main content
June 24, 2009
Answered

Error #1065: variable undefined, path to container mc in loaded swf not recognised

  • June 24, 2009
  • 1 reply
  • 762 views

Hello All

I am having problems with solving following problem and would appreciate every help.

One movie, named Gallery_1, with hotpots via which external swfs are loaded into a container mc of the main timeline of the Gallery_1 movie, works perfectly by now (thanks to expert's gurus and sages :-).

Via another button function the Gallery_1.swf is loaded into a container mc on the timeline of the main swf, which works alright as well, but when one then clicks the hotspots of the Gallery_1.swf one gets following error message:

ReferenceError: Error #1065: Variable GallerySite not defined.

at HotSpot1/PictureLoad()

at HotSpot1/PictureCall()

Here is the HotSpot1 Class:

package {

import flash.display.*;

import flash.events.*;

import flash.net.URLRequest;

import flash.display.DisplayObject;

import flash.display.Loader;

import WebSite;

import GallerySite;

public class HotSpot1 extends MovieClip{

var reqName:String;

var target:DisplayObject;

var loader:Loader = new Loader();

function HotSpot1():void{

this.addEventListener(MouseEvent.CLICK, PictureCall);

this.buttonMode = true;

}

public function PictureCall(event:MouseEvent):void{

reqName = this.name + ".swf";

trace(reqName);

trace(this.parent.parent.name);

target = this.parent.getChildByName("picture_container");

trace(target);

trace(target.name);

trace(this.parent.getChildIndex(target));

var req:URLRequest = new URLRequest(reqName);

loader.load(req);

this.PictureLoad();

}

public function PictureLoad():void{

GallerySite(root).picture_container.addChild(loader);

}

}

}

The traces in the eventHandler function work alright.

I wildly imported all relevant classes I could think of, e.g. the GallerySite class to the WebSite class and vice versa, and tried various variable definitions, but am at a loss by now as to where to define the GallerySite variable and don't think that I would get any further without help.

This topic has been closed for replies.
Correct answer Ned Murphy

Have you tried using just: MovieClip(root).picture_container.addChild(loader);

I don't know what you are attempting by casting the root as a GallerySite, but then I'm shy of understanding classes as well.

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
June 24, 2009

Have you tried using just: MovieClip(root).picture_container.addChild(loader);

I don't know what you are attempting by casting the root as a GallerySite, but then I'm shy of understanding classes as well.

June 24, 2009

Hello Ned

Thanks a lot, this solved the problem and made my day.

Ned Murphy
Legend
June 24, 2009

You're welcome