3 Replies Latest reply on Jun 14, 2006 2:26 PM by Juankpro

    Dynamic Transition Manager

    I tried Level 1
      Hi all,


      I am trying to pass dynamic information as parameters to the transitionManager.start method. Something like this works just fine:

      TransitionManager.start(a_mc, {type:mx.transitions.Wipe,
      easing:mx.transitions.easing.Bounce.easeOut,
      duration:2,
      direction: 0});

      but, if I do something like this, it breaks:

      var objTransition = new Object;

      szType = "mx.transitions.Wipe";
      szEasing = "mx.transitions.easing.Bounce.easeOut";
      nDuration = 2;
      nDirection = 0;

      objTransition = {type:szType, easing:szEasing, duration:nDuration, direction:nDirection};

      TransitionManager.start(a_mc, objTransition);

      I've left out the nitty-gritty of how those variables are populated, but I think you'll get the idea.

      Thanks in advance for your suggestions,
      Robert
        • 1. Re: Dynamic Transition Manager
          Juankpro Level 2
          classes are not strings they are objects. This is why to populate objects you must call them without the quotation marks:

          var objTransition = new Object;

          szType = mx.transitions.Wipe;
          szEasing = mx.transitions.easing.Bounce.easeOut;
          nDuration = 2;
          nDirection = 0;

          objTransition = {type:szType, easing:szEasing, duration:nDuration, direction:nDirection};

          TransitionManager.start(a_mc, objTransition);
          • 2. Re: Dynamic Transition Manager
            I tried Level 1
            Yeah, maybe I should have included the rest of the code. I was dynamically building that string szType as well as the szEasing string. I've decided to build a helper class and methods that accept my string as arguments then return the function. Thanks for your help.
            • 3. Re: Dynamic Transition Manager
              Juankpro Level 2
              You can obtain the objects dynamically like this;

              szType = _global["mx.transitions.Wipe"];
              szEasing = _global["mx.transitions.easing.Bounce.easeOut"];

              Because this classes are built in the _global object