dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: How to Call a Variable from a Class to Fla?

  1. #1
    Member
    Join Date
    Nov 2007
    Posts
    83

    How to Call a Variable from a Class to Fla?

    Hello,

    I've class file named Meters.as I need call an array variable from the Meters.as to main fla.

    My class file is located at here: http://sudrap.org/paste/text/336578/

    Here's my code:

    Code:
    var meterArr:Meters = new Meters();
    trace(meterArr.meterArray[0, 0]);
    This code gives me error 1119. How can I fix that?

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,784
    Hi,

    You could do it like this,

    Meters.as
    PHP Code:
    package 
    {
        
    import flash.display.*;
        public class 
    Meters extends MovieClip
        
    {
            public static var 
    meterArray:Array = [];
            private var 
    i:int;
            private var 
    j:int;

            public function 
    Meters()
            {
                for (
    02i++)
                {
                    
    meterArray[i] = [];
                    for (
    0100j++)
                    {
                        
    meterArray[i].push(String("Array: " " - Test: " j));
                        
    //meterArray[i].push(j);
                    
    }
                }
            }
        }

    and in your main.fla
    PHP Code:
    trace(Meters.meterArray[0][0]); 

Tags for this Thread

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