Passing variables between swf's

Posted on 2006-04-09
Last Modified: 2007-12-19
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...})


_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?

Question by:Anubis2005
    LVL 17

    Assisted Solution

    LVL 34

    Accepted Solution


    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:

    LVL 1

    Author Comment

    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.
    LVL 7

    Expert Comment

    Asked by Author to reopen question. Said he wished to split points.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
    This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
    In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
    The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now