Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: showEffect in CafeTownsend demo  (Read 10971 times)
vezey
Newbie
*
Posts: 4


View Profile Email
« on: January 19, 2009, 11:15:57 »

In the CafeTownsend demo, in CafeTownsend.mxml, I have added showEffect and hideEffect attributes to the view children of the main ViewStack, fadeIn and fadeOut effects defined in the same mxml file. These all work, except for the initial showEffect of the first child, the login page. Why is that? Code below.



    <mx:Style source="assets/main.css" />
    <mx:Fade id="fadeOut" duration="1000" alphaFrom="1.0" alphaTo="0.0"/>
<mx:Fade id="fadeIn" duration="1000" alphaFrom="0.0" alphaTo="1.0"/>

   <mx:Image id="img" source="@Embed('assets/header.jpg')" width="700" showEffect="{fadeIn}" hideEffect="{fadeOut}" />
   <mx:HBox paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10" backgroundColor="#ffffff" width="700">
      <mx:VBox width="100%" verticalScrollPolicy="off" paddingRight="10">
         <mx:ViewStack id="vwStack" width="100%" paddingBottom="10" paddingTop="10" resizeToContent="true" creationPolicy="all">
            <view:EmployeeLogin id="employeeLogin" showEffect="{fadeIn}" hideEffect="{fadeOut}" />
            <view:EmployeeList id="employeeList" showEffect="{fadeIn}" hideEffect="{fadeOut}" />
            <view:EmployeeDetail id="employeeDetail" showEffect="{fadeIn}" hideEffect="{fadeOut}" />
         </mx:ViewStack>
      </mx:VBox>
   </mx:HBox>
Logged
vezey
Newbie
*
Posts: 4


View Profile Email
« Reply #1 on: January 19, 2009, 11:29:48 »

Oops. Posted before finishing. Meant to add

1) The first view child is called into view as a part of the facade.startup(), the creationComplete event for the main mxml file. This I know. But when the view children are created as a part of the Flex app starting up, isn't the showEffect taken into consideration as an attribute of the first view child? What is it about the way the first view child is called into view that doesn't allow the user to see the fade in effect? Does it fade in before it is displayed, if that is possible?

2) Thanks in advance for any help or insight. PureMVC is a nifty puzzle for goofballs like myself who have eschewed frameworks of any sort. Until now. I am starting to get it, and realize I am standing on the shoulders of giants. All of the decoupling takes discipline, but is well worth it when adding views down the line.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #2 on: January 19, 2009, 01:15:37 »

Actually, the first child is not created as a result of facade.startup(). The entire initial MXML view builds itself, then on creationComplete, facade.startup() is called. At this point the initial animations should be completed. Then we create the PureMVC apparatus and attach it to the view.

I'm fairly sure this is a Flex bug. Try taking out the facade.startup() call (and the initialization of the facade variable) and see if the animation completes.

-=Cliff>
Logged
vezey
Newbie
*
Posts: 4


View Profile Email
« Reply #3 on: January 19, 2009, 04:04:00 »

cliff,

Thanks for your reply. Removing the facade.startup() call, and the initialization of the facade variable didn't cause the showEffect fade in to play. That looks like a Flex bug. I suspect I can capture the event that causes the display of the first view child and force an effect, but I don't know that for sure. I see that the view child is not created in any of the pure mvc initialization or subsequent method calls, but rather as a part of the flex start up. But it looks like the first view child is called into view, I mean, asked to display itself, in the first run of notifyObservers(). But this happens by default without the pure mvc intitialization because ViewStacks display the first view child (selectedIndex=0) by default. Any further thought or insights are very welcome. Thanks.

As an aside, I think if you were a physician, you would be one of those surgeons who is really good at performing procedures remotely, for example, having your hands on controls in Kansas City for a patient in Vancouver (not a comment on Canadian medicine), and doing a fine gall bladder removal without having to hassle the sterile environment. You could be smoking a cigar and listening to Hendrix. What I mean is that the ability to abstract all of the pieces, decouple an applicaton so effectively, calls for the ability to intuitively hold the pieces in your mind. At least it looks that way from here. I am carrying on because this is my first exposure to a formal approach to this sort of framework, and I am fascinated by how it all works together. After a couple of applications, I know I will have a better understanding of why it is better to be so strict with all of the Singletons, and delegate the work to commands, proxies and mediators (and delegates and observers). What will be the next improvement on this sort of thinking?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #4 on: January 20, 2009, 08:03:01 »

LOL! You got the Hendrix part right :)

Working remotely rules! In fact I answer about 80 percent of my forum questions from my Blackberry so I can be anywhere and still be effective. (The other 20% are the Q's where I have to go rummage through code that I can't get to easily with this thing's wap browser.)

As for the surgery part, I'm studying to be a doctor. So far I've got the unreadable signature part sussed...

-=Cliff>   
Logged
vezey
Newbie
*
Posts: 4


View Profile Email
« Reply #5 on: January 21, 2009, 07:09:48 »

Really? You are pursuing medicine? I spent 5 years in an emergency room, finishing pre-med requirements and mostly being an adrenaline junky. Here's some unsolicited advice: with your mind, go for something that requires the really smart men and women: infectious disease (try holding the entire inflammatory cascade in your mind), pathology (used to be the brightest of the bright), neurology. I got married, and knew I couldn't do both well, be a family man and med school student and resident and all that, just don't have those chops. More power to you, Cliff. You will make an excellent diagnostician, and that is all too rare. One of the best diagnosticians I met was a nurse who woefully undervalued her gifts. She made this intuitive leaps that made you double take. Anyway, I wish you the best, and I am thankful for your hard and thorough work, creating Pure MVC and providing guidance in the forums.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #6 on: January 21, 2009, 11:37:02 »

No, no, I was just joking. Comes over better in person if you saw my signature..:)

My mom was a nurse though, and it seemed like a very emotionally rough field. But she was a whiz with math and had a very analytical mind.

Interestingly, one of the guys in this community who has plumbed the depths of MultiCore to get to the nitty gritty about the delicate garbage collection issues comes to programming from a medical background and he took to programming naturally and advanced rapidly.

I've always observed a big crossover with music and coding. I bet there's a similar, if less obvious overlap with the code and medicine. Lots of variables, things to measure and figure out...

When I was much younger I worked in a woodshop and got deeply into woodworking for the same reasons.

-=Cliff>
Logged
Pages: [1]
Print