A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [MX04] Help making global array

  1. #1
    Member
    Join Date
    Jan 2007
    Posts
    69

    [MX04] Help making global array

    Can someone help me make this array statement global? I've been searching through the forum, but can't figure it out.

    Code:
    var aItem:Array = new Array();

  2. #2
    Busy doing nothing Boris the Frog's Avatar
    Join Date
    Jan 2001
    Location
    Derby, UK
    Posts
    305
    don't stick this line in a function then you can use it in any function
    example:

    //actions for frame 1 of main timeline
    var aItem:Array = new Array();

    function setItems(){
    aItem[0] = "Hello";
    aItem[1] = "World";
    trace(aItem.toString()); //displayes "Hello World"
    }

    setItems();
    --------------------------------------------------
    ‘There is no emoticon to express how I am feeling’ - Comic Book Guy
    There's an effective, simple solution to carbon sequestration... it's called 'coal', so leave it alone!
    There's an effective, simple solution to carbon capture....it's called 'trees', so plant some!

  3. #3
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    Code:
    // in main.swf -
    _global.aItem = new Array();
    aItem[0] = "test";
    aItem[1] = "this";
    
    loadMovieNum("test.swf",1);
    
    // in test.swf -
    // trace(aItem[0]+" "+aItem[1]);
    // outputs -- test this

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center