Actionscript 3 :: How To Fast Reorder Child Elements In Flex 4
Nov 30, 2010
I have a control which contains many child elements (about 1000), and I need to sort them.Now I doing that like this:
_elements.sortOn(...);
for (var i: int = 0; i < _elements.length; i++) {
setItemIndex(_childItems[_elements[i].id], i);
}
_childElement - object that contains UI-child elements, which i need to sort (key of the dictionary is an identifier from data-object
_elements - array contains data-objects
But this is too slow! How to reorder the childs by my criteria as fast as possible?
View 1 Replies
Similar Posts:
Oct 17, 2009
Anyone know how to animate the size/position of child elements of a layout in Flex 4 ?
I have a list component with a custom layout. I want when I change the positions of the child elements I want them to animate their move to the new positions.
View 2 Replies
Mar 4, 2011
I'm working on a simple task/calendar tool where tasks can be added dynamically to a canvas. Here is the main application as defined in Main.mxml, which is essentially just a Canvas and a button for adding a task:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Canvas id="MainCanvas" borderStyle="solid" width="300" height="300">
[Code].....
The problem is that when I add a Task instance to the Canvas, the children (the button and label) don't appear. I tried setting creationPolicy="all" on both the Canvas and the BorderContainer, but it still didn't work. I've read a bunch of posts about people having issues accessing members of their class before the class is fully loading, but all I want to do is SEE that Label and Button show up inside the BorderContainer.
View 2 Replies
Sep 9, 2011
I have a Hdividedbox, which has three child elements.
I want to set the initial ration of sizes, such that the first one is 30%, the second is 40% & the third is 30% of the Hdividedbox's width.
View 2 Replies
Apr 6, 2012
I am unable to find if the spark DataGrid supports moving / reordering the columns. If not what could be the best solution? Maybe using the mx version?
I want the user to be able to drag the columns and arrange them.
View 2 Replies
Jun 16, 2009
I have a Flex List which is databound to a Array. My problem is that when I reorder the List using the built in dragMoveEnabled, the values are reset to the original values.I assume I need to somehow do a two-way databinding but I am not sure how.
<mx:List width="100%" top="20" id="uiItemList" dragMoveEnabled="true" bottom="0"
dragEnabled="true" dropEnabled="true"
dataProvider="{listArray}" >
<mx:itemRenderer>
[code]....
View 2 Replies
Sep 12, 2009
is it possible to make the child elements of a vbox to occupy 100% of the width without indicating width=100% for each element ?
View 3 Replies
May 19, 2009
I have an XML file that I have imported into an ArrayCollection. I can get all child elements of the XML (ArrayCollection), but can't for the life of me get to the attribute. Where does the array collection put it?
View 2 Replies
Jul 9, 2009
I have a movieclip, with the instance name SizingBox, on the main timeline. Within that mc, I have a Slider component, with the instance name Sizer. I want to declare an action listener on the main timeline which will listen to changes for Sizer and do something based on the current value of the slider.In AS2 this was really easy, but I cannot seem to figure it out for AS3.
Code:
var X = SizingBox.Sizer.value;
this code gives an error.
[code]......
View 0 Replies
May 14, 2010
I am trying to develeop a Graph Structure with drag and drop features in Flex. I have to connect various components/children on the canvas. Once i drag n drop the components on the canvas, i am using SystemManager event handlers to draw connectors between the components. But, as i click on one component and drag the mouse, the line is drawn on the canvas as long as my mouse stays only on the canvas. If the mouse moves over a component/child(that has been dragged and dropped onto the canvas), the line is drawn to the origin of the canvas from the first clicked component. How shud i recognize the component when i move my mouse over the component? I want the line to be drawn connecting the components once my mouseup event is called.
View 3 Replies
Oct 11, 2010
Ok every time I think I understand the DisplayObject model i find something else that seems like it should work but fails. Am I correct that if I create a sprite then create another sprite and add it as a child the original parent sprite will show a height of 0... In my case i have three classes that all extend Sprite and each one is creating the next with the "youngest child" being a class that adds an image to its "stage". I can see the image height fine but its holder does not nor does its holders parent... im having a real moment here as I debate if im just stupid and missing the obvious way to do this or if I really have to add a bunch of getters and setters to see the height that includes children.Maybe I am thinking of this too much like a CSS block element but it just seems like it should work this way...for example
parent "holder" <- child "slide" <- child "image"
holder.height == 0
slide.height == 0
[code].....
View 2 Replies
Dec 12, 2006
I have the following XML structure:
[Code]...
This will parse child elements of the <text-block> but will not work with <ul> as it has its own child elements <li>. I guess this could be accomplished with yet another loop but I wanted to check to see if there was another simpler way.
View 2 Replies
Jun 23, 2010
I'm building a portfolio site and I've renamed the secenes and reordered them but when I test the movie it defaults to what was originally scene 1. I'm working in AS2. If the mods will allow the web site is [URL]. There is an intro page which was scene 6 which is now renamed "intro" and draggd to the top of the pile but it doesnt show when I preview or upload.
View 2 Replies
Nov 21, 2010
I'm using the following code to load XML directly into a datagrid:
import flash.events.Event;
import fl.data.DataProvider;
import flash.net.URLRequest;[code]....
How can I reorder my columns based on the title?
EDIT:My XML looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<contacts>
<contact first="Moshe" last="Doe" address="555 5th St" city="Somwhere" state="AA" zip="555555" phone="555-555-5555" />[code].....
View 1 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
Apr 10, 2007
I am trying to write a function that is passed an array and will then reorder it randomly and return the array. My problem is that as the position is generated randomly I dont know how long the loop must run for, this function doesn't work but it should give you an idea of what I'm trying to do:
[AS]
function randomise(the_ar:Array):Array {
var ret_ar:Array = new Array();
for (i=0; i<200; i++) {
[code]....
View 3 Replies
May 8, 2008
I am loading a master XML file and then trying to break it down into sections
Here's my XML file:
Code:
<listarray>
<items>
<entry type="ecard" num="2">
[Code]....
So I was able to create a new array that contains only entries with the attribute "ecard" in them, but now I want to re-order that array into numerical order based on the attribute "num" so that it lists as Ecard 1, Ecard 2, Ecard 3 in the XML. How would I go about re-ordering the new array I've created?
View 6 Replies
Mar 12, 2005
I have 2 arrays that contain the same values but in a different order. i'd like to reorder the first array like the second one but i have no ideas how to do that easily.
View 2 Replies
Apr 1, 2009
Problem is that my rewind and fast forward buttons do not work properly in the sense that they start to mess up when you fast forward or rewind past the current scene. It seems to just skip through the whole movie and totally mess up the animation.the code for the controls is on a single layer and reads as the following:
stop();
play_btn.onRelease = function (){
play();
[code].....
View 4 Replies
Aug 23, 2010
i have problem with swfLoader in flex, when i close following code in click method i can easly add many swf to main application
<mx:VBox id="content" width="100%" height="100%" ></mx:VBox>
public function doIT():void
{[code]....
when i close adding those swfs in loop i have the same error, it looks like child apps couldn't access certain objects that were instantiated by another child app, so what can i do?
View 1 Replies
Mar 10, 2010
var viewStack:ViewStack = new ViewStack();
viewStack.percentWidth = 100;
viewStack.percentHeight = 100;
[Code]....
Its only displaying canVas3 contents not canVas1 and canVas2
View 1 Replies
May 10, 2010
I have a component mxml file in which i have a view stack, on click of a button i navigate to the first child, now i need to navigate to the second child during onclick of a button present in the second child. All the childs are component files included within the view stack. How could this be done, Sample code is present below,
[code]...
Now in my offering.mxml file if i try to access navigationViewStack i am getting an error stating 'Access of undefined property navigationViewStack.
View 3 Replies
Dec 16, 2010
I have an Movie Clip in Flash that have subobject of button type which has subobject of input text and movie clips. Right after creation core Moveclip all subobject are set to null, when I expect them to be valid objects.
[Code]...
MC_Core_design was created in Flash and exported to Actionscript. I've done this for button_1 class aswell. The code was written using Flex. When I comment out both lines that result in error I get correct view of the core Movie clip with all subobject. How can I set subobject properties right after object creation?
View 2 Replies
Sep 19, 2011
I have the following situation: have a screen with 4 charts, each being populated with 59 array collections. Each array collection has 2000+ data points. This construct needs to be filtered(by time), but the problem I'm encountering is the fact that it takes a long time for the filtering to finish (which is to expected given the amount of data points that need to filtered).
Filtering one chart at a time is not option, so I wanted to ask you what do you think would be the best approach? (should I use vector instead?). To generalize this question what would be the best way to filter large collections in flex/as3?
View 4 Replies
Nov 22, 2010
how to reorder my Array by the Z coordinate now I want to add an event to animate it. I want my shapes to move from their position on the stage out of vision with the vanishing point at the bottom of the stage. I hope this makes sense its kind of hard to explain but heres the code I have to reorder my array by Z.
Code:
package {
import flash.display.Sprite;
import flash.events.Event;
[code]....
View 0 Replies
Aug 10, 2009
I am making a horizontal list that I want to be able to drag each item around to reorder the list. When one clip is dragged over another I want the one under it to move left or right to fill in the empty space left by the clip being dragged. I cannot seem to figure out how to tell which movieclip is touching or "under" the movieclip currently being dragged around. It seems that the hitTestObject method need explicity instance names to work. In summary, I want to know the instance name of any display object that the dragging moveclip touches.
View 1 Replies
Jan 13, 2011
I need to resize images in actionscript maintaining the quality aka bicubic or bilinear resizing. At the moment my algorithm just loops through every single pixel and calculates the new pixel. example:
[Code].....
This is really slow and shamefully there is no multi-threading in the flash player, so I was wondering what tricks I can use to speed things up?
View 1 Replies
Jun 25, 2010
I have a parent and 2 children. I am trying to pass data from child1 to child2 but keep getting an error message: 1061: Call to a possibly undefined method through a reference with a static type.
In child1 I have the following code:
[Bindable]
public var TestVar:String='sometext';
In child2 I am trying to get the value of TestVar and then use it as a value to search a mysql database via php.:
var newTestVar:String = child1.TestVar;
if(newTestVar != null){
getResult.token = someService.get_filtered_Paged(newTestVar);
[Code].....
View 4 Replies
Jan 17, 2010
I am having difficulty getting a reference to elements added after compile-time using the 'id' property. I have seen a few forum topics suggesting that this isn't possible, and that getting a reference to elements added this way is trickier, but never just exactly what that trick is. This code throws a fun little: Error: uncaught exception: Error calling method on NPObject! [plugin exception: "ReferenceError: Error #1069: Property canvas_tentpoles_0 not found on SGraph and there is no default value."].
[Code]...
View 2 Replies
Jan 26, 2010
Is it generally to position elements relative to other elements or in absolute values?
View 2 Replies