Skip to main content
Laxidasical
Known Participant
December 29, 2010
Answered

BUG: SlideViewTransition() not working properly

  • December 29, 2010
  • 1 reply
  • 1902 views

I'm attempting to use one of the standard view transitions.  Basically, I want a particular view to slide right instead of left (default).  According to everything I read on Adobe's website and the help pages this should be possible using the SlideViewTransition() function.

When I use the function it states that I'm trying to pass too many variables to it.  However, when I look at the actual code in the project (Flex Hero > spark > effects > SlideViewTransition.abc > SlideViewTransition.as) the function does indeed show 2 variables to be passed to it:

public function SlideViewTransition(duration:Number = 300, direction:String = SLIDE_LEFT) {      super();              this.duration = duration;      this.direction = direction; }

NOTE: SLIDE_LEFT is a constant set in the class that equals "left" (string).  There is also a SLIDE_RIGHT constant that equals "right".

I initially tried the following...

  • SlideViewTransition(null, SLIDE_RIGHT)
  • SlideViewTransition(300, SLIDE_RIGHT)
  • SlideViewTransition(null, "right")
  • SlideViewTransition(300, "right")

NOTE: The entire line tried is:

navigator.pushView(views.MoBillTransactions, null, SlideViewTransition("right"));

After repeatedly receiving an error stating too many variables were passed I tried passing just one.  Sending a number threw a type error, so I knew it wasn't "duration".  Neither "SLIDE_RIGHT" or "right" worked.  I'm pretty sure this is a bug since I can see the function's code directly.  If not, can someone guide me in the "right" direction??? (pun intended!)

-> Flash Builder "Burrito"

-> Flex Mobile Project (Android)

-> Win 7 64bit Machine

This topic has been closed for replies.
Correct answer

Cool, I see your using Hero, let me know how thats working for you performance wise...

Anyways, I believe the issue is that you need to instantiate it by using the keyword new, then set appropriate properties (time, data, direction) like this...

protected function transactionsButtonHandler():void {      if (!(navigator.activeView is views.Transactions))      {           if (navigator.activeView is views.ProcessTransaction) {navigator.pushView(views.Transactions);}           else if (navigator.activeView is views.Settings)           {                navigator.popView();                navigator.pushView(views.Transactions, null, new SlideViewTransition(240, SlideViewTransition.SLIDE_RIGHT));

          }      } }

Hope this helps....

1 reply

December 29, 2010

I'm a little confused about the code your showing me, and more detail would be a plus...

The one thing I did notice though was that your trying to get a return on a class instantiation.

If this doesn't help, send more code.

Laxidasical
Known Participant
December 30, 2010

Thanks for the reply CodeMata!

I'm trying to manage the view transitions (whether it slides left or right) based on the current view and which button is pressed.  The below code snippet is the handler for a button who's id is "transactionsButton", and corresponds to the transaction view.  There are three buttons total, the layout is as follows:

| processTransactionButton | transactionsButton | settingsButton |

When the user is in the ProcessTransaction view and clicks on the transactionsButton I want it to slide left, but if they are at the Settings view I want it to slide right.

Here is the handler for the transactionsButton (the commented out line is where I'm having trouble!!!):

protected function transactionsButtonHandler():void {      if (!(navigator.activeView is views.Transactions))      {           if (navigator.activeView is views.ProcessTransaction) {navigator.pushView(views.Transactions);}           else if (navigator.activeView is views.Settings)           {                navigator.popView();                //navigator.pushView(views.Transactions, null, SlideViewTransition("right"));                navigator.pushView(views.Transactions);           }      } }

Correct answer
December 31, 2010

Cool, I see your using Hero, let me know how thats working for you performance wise...

Anyways, I believe the issue is that you need to instantiate it by using the keyword new, then set appropriate properties (time, data, direction) like this...

protected function transactionsButtonHandler():void {      if (!(navigator.activeView is views.Transactions))      {           if (navigator.activeView is views.ProcessTransaction) {navigator.pushView(views.Transactions);}           else if (navigator.activeView is views.Settings)           {                navigator.popView();                navigator.pushView(views.Transactions, null, new SlideViewTransition(240, SlideViewTransition.SLIDE_RIGHT));

          }      } }

Hope this helps....