Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

pass variable name to class that modifies it

Guest
Sep 04, 2013 Sep 04, 2013

in my main fla:

import Preloader;

var prel:Preloader = new Preloader();

var toPass=9;

prel.loads(this,stage,"toPass",2);

in my Preloader.as:

package  {

          import flash.display.Sprite;

          import flash.display.Stage;

          import flash.events.Event;

     public class Preloader extends Sprite {

          private var stageRef:Stage;

          private var mainTimeLineRef:*;

          public function loads(a,b,c,d):void{

               this=d

                    }

          }

}

I want to pass the toPass var to my class that has to edit that, how can i do?  (i know that i could simply write toPass = d)

TOPICS
ActionScript
328
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 04, 2013 Sep 04, 2013
LATEST

i'm not sure what you're trying to do but to pass a variable's value, use:

framode wrote:

in my main fla:

import Preloader;

var prel:Preloader = new Preloader();

var toPass:int=9;

prel.loads(stage,toPass);

in my Preloader.as:

package  {

          import flash.display.Sprite;

          import flash.display.Stage;

          import flash.events.Event;

     public class Preloader extends Sprite {

          private var stageRef:Stage;

          private var mainTimeLineRef:*;

private var toPassRef:int;

          public function loads(a:Stage,b:int):void{

stageRef=a;

             toPassRef=b;

                    }

          }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines