PDA

View Full Version : How do I refer to the currently 'valid' mc in a loaded swf


new2oop
09-26-2008, 01:24 AM
I have a base swf that dynamically loads an external swf 'loaded'swf'. Inside the externally loaded swf is a series of small swfs, only one of which is 'valid' at any time. From the base swf I want to perform an action (eg. resize) on the currently valid swf.

To identify the currently valid swf I thought I would get it to store a reference to itself in a public variable

public var currentValidMC:DisplayObject;

on the 'root' of the external swf. eg. from the valid swf use the command:

Object(parent).currentValidMC = this;

Then from the base swf I could call

loaded.currentValidMC.width = 50;

But it doesn't work, and there maybe a better way to do this (eg events).

Essentially I want a mc or sprite in the loaded swf to identify itself as the target that the base swf should perform actions on. How do I pass that mc value to the base swf so that I can perform actions and call functions on it?

amarghosh
09-26-2008, 06:52 AM
your code should work: what is the error u r getting?
try this in the base swf's load complete handler:
var validmc:MovieClip = LoadedSWFDocumentClass(loader.content).currentVali dMC;