Skip to main content
June 13, 2012
Answered

public var and External swf

  • June 13, 2012
  • 1 reply
  • 1017 views

Hello!

I have some problem with vars. The situation is the same I wrote here Re: External swf

I have public var (for example ZZZ) in code of MAIN.swf (main class is Main.as), and I want to access it from code of loaded EXTERNAL.swf.

But nothing helps, flash says:

there is no ZZZ in code of Main

there is no ZZZ on stage.root

there is no ZZZ in any parents.

But if a have ZZZ in code of EXTERNAL, and want to access it from MAIN,  (the reverse situation), ZZZ is easily found.

This topic has been closed for replies.
Correct answer kglad

your variable is defined on the main timeline of MAIN.swf so you just need a path to it.

that exact path depends on the scope of EXTERNAL's loader.

(and, of course, you need to make sure that variable is defined before trying to reference it.)

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
June 13, 2012

your variable is defined on the main timeline of MAIN.swf so you just need a path to it.

that exact path depends on the scope of EXTERNAL's loader.

(and, of course, you need to make sure that variable is defined before trying to reference it.)

June 13, 2012

public var ZZZ:Number = 9;

As I read now in Adobe's help : Loader has no root until it is added as a child (and i don't do that), and External has it's own root (and i don't add him either). May be I should pass to EXTERNAL

this

as exact pass, and then

ExactPass.ZZZ

would be found?

I have another idea: getDefinitionByName won't help External to find ZZZ in Main?