Flex :: Elements - Loop Over Children Of A Container When They Are State-dependent?
Aug 17, 2011
Flex's new States re-parents visual items that are marked with includeIn/excludeFrom. If I have a Group (MainGroup) with 5 children/elements that are state controlled, is there still a way to get a reference to MainGroup's children? mainGroup.numChildren and mainGroup.numElements don't work since the children are re-parented. At best, they show 1.
<s:states>
<s:State name="view1State" />
<s:State name="view2State" />
<s:State name="view3State" />
[code]....
View 4 Replies
Similar Posts:
Jan 27, 2010
I want to fade all the elements of the next state when transitioning from any state.I tried different things but I can't get it to work. And I don't want to manually add transitions for every state.
Something like:
<s:Transition fromState="*" toState="*">
<s:Fade target="*" duration="500" />
</s:Transition>
View 2 Replies
Mar 25, 2010
In my view I have a welcome screen:
[Code]...
Which is a pretty small component and I have panelContainer:
[Code]...
Whilst the user is reading the warm and fuzzy welcome note in the welcome state I want to be creating the big expensive panels state so taht when we switch there is no delay. Before the panels state is set panelView is null but I presume there must be an IDefferredInstance floating around somewhere that I can use to kick off the creation of the view. How can I get hold of it?
View 1 Replies
Jan 27, 2010
I'm currently working on a custom component which extends Canvas (let's call it SuperCanvas) ; it's basically a container that let you zoom & pan its contents. It would be too long to explain why, but I can't use scrollRect, so I was forced to declare a Canvas object (called innerCanvas)... inside my SuperCanvas (I know, not very nice =/) I would like to know if there's a proper way to "redirect" the creation of my component's children in this canvas.
[Code]...
View 1 Replies
Feb 17, 2010
Does anyone know if its possible to access children elements in a SWC? I have created some MC's and inside of some of these MC's I have some dynamic textFields. I export the content to a SWC and load it into my Flex project. No problem loading it or accessing the parent elements, they display fine. But I want to access the textfields nestes in the MC's and modify the text. When I debug the app, I can see the textfields as child elements. It's typed as a TextField and the Instance Name is the same as input in the Flash IDE but I cannot access it. When Flex compiles it throws an error saying it doesn't recognize the method. I've tried to insert actionscript on the timeline, linked external classes and nothing can be accessed.
View 3 Replies
Jul 11, 2011
I want to list all controls (buttons, datagrids, etc) in a container
This works but gives me a warning 1008: variable 'comp' has no type declaration.
for (var i:int = 0;i<this.numElements;i++)
{
var comp = this.getElementAt(i);
[Code]....
when I get a compiler warning it's because I'm not doing something the way it is supposed to be.
Are there any alternatives to reference the id property? A method I'm missing even a whole different way iterate through all the controls?
View 3 Replies
Sep 1, 2011
Given this XML code:[code]I can count the total number of game elements in the XML.game with:[code]Is there please some way to print the number of all game elements having the exact number of 3 user children? And also count all such elements with less than 3 user children?[code]The backgound is, that I have a Flex game, where up to 3 players can sit at a playing table and I'm trying to display the number of All, Vacant and Full playing tables there (the top left row with RadioButtons, sorry for the non-English language):I'm reading the XMLList doc, but don't see how to do it with one-liners, I only can see how to do it with loops...
View 1 Replies
May 14, 2010
I'm using as container for my LinkButtons. I would like to know
1) How can I remove the space between the items in my Tile container.
2) How can I set dynamic width for my items (at the moment they all have the same width regardless the width of the included component)
3) How can I avoid to display scrollbars if the items are not included in the container
View 1 Replies
Aug 9, 2010
If I have a container, and I set clipContent to true, how do I get the total height of the children inside it? Is there a method for doing this without itinerating through every child and summing the heights?
View 1 Replies
Sep 17, 2010
I have a viewstack with childrens which I want to show/hide depending on the state the application is
[Code]...
AS you can see I inlude the retail customer view in the retail state and the wholesale customer view in the wholesale state. The problem is that when I run my app they don't appear on neither state.
View 1 Replies
Oct 5, 2010
I'm using an accordion container that has it's creation policy set to auto. One of the accordion's children is a spark border container that has a data grid within it. Currently, I'm using the data grid's creationComplete property to call a function; similarly, I'm using the dragComplete property to call another function.
How can I add listeners for events (creationComplete & dragComplete) via actionscript? The obvious problem is that the accordion does not create all its children on creation (nor do I want it to), so I can't simply use something like: datagrid.addEventListener(...)
View 1 Replies
Mar 30, 2011
I have a VBox inside a Canvas. The 'red bars' are custom components based on 'Canvas'. All red bars are of equal height. I have 20 red bars inside the VBox. The scrollbars visible in the screenshot are the Canvas's scrollbars. The scrollbars of the VBox are disabled using verticalScrollPolicy = off.
Without scrolling, only 16 red bars (and a part of the 17th bar) are visible. However, when I scroll down the Canvas I expect to see the remaining red bars - but the bars that are not visible when the application starts don't get 'drawn'. What am I doing wrong? I want the user to be able to see the 17th - 20th bars when the Canvas is scrolled down.
View 1 Replies
Feb 11, 2010
Is there an easy way to make a parent container (eg Group) resize when it's children resize?
Below is a little example app. When I put the 200x200 'food' in the 'stomach' the stomach & it's containing 100x100 'body' should resize to contain the food.
[URL]
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
[Code]....
View 2 Replies
Mar 18, 2010
If I've got a Container with a child component that is off either the top or the left hand side:
Is there any way to get scroll bars to show up? ie, so I can scroll up and get the button back in view, the same way I could if the button was off the bottom right side?
View 1 Replies
May 13, 2011
I have code like the following:
<s:VGroup gap="10" id="group" height="100%">
<s:Label text="This is page 2" />
<s:Button content="Resize Canvas" click="resize(event);"/>
<mx:Canvas id="photoCanvas" color="#567898" backgroundColor="#125567">
</mx:Canvas>
</s:VGroup>
I don't understand why the following does not work:
Pushing the Button resizes the photoCanvas's height (gets taller or smaller). Since the photoCanvas control is a child element of the VGroup shouldn't the container update itself to the new height? The Vgroup has ALWAYS the same height, no matter what the (total) height of the children is! I would like the VGroup to adjust itself and get a height value equal to the sum of its children heights. Is this not possible??
View 1 Replies
Feb 21, 2012
I need to resize a Group using myGroup.height = 0. And it works, but myGroup's children are still visible, I do not know why...
View 1 Replies
Feb 24, 2011
I have a custom component extending Group and containing a viewstack child. The component is coded in actionscript.
When instantiating the component in mxml like so:
<components:CustomGroup width="100%" height="100%">
<mx:HBox backgroundColor="0xDDFF11" width="100%" height="100%" />
<mx:HBox backgroundColor="0x22DD63" width="100%" height="100%"/>
</components:CustomGroup>
...I would like to override whatever function that adds the children to the parent Group and add them to the child viewstack instead but I can't seem to find where the adding occurs. Breakpoints in addChild and addElement shows that they are not called during the add.
View 2 Replies
Nov 13, 2009
I am using a GroupingCollection to bind my advanceddatagrid. I have used groupingcollection to group the data by date.
Now I need to select the data in the datagrid through the code. I need to loop through the adg's dataprovider and select the item that matches the criteria for the selection.
View 2 Replies
Jul 12, 2011
I have a little trouble in managing the children my container. The fact is that it has a lot of children and their y coordinates are very random.
Is there anyway i can order them by y coordinates that the lower will be in the front and the higher with be in the back?
is it something that that I can do with 2 "for"?
View 3 Replies
Oct 2, 2008
Well I'm starting to really enjoy AS3, my next question then is this: In AS2 I'd often remove all movieclips with something like this:
PHP Code:
for(var i: String in container) {
container[i].removeMovieClip();
}
Is there something similar in AS3 that I can do without resorting to maintaining an array of references to each child of my container?
View 4 Replies
Jul 12, 2011
I have a little trouble in managing the children my container. The fact is that it has a lot of children and their y coordinates are very random.
Is there anyway i can order them by y coordinates that the lower will be in the front and the higher with be in the back?
View 2 Replies
Jan 19, 2011
I'm building a Flex/AIR application that connects to a remote server, the URL of which changes depending on the environment (development/production, and possibly others). For now, this URL parameter is hardcoded in my root application MXML file but it means I have to change it everytime I build my app for a different environment.Is there a way to externalize such a parameter so that when Flash Builder automatically builds my app (in development mode), it uses the development URL
View 1 Replies
Oct 5, 2009
I am having trouble determining where to add my removeChild() statement to clear multiple movieClips from a container mc. I know I need to determine if the container movieclip contains anything. I don't know how or what I should put and where to put it. If I can determine if my container mc has movies in it, I am assuming I can just declare it again (i.e
PHP Code:
panel= new MovieClip();
)to clear it. Am I correct?
[code].....
View 6 Replies
Feb 9, 2009
At one point in my script I'd like to check a MC for the number of children and limit this number to 3. For that I use this script:
Code:
if (container.numChildren > 3){
for (i = container.numChildren; i > 3; i--){
container.removeChild(container.getChildAt(i-1));
popError('Horizontal nur 3 Elemente!');
}
}
This somehow works fine if there are 4 or 5 children in the MovieClip, but as soon as there are 6 or more, it throws an Argument Error #2025 and does not remove anything. BTW it does not make difference if I use container.removeChildAt(i-1);
View 2 Replies
Mar 24, 2009
i'm getting the #1010 error... code below:
Code:
var curProject:int = 0;
var curExample:int = 0;
var container:MovieClip = new MovieClip();
im.addChild(container);
[Code]....
View 1 Replies
Jul 20, 2010
I used the following to add an external .swf:
[Code]...
it worked as I wished - by placing the swf under all other elements on the timeline via the addChildAt being 0. I now need to add another external .swf (over the top of the one I just brought in) and was expecting by using:
[Code]...
it would place it above the other .swf but in fact, it places it under one element of it.
should this be the case of is there a different way to do what I wish to?
View 1 Replies
Mar 20, 2010
I can't come up with a function that will collect the names of the children in a object container and put them in a array.
View 4 Replies
Jul 5, 2011
is it possible to retrieve all children of a certain type from a parent in actionscript 3? i only see getChildAt,getChildByName, is there a getchild of a certain type like get all childs of object type:Food?
View 2 Replies
Jun 22, 2009
How do I remove all children from a display object container? I want to make sure that when I re-enter a particular frame that there are no imageLoaders loaded into my photoGallery.
View 2 Replies
Jan 15, 2010
What's the best way to scale a container mc but not scale the children inside it? Basically I have a box mc with a background colour, with a logo added using addChild, if the user changes the browser size the box scales to the height of the window but it's also scaling the logo, I just want to change the height of the container box really.
View 4 Replies