Welcome, Guest. Please login or register.
Did you miss your activation email?
05/22/12, 06:45
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 und states mit removeChild
0 Members and 2 Guests are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: viewstack und states mit removeChild  (Read 3568 times)
entenknochen
Server what's that
*
Posts: 3


View Profile Email
« on: 03/26/09, 07:44 »

Hallo, hab da eine ganz komische Sache die ich mir nicht erklären kann.
Hab eine Komponente erstellt und diese ist ein Viewstack. In diesem Viewstack sind weitere Komponenten drin.
Wenn ich jetzt mit einen mx:State eine Komponente davon entferne läuft alles.
Nur wenn ich danach den currentState wieder auf "" zurücksetze, kommt ein Fehler:
Error: Multiple sets of visual children have been specified for this component (base component definition and derived component definition).
... ganze langer fehler-stack. und irgendwo steht dass genau diese Komponente den Fehler hat.
Der Code ist verdammt simpel ...

Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:ViewStack xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:ma="com.ma" resizeToContent="true"  currentState="{Application.application.currentState}">

<mx:Script>
<![CDATA[
import mx.core.Application;
]]>
</mx:Script>

<mx:states>
<mx:State name="admin">
<mx:RemoveChild target="{b}" />
</mx:State>
<mx:State name="groupadmin">
<mx:RemoveChild target="{b}" />
<mx:RemoveChild target="{a}" />
</mx:State>
<mx:State name="editor">
<mx:RemoveChild target="{b}" />
<mx:RemoveChild target="{c}" />
</mx:State>
</mx:states>


<ma:A id="a" label="LabelA" />
<ma:B id="b" label="LabelB" />
<ma:C id="c" label="LabelC" />
</mx:ViewStack>

In der main-Application änder ich den currentState. Hab das au schon getestet, es funktioniert nur - wenn ich mit RemoveChild das erste entferne. Also bei dem Beispiel das <ma:A ... />

Gibts da irgendwas grundlegendes was ich da total falsch mach?
Google auch schon seit Tagen nach dem Problem - komm nich dahinter.
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #1 on: 03/26/09, 09:34 »

Hi entenknochen

This is an english Board, please translate your question or try in a german Board

Jorge
Logged

entenknochen
Server what's that
*
Posts: 3


View Profile Email
« Reply #2 on: 03/26/09, 11:38 »

oops. I'm sorry.

I have a problem with view states inside of a ViewStack component.

I created a component like in the code on my last post.
Then i created different view-states for different users. And it works to remove any child of the viewstack component.

But if reset the viewstate with currentState=""; then i get this 'wonderful' error message:
Error: Multiple sets of visual children have been specified for this component (base component definition and derived component definition).

Every google search took me to totally different problems. But none for my case.


I tried one thing, that worked.
If i remove the first child of the viewstack, and then reset the currentState - it works perfect!

Is there any general mistake in my code ? Or is this a bug ?

I can't explain.
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #3 on: 03/26/09, 12:58 »

Since the component should initialize properly prior to move to states, I recomend to use the creationComplete event to move to the desired state, this way you're sure all neccesary stuff is in place, moving prior to that could end in a return to an element that never was rendered

Jorge
Logged

entenknochen
Server what's that
*
Posts: 3


View Profile Email
« Reply #4 on: 03/30/09, 06:03 »

Alright, thank you.

Found out that the creationPolicy can be changed.
Changed it to  creationPolicy="all" an now it works.
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #5 on: 03/30/09, 06:44 »

Yep, this is the easy way of solving access to not rendered elements on viewstacks and states ... anyway, take into account that rendering all your stuff takes time to intialize, and in big projects could be a penalty over performance

Jorge
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!