• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1448
  • Last Modified:

Passing variables between swf's

Hello All,

Beginning with flash only a few weeks ago, I have had to jump right into some pretty tricky areas...  At the moment, my sticking point is trying to pass variables between two swf files.

(Main SWF Loaded From Browser)
        (Child MC in library)
              (Child MC loaded from external)

It is the bottom most SWF which needs the data located in the Main SWF.  In the main swf I have an array defined as:

_global.ArrayObj = new Array();
ArrayObj[0] = new Array({item1:Value, item2:Value, n...})

    (or)

_global.ArrayObj = new Array();
ArrayObj[0] = new Array(Value1, Value2, n...})

I have also tried several different options such as references using _root with lockroot, direct calls to _parent._parent etc, but nothing appears to work.  However one strange instance, it appears as though when calling this from the bottom most child:

_global.ArrayObj[0] is returns [object Object] however when referencing the items both by name .item1 or by number [0] it returns undefined.

Does anyone have any ideas?

Thanks
-Anubis
0
Anubis2005
Asked:
Anubis2005
2 Solutions
 
Dushan De SilvaTechnology ArchitectCommented:
0
 
Aneesh ChopraCommented:
Hi,

you are getting _global.ArrayObj[0] as [object Object], that clearly means you are getting the array object.

I think everything is fine and you are getting the array object.. just not using it with correct syntax

if this is your array on main SWF...
-------
_global.ArrayObj = new Array();
ArrayObj[0] = new Array({item1:Value, item2:Value, n...})
--------
I hope you can access it as shown below:
-----------
trace(_global.ArrayObj[0].item1)
-------------


Rgds
Aneesh
0
 
Anubis2005Author Commented:
Thank you for your quick comments.

Looking at it again this morning with fresh eyes, I noticed the very trailing end of the array.  It appears as though the items being loaded into the array are being undefined when set and consequentally undefined when being called.  It had me stumped cause I was sure (as is true) that I had the code correct.

Thank you again.
-Anubis
0
 
MHenryCommented:
Asked by Author to reopen question. Said he wished to split points.

MHenry
PE
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now