Welcome, Guest. Please login or register.
Did you miss your activation email?
05/22/12, 17:26
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  General
| |-+  Flex, Air, FlashBuilder, Catalyst (Moderators: ..:: Mazhar Hasan ::.., kofi addaquay)
| | |-+  viewstack problem with bindable variables in flex4
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: viewstack problem with bindable variables in flex4  (Read 1648 times)
papachan
Systems Administrator
*****
Posts: 507


View Profile WWW
« on: 04/10/10, 17:43 »

Hello there,

Do you have noticed that in Flex4, ViewStack.selectedIndex is not refreshing with Bindable variables?

I have a same example working in flex3 but in flex4 not....

weird.
---
dan
Logged

papachan
Systems Administrator
*****
Posts: 507


View Profile WWW
« Reply #1 on: 04/11/10, 10:14 »

sorry, it finally worked into a brand new empty Project at flex4. My code on my old project seems not to be so correctly achieved.

   <fx:Script>
      <![CDATA[
         [Bindable]private var model:ModelLocator = new ModelLocator();
         
         protected function first_clickHandler(event:MouseEvent):void
         {
            model.viewIndex = 1;
         }
         
         
         protected function btn_clickHandler(event:MouseEvent):void
         {
            model.viewIndex = 0;

         }
         
      ]]>
   </fx:Script>
   <fx:Declarations>
      <!-- Place non-visual elements (e.g., services, value objects) here -->
   </fx:Declarations>
   <s:HGroup>
      <s:Button  click="first_clickHandler(event)"/>
      <s:Button click="btn_clickHandler(event)"   id="btn"  />
   </s:HGroup>
   <s:Panel id="dataPanel" width="840" height="100" y="100">
      <mx:ViewStack id="myViewStack" selectedIndex="{ model.viewIndex }"
                 width="100%" height="100%">
         <mx:Canvas id="PanelEditor">
            <s:Button id="btn1" label="Button #1" />
         </mx:Canvas>
         <mx:Canvas id="SiteEditor" show="btn2.label = new Date().toTimeString();">
            <s:Button id="btn2" label="Button #2" />
         </mx:Canvas>
      </mx:ViewStack>
   </s:Panel>


Logged

kofi addaquay
Global Moderator
Senior Programmer
*****
Posts: 450



View Profile WWW Email
« Reply #2 on: 04/11/10, 20:40 »

do you mean the code logic was wrong in the first project thats why it didnt work? also is this only a test project? i see you are setting the model in the main class instead of through some event dispatcher or command to sets the model.
Logged
papachan
Systems Administrator
*****
Posts: 507


View Profile WWW
« Reply #3 on: 04/12/10, 20:38 »

The code above is only a simple exemple to validate a binding variable, working with a viewstack component in flex4.

My problem at my first project, was using a binding variable from a model class and triggered from an eventdispatcher. but the project use already many classes and wouldnt paste it here.


---
dan
Logged

kofi addaquay
Global Moderator
Senior Programmer
*****
Posts: 450



View Profile WWW Email
« Reply #4 on: 04/12/10, 21:25 »

gotcha  Wink
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!