Adobe Dreamweaver Forums



Last 10 THreads :         can't convert wmv files (Last Post : scrytser - Replies : 3 - Views : 18 )           »          Need assistance converting some AS2 code to AS3 (Last Post : NedWebs - Replies : 1 - Views : 2 )           »          Creating form element from within a component (Last Post : jim1234 - Replies : 0 - Views : 1 )           »          Re: MIDI commands? (Last Post : rtalton - Replies : 0 - Views : 1 )           »          I need some help (Last Post : GradStudent07 - Replies : 0 - Views : 1 )           »          Suddenly can't see files on remote server (Last Post : Alan - Replies : 6 - Views : 7 )           »          CS4 trials expired too early (Last Post : Wodehouse - Replies : 7 - Views : 8 )           »          need check of site in IE7 please. (Last Post : yankeestonk - Replies : 9 - Views : 10 )           »          FLV problem (Last Post : TezS56 - Replies : 0 - Views : 1 )           »          movieclip (Last Post : ceyesuma - Replies : 0 - Views : 1 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Flex
 
Tags: , , , ,



Reply
  #1 (permalink)  
Old 07-31-2008, 03:47 AM
masita18
 
Posts: n/a
Diggs:
Default Setting Data on Viewstack 2nd comtainer

I have a titlewindow with 2 buttons. And within the titlewindow there is a
viewstack. The viewstack have 2 containers. Button1 click event to switch to
container1 and button2 click event to switch to container2. Each container have
its own control. Container 1 have textinput and vslider. Container 2 also have
textinput and vslider. I could retrieve and set the values of controls in
container 1 when button1 is click using viewstack.selectedIndex=0. but am
unable to set the values of the control in container 2 when button2 is clicked
using viewstack.selectedIndex=1. Got this error for container2.

Error #1009: Cannot access a property or method of a null object reference.

Appreciate if you could kindly advise.

if(DB.variableView == "Cont1")
{
varEditor.toggleBtn1.selectedIndex = 0;
varEditor.viewstack1.selectedIndex = 0;

varEditor.txtInitialValue1.text = DB.varInitialValue;
}
if(DB.variableView == "Cont2"){

varEditor.toggleBtn1.selectedIndex = 1;
varEditor.viewstack1.selectedIndex = 1;
varEditor.txtInitialValue2.text = DB.varInitialValue;
}





Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-31-2008, 07:30 PM
Greg Lafrance
 
Posts: n/a
Diggs:
Default Re: Need Help with ViewStack :(

You need to have IDs set for the 2 containers, and when a button is pressed use varEditor.viewstack1.selectedChild = containerID.
Reply With Quote
  #3 (permalink)  
Old 07-31-2008, 07:30 PM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: Setting Data on Viewstack 2nd comtainer


"masita18" <webforumsuser@macromedia.com> wrote in message
news:g6r666$cr4$1@forums.macromedia.com...
>I have a titlewindow with 2 buttons. And within the titlewindow there is a
> viewstack. The viewstack have 2 containers. Button1 click event to switch
> to
> container1 and button2 click event to switch to container2. Each container
> have
> its own control. Container 1 have textinput and vslider. Container 2 also
> have
> textinput and vslider. I could retrieve and set the values of controls in
> container 1 when button1 is click using viewstack.selectedIndex=0. but am
> unable to set the values of the control in container 2 when button2 is
> clicked
> using viewstack.selectedIndex=1. Got this error for container2.
>
> Error #1009: Cannot access a property or method of a null object
> reference.
>
> Appreciate if you could kindly advise.
>
> if(DB.variableView == "Cont1")
> {
> varEditor.toggleBtn1.selectedIndex = 0;
> varEditor.viewstack1.selectedIndex = 0;
>
> varEditor.txtInitialValue1.text = DB.varInitialValue;
> }
> if(DB.variableView == "Cont2"){
>
> varEditor.toggleBtn1.selectedIndex = 1;
> varEditor.viewstack1.selectedIndex = 1;
> varEditor.txtInitialValue2.text = DB.varInitialValue;
> }


You can either put the call to these in creationComplete of the containers
in the ViewStack or you can set a flag on change of the ViewStack and then
execute this code from updateDisplayList.

HTH;

Amy


Reply With Quote


  #4 (permalink)  
Old 07-31-2008, 07:55 PM
dimival
 
Posts: n/a
Diggs:
Default Re: Need Help with ViewStack :(

I don't think the ids will solve anything Greg. Actually the issue is the
creationPolicy of the components, masita18. Flex automatically creates only the
components that are visible so any component on your second container is not
available until you access that container.

One way to solve this is to change the creationPolicy of your ViewStack to
"all", that way Flex will create all the components inside the viewstack, be
aware that if you have tons of components your application will load slower.

There should be other threads with your same issue around here, some of them
have posts with better solutions for your issue.

Reply With Quote
  #5 (permalink)  
Old 08-01-2008, 03:35 AM
Greg Lafrance
 
Posts: n/a
Diggs:
Default Re: Need Help with ViewStack :(

I would think myViewstack.selectedChild = container2 would be the initial access that causes it to be initially created. I don't think in this case creationPolicy needs to be auto.
Reply With Quote
  #6 (permalink)  
Old 08-01-2008, 07:21 AM
masita18
 
Posts: n/a
Diggs:
Default Re: Need Help with ViewStack :(

Hi all!

I've tried to set the creationPolicy = "all".
It works perfectly fine!
Thank you so so much
Reply With Quote


Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 08:38 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk