Skip to main content
Participant
April 28, 2011
Question

How to pass a variable from one scene to another

  • April 28, 2011
  • 1 reply
  • 1144 views

I'm making a call from one scene to another via a button, but I have two buttons calling the same scene, each for a different purpose, and I need to pass certain variables tied to each button to that called scene. How can I do this?

This topic has been closed for replies.

1 reply

relaxatraja
Inspiring
April 28, 2011

import flash.events.MouseEvent;
stop();
var nam:String="test";

testscene2.addEventListener(MouseEvent.CLICK,fn);
function fn(e:MouseEvent){
    nam="Raja";
    gotoAndStop(1,"Scene 3");
}

testscene1.addEventListener(MouseEvent.CLICK,fn1);
function fn1(e:MouseEvent){
    nam="Emily";
    gotoAndStop(1,"Scene 2");
}