ActionScript 3.0 :: Dynamically Add Component - Flex Did Not Reserve Space For List To Display
Jul 21, 2009
Here is part of my code in short:
[Code]....
I realized that if I do addChild, I can't really see the dynamically added component, since flex did not reserve space for my List to display. So I do parentDocument.addChild, and then it appears no problem. My question is since it's being added in the parentDocument, so it is suppose to be a component belong to parentDocument, so is that component still be able to call this handleMouseDown? From my experience, it's still able to, but which doesn't make sense to me. Can someone explain a little about why it can still work, or any better approach other than parentDocument.addChild
Is there a way display the display list in the Tree component. I could parse the display list into xml but then I would not be able to create a reference to the display object.
I've created a component which is basically a meter (extends skinnable container). The skin to the component contains two rectangles (background and the actual meter). This component receives an arraycollection with the following fields value, max and min(the arraycollection I am passing is Bindable). When I initialize and pass the data to be used to draw It works great (keep in mind - only works the first time). I've created a button that changes the data array and shows the current meter value. Apparently the meter's value is changing everytime I modify the ArrayCollection I've set to be used for rendering.(dont want to say "dataProvider" because it is not a Flex dataprovider, just a variable )... here is the code...
public class meter extends SkinnableContainer { [SkinPart( required = "true" )] public var meter:spark.primitives.Rect;
I have an arrayCollection of objects that extend Sprite, and have bitmaps within them. I want to display these in a list (or some other component that would allow a user to scroll through them, and see their associated data.)
When I do: myList.dataProvider = myArrayCollection
the list just shows a bunch of lines of [Object, Item] instead of the visual sprites.
Here is a simplified version of my Object:
public class myUIC extends UIComponent
[Code]...
Tried many different ways to get it to show up in a List, but can't do it.
I need a List that resizes to exactly fit its content, unless that height exceeds its (dynamically sized) parent container. My requirements are as follows:
The component extends List, or at least acts similarly. variableRowHeight and wordWrap both equal to true. The height of the list cannot be less than minHeight (roughly 32px for scrollbar arrows). The height of the list cannot be greater than the height of the parent container .
Note that the parent container can be resized dynamically.
The height of the list should be updated as the size of both the contents and parent container changes.
Live updating would be preferable but not necessary.
There should be no scrollbars if the content height is less than the parent container height (sounds obvious, but I've had trouble with this too).
The trouble is that with variableRowHeight and wordWrap, it's very hard to know the size of the content at any given time. If the parent container's width is reduced, a line wrap may occur in the list which will change the height of the content. I know I can measure the height of the list content using measureHeightOfItems() + viewMetrics.top + viewMetrics.bottom, but when should I calculate that? What events should I listen for? And the thing I've had the most trouble with - when should I calculate it to set the size initially (i.e. just as the content has finished populating)?
Creating a list menu with the help of components library is simple. But how can one create a list menu which will be added dynamically? In the sense that I need the list menu to be populated with data from an external XML. All this has to be done at runtime. I cannot drag and drop a list component onto the stage.
I am overlooking something, but why won't my FLVPlayback component, which is in my library, be added to the display list? When the code executes, there is now FLV component on stage.[code]...
I am trying to read a XML file and display its content in a simple list component or at the console. The problem is that the event listener is triggered in an infinite loop.
The code:
var myXML:XML; var myLoader:URLLoader = new URLLoader(); myLoader.addEventListener(Event.COMPLETE, processXML);
I'm building a top view 2D map, that it's objects are stored on the server.The kind of objects are 10 and might be a photo, label, button, lists, mix of them or labels with tooltips.The component must request the "areas" that are missing on screen.An area is 1000x1000 px and is cached in flex.To move in the map, will be like in google maps (drag-and-drop).I should be able to have another list and move objects from one to another using drag-an-drop on objects. Ex.: I grab an objects from a list and I move it on this map, I release the mouse button and the item is placed there.Now the problem is: I build a custom component for this trying to emulate the item renderer for performance and recyclage, implement drag-and-drop on objects and request the areas that are missing?
or
I extend the List component from spark and I add some features as multiple kind of itemrenderers and use recycle on them. Of course it must be able to request the missing areas on the screen and cache it's data.Maybe create a custom layout is needed too.What I need is something that must be really fluid, so the lighter this component is, the better.
UPDATE: *There will be not any object over another.
*I will not use hitTest on bitmaps because all bitmaps are wrapped in another component,as they,for now are itemrenderers.
Anyway I already begin to do this using a class that extends the SkinnableDataContainer and a custom layout. As the layout is not like a grid, is sparse, random items at diferent points(x, y).How to get the localX and localY, relative to item renderer and not to the Spark List, from a DragEvent in Flex 4?
how do we remove object( sprite which has an external swf as it's child ) from display and more importantly from memory yet we still can use the same variable to add another object (yes another sprite like the one we removed yet has different content).., "
i did tried the removeChildAt thing it did remove all the child from the display list but i still can hear sound from video running.
here is small scale code of what i'm doing (sorry that i can only give you chunk code of loading and adding)
// var SWFList:XMLList; //used to hold a list of all external swf source,atribute and etc// var totalSWF:int; //hold the total number of external swf there is to be loaded // var swfLoader:Loader; //instance of loader class used to load the external swf
How do I identify all the display objects in the display list in ActionScript, bellow the one that I have clicked? All the other objects are shadowed by the first one. What if other objects have visible parameter as hidden?
I am trying to build a sort of button bar in Flex - something like the horizontally laid-out bookmark bar you'd see in most modern web browsers, where when you run out of horizontal space, you can click on the arrows button(>>) to get a drop-down to see the rest of the items which did not fit into the horizontal space. Problem is, how can I know how much horizontal space is available for me to tell how many buttons to render into the button bar? This need doesn't appear to be support by the general layout manager framework.
I have a flex application about 2M need to send to browser, so I want the browser to reserve the file in cache forever unless I upgrade the version. I have set the ETAG and last-modified tag in http reponse header, but sometimes, when the user click the refresh, the swf file still be reloaded. So what http response header can I use to reserve the file in browser cache forever?
Im trying to create a layout in flex using mxml, the layout contains a Canvas component and a Box. The layout should always be such that the Box sits at the bottom edge of the application and has a fixed height, whereas the Canvas fills the remaining stage area and does not overlap with the Box. My MXML is as follows;
how to populate a list box component located within a seperate mc in my swf with an array... the array comes from a response from a webservice call. I am not currently on the computer with my source code available so lets just use the following....
listdata[i] = the array i want to populate the list box with..... (listdata1, listdata2, listdata3, listdata4, etc. etc.) movieclip1 = the MC within my fla containing the list box component mylist = the actual list component
... just not all that familiar with the format of actionscript when working with objects... using CS3 and as2 btw,
In flex UI, my <mx:list> can not be shown completely because of other component shelterring (for example: the refresh button shelter part of it ). How can I make the <mx:list> in front of all other UI component.
I have a list component in my app which shows some tiles and one can navigate through them horizontally and i was wondering how can i add the swipe functionality in it to the left or to the right,is this supported by default when the app is on a touch device? the list is like:
I'm trying to extend the mx:Box container so that two buttons sit on the outside of the container to cycle through it's contents (similar to a scrollbar).
I've made a custom component that looks basically like "mx:HBox->mx:Button mx:Box mx:Button" where the buttons and box are children of the hbox.
How do I offer the user access to the box (say its dataProvider and itemRenderer) through my custom component?
So they just need to write 'local:MyCustomComponent dataProvider="rar" itemRenderer="rar"/>' and my box inside that component can use it?
I will implement this myself if I can't find it but after 30 minutes of searching on the web I'm a bit surprised this doesn't exist. Basically what I need is a hierarchical list component like the finder app on mac. I want the same functionality as a tree component but displayed as each level having it's own list resulting in multiple lists that depend on each other.
I am using a spark list control to display certain items with my custom Item Renderer. I am trying to achieve the following: (1) show a separating line between rows in my list control (2) even when not a single row has been added, I want a horizontal grid lines to be displayed in the background
I am not sure whether (1) and (2) can be achieved in one go. I can solve (1) by modifying my item renderer to have a border, I guess. But I want to know whether there is a better or more conventional way.
Is there a direct way to get the item index of the data inside an itemRenderer? I need to display the item number against each item. I am currently doing a workaround and won't allow reuse of my itemRenderer component.
var index:int = model.dataColl.getItemIndex(data) + 1; itemNo = index.toString();
This is what i am using now, it works, but the concepts of component reuse and data abstraction are compromised.
I need to display set of images in horizontal list. The list needs to be controlled with next and previous buttons. Moreover I need to display paging showing no of images per page below the list.