Actionscript 3 :: Constraining Number Of Children In A ViewStack ?
Mar 7, 2012
I have the following code to create a ViewStack which is used as a dataprovider for a TabBar:
<s:TabBar id="objectTab" dataProvider="{vs_objects}"/>
<mx:ViewStack id="vs_objects" width="100%" />
I want to constrain the number of children the ViewStack to avvoid the tabs going out of the screen when the user opens many tabs without closing any. I attempt to do this by removing the oldest element in the ViewStack when the user opens a new tab and the size of the ViewStack is above 9.
private function openTab(object:Object): void {
//Create a new NavigatorContent(form) and add it to the ViewStack[code].........
The image below illustrates my problem, where the dark grey color illustrates the selected Tab. There should only be one selected tab, which works perfectly fine with both the child selection approaches above, when i don't remove a child before selecting a new. When i remove a child and then open a new Tab, the new Tab does not get selected properly, it only gets "painted" in the selected color. In This case Tab 40 is still shown when i open Tab 41 (exceeding 9 tabs). The result of this issue is that Tab 41 is not rendered completely.
UPDATE: The problem was my AS3 code inside the childrens NavigatorContent's that caused the application to behave this way. The solution was using the callLater method:Doric's
code example:
protected function openTab():void
{
var form:Container = new Container();[code]............
View 1 Replies
Similar Posts:
Sep 30, 2011
I have a ViewStack which is dataProvider for a TabBar. There are two VBoxs as children for this ViewStack. It works fine with absolute values for width and height for these VBoxs, but when specified in percentages, the VBox uses all the available space (100%) for any percentage value. find the code and screen shots below.
how can children of a ViewStack be aligned to center? There is no horizontalAlign property for ViewStack and it is not working with horizontalCenter= "0".
Code:
<mx:ViewStack id="viewStack" width="100%" height="100%" selectedIndex="0" horizontalCenter="0" textAlign="center">
<mx:VBox label="Tab 1" width="25%" height="10%" borderThickness="2" borderColor="red"
[Code]....
View 2 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
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
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
Apr 23, 2012
I would like to do a simple check when I load an XML file for the most number of characters of children nodes. In other words, if any child node contains more than 50 characters I want to to configure stage objects differently.[code]
View 2 Replies
Jan 8, 2007
I've seen plenty of articles on AS3 for doing this, but is there _any_ way of doing this in AS2? I've need to loop through every child mc within several other mc's and change their colour... but cannot find any way of doing it (or anything confirming it can't be done!).
View 1 Replies
Sep 2, 2010
At the moment, I came across this problem where I have to work with many swf files.The problem is I'm using addChild() & loader to navigate between each swf. It doesn't seem to be a problem at first, but after numerous times of clicking back and forth, the flash player starts running slow.So I've came to a conclusion that eventhough new swf are added every time I clicked, but the parent swf still remained at the back which is overlapped by the child.
View 1 Replies
Nov 18, 2009
I'm making a OSX-finder-type file browser in CS4.The Structure for the folder and files is being generated by a PHP in a XML, heres an example:(sorry the xml is not sorted, but the command i'm using in php doesn't sort it)
Code:
<root>
<dir name="images">
[code]....
View 2 Replies
Jul 15, 2009
I've got a problem with containing properly the .swf on my (main menu) site. Because the external .SWF's got a parralax effect it overlaps the swf above also the .swf is not nicely stretched out. This is the effect on my site that I want www.seniorict.com but as you look at the zip/fla(menu test) you see the complete file and how the effects are not working well.
[code]...
View 1 Replies
Apr 8, 2011
I've got a problem with containing properly the .swf on my (main menu) site. Because the external .SWF's got a parralax effect it overlaps the swf above also the .swf is not nicely stretched out. This is the effect on my site that I want www.seniorict.com but as you look at the zip/fla(menu test) you see the complete file and how the effects are not working well.
code is
PHP Code:
stop();
var swfs:Array = new Array("home", "kandidaten", "opdrachtgevers", "contact");
var loaders:Array = new Array();
[code]....
View 2 Replies
Aug 16, 2010
I am using the following code on the main timeline
Mouse.hide();
target.onMouseMove = function() {
this._x = _xmouse;
[Code]....
And on the movie clip (target) that i am using for the custom pointer, i've put
onClipEvent (load) {
startDrag(true);
}
How can i constrain the pointer to an area of lets say 800x600 ?
View 2 Replies
Oct 12, 2011
I'm doing liquid layouts, and resizing my images while constraining proportions. Here is the code I'm using:
Code:
image.y = (stage.stageHeight/2) - (image.height/2)
resizeMe(image, stage.stageWidth, stage.stageHeight);
//The resizing function
[Code].....
I want it to resize and totally centre itself in the middle of the screen. HOWEVER. I also want to nudge it down 100px, and THEN resize it. I'm having no luck with this though I can move it down 100 px, but then it resizes and positions itself as though it was still in the centre.
View 6 Replies
May 5, 2006
I am interested in rotating an object around a central pivot point, on command from two buttons (a + button, and a - button).
This file would essencially be a clock hand, or dot representing the hand, being rotated either clockwise or counter clockwise manually by a plus and minus button.
Things I am unclear about:
1) what forms of syntax, variables, etc, would I need to accomplish this task? I am unclear about the proper protocol for setting up this movement.
2) I have a specific background graphic that all this will be happing on top of, how do I find the desired pivot point coordinates (i am assuming the pivot point is defined by an x and y) in relation to my background graphic?
View 1 Replies
Jun 12, 2009
I have a split screen view with a large image above and a smaller image underneath.There is a zoom window over the smaller image that when dragged around shows the larger image above it being moved at the same time (just that it's bigger uptop)
anyways I can't seem to constrain the movement of the smaller movie clip ... right now you can just click and drag it all over the place ... and I'll like for it to stay dragable only over top of the smaller image...and here is the code in the root.
// The base_mag_factor is the correlation of the small picture to the big picture...
_root.base_mag_factor = 5;
// The mag_factor will change as scaling occurs
_root.mag_factor = _root.base_mag_factor;
[code].....
View 1 Replies
Sep 27, 2010
I want to create a MovieClip symbol of a certain width and height, but with content that extends outside its boundaries, with the option to have the external content be clipped/hidden or visible.
In Flex, the solution would be to create a group with .clipAndEnableScrolling = true.
Is there a way to do this in Flash CS5, or will the symbol always resolve to the size of its contents?
View 2 Replies
Apr 23, 2008
I'm working on a volume slider for a type of jukebox and what I'm using is an actual drawing that is on an angle, therefore the volume slider and handle aren't in a straight horizontal line.I've done the basic code to keep the handle within the distance of my slider "line" (left to right), but what I have obviously just constrains it to a rectangle.
on(press){
this.startDrag(false,0,0,32,9);
}
on(release){
this.stopDrag();
}
The slider and handle are both at actual size, that's why it's only 32 pixels wide that I need it to go across and 9 pixels down. I do realize that for what I want, it's much more involved than this simple startDrag code with 4 sets of numbers in it.I'm including the source file in Flash 8/Actionscript 2.0.
View 3 Replies
Jun 29, 2009
I need to know if there is any way to constrain the mouse movements on a startDrag to a line that is not going vertically or horizontally. I'm sure I'll need to use some trig functions, and that's fine, I just haven't been able to find this done anywhere else.
View 4 Replies
Dec 30, 2011
how can i constrain the dragging of my movieClip inside the shape of a trapezoid? here's the code..
Code:
pamato.onPress = function()
{
startDrag(this, false, 1000, 270, 130, 605);[code]....
when i test the movie.. its a rectangle..
View 9 Replies
Jun 21, 2011
Basically, I have a custom "scrub bar" graphic in which the user can drag a slider forward or backward in time to scrub/seek to a certain point in an external F4V.I have my slider constrained by a rectangle of 1 pixel in height. But when I click with mouse to scrub, my mouse cursor tends to move off of the slider graphic, causing problems with my MOUSE_UP event. (It can't trigger when my mouse is not over the target object).Is there a way like "new Rectangle(32,713,944.1)" to keep the mouse from moving in the Y-axis as the user drags the slider left and right to scrub video?
View 3 Replies
Jan 18, 2009
I'm making a fluid full browser flash site, and things are coming together nicely, but at some point, if the stage size gets too small (such as if someone is using a 800x600 resolution), things just don't look right. Things get all smooshed together and cause for a cluttered mess. To solve this, I put constraints on my stageResize function so the stage would only shrink down to a desired size. This worked great for the flash file, but I can't get the browser to add scroll bars are this point. I figured I would need a JavaScript file that would size the browser (or the div that contains the swf) and then constrain it as needed, but after digging around a few sites that perform the way I would like mine to, I am not seeing any such JavaScript files.
Example: [URL]
View 14 Replies
Mar 24, 2009
In this game attached I need the old Children (rats) to hurt the character when he walks into them, however only the most recently added Child is active in that way... also the rats seem to appear above the character instead of below, is there any way to resolve these issues??
View 4 Replies
Jan 12, 2011
I have a Sprite called pageContent. Inside pageContent are 12 more Sprites with unique names, a couple of Buttons, and some TextFields. Inside each of the 12 Sprites I have either one or two TextFields and one TextInput. My question is, since they are children inside a child of pageContent, how can I access them? Here is how I am trying to do it:
[Code]...
In my mind, this should totally work. But surprise, surprise, it doesn't. I have debugged it and it works fine for the first two lines, but when it tries to get numChildren of a Child of pageContent (line 3), I get this error: PHP Code: 1119: Access of possibly undefined property numChildren through a reference with static type flash.display:DisplayObject.
View 4 Replies
Jan 11, 2010
I want to have a rollover effect of a movieclip (mo1) inside a movieclip (mo) of another movieclip (popup1).Is it possible to do that? I try calling it using this code in the frame 1 of my flash, am i doing wrongly?
Code:
popup1.mo.mo1.onRollOver = function() {
popup1.mo.mo1.gotoAndStop(2);
[code]......
View 9 Replies
Sep 23, 2006
Newbie to XML here and I have what I *hope* is an easy problem, but I just don't know the answer. And as I have to try and show this by Monday, I'm sort of stuck. I am trying to pull in information about houses via an xml file. Each house has 1 address, 1 owner, 1 description, and about 6 photos. I have no problem accessing the address, owner, etc, and I can always access the first photo, but whenever I cycle through the photos, I seem to cycle through the first photo for every house, not every photo for each house.
Basically, I need the children <images> to go up by one, without the the parent going up by 1. I am hoping I am describing this well. My code looks like this:
[Code]...
View 4 Replies
Mar 10, 2010
I have a Canvas which has many components inside it and those again, have many components inside them.
getChildren() returns only the top level children. What is the best way to retrieve all the children (children of children of children and so on).
Well, I sorta know how to do this by iterating through the children, but the code is really messy. I'd prefer to use a nice recursive function. Has anyone written this before? Or is there a Util class to do this?
View 3 Replies
Jul 24, 2010
I am trying to pull in information about houses via an xmlfile. Each house has 1 address, 1 owner, 1 description, and about 6photos. I have no problem accessing the address, owner, etc, and Ican always access the first photo, but whenever I cycle through thephotos, I seem to cycle through the first photo for every house,not every photo for each house.Basically, I need the children <images> to go up byone, without the the parent going up by 1. I am hoping I amdescribing this well.My code looks like this:
total = xmlNode.childNodes.length;
totalb =
xmlNode.childNodes[0].childNodes[5].childNodes.length;
[code].....
View 1 Replies
Oct 28, 2011
I have an ArrayCollection that is read to generate containers in an accordion programmatically:
<s:ArrayCollection id="_ac_ps">
<fx:Object label="Block and lot" data="_blocklot" searchType="districtblocklot"
info="" />
[code].......
View 1 Replies
Jan 11, 2011
for some reason STORAGE[0].getChildAt(0) works whereas liner.getChildAt(0).getChildAt(0) does not. STORAGE is a movieclip and a child of liner. the error is something about not being able to use getChildAt on a display object. what's wrong? is there any other approach i could use? PS: liner.getChildAt(0) works and does indeed seem to refer to STORAGE[0]
View 2 Replies
Jul 16, 2009
Dear Guys I Want To Generate A Random Number Between 2 Number BUT Without Generating 2 Same Number I Mean If For Example Already Generated Number "2" Next Time Did Not Generate It , Is There Any Solution
View 5 Replies