Connect .mxml component to another - apache-flex

How can i click a button on an .mxml component to open a specific selectedItem on a spark List from another .mxml component!?
Thanks ;-)

First off this is pretty basic so I'll recommend you watch these video tutorials on ramping up for Flex: http://www.adobe.com/devnet/flex/videotraining.html
What does "open" mean?
Depends on the arrangement of the components in terms of what the best way to do this is, you can achieve it through either Binding or dispatching an event.

Related

NavigatorContent onSelect

Is there any shortcut way to add an eventListener to something like a select event for NavigatorContent.
I am aware I can add a listener for a change event on the ViewStack and identify the selected NavigatorContent through that handler.
The ViewStack component dispatch a CREATION_COMPLETE event on the new selectedChild
As2 has shortcuts for what you want, im afraid as3 doesnt as AS3 wants to know exactly whats needed to care for at what time.
an update /enterframe function can reduce some code but apply more load on the swf over all as its waitng for a call.
throw some code up in your question so we all know exactly what your talking about.

Dynamically changing mxml for UI description and state transition logic

I want to use Adobe mxml to create a swf. However, the mxml gets compiled to swf itself and is not available after creating the swf. I want to add states with UI components without compiling it every-time. Is it possible with mxml? If not, what other design approaches can I take?
The very nature of MXML and ActionScript and the Flash Platform is that you must recompile the app every time you want to make change. What you request is not possible.
There are a lot of things you can do--with ActionScript and MXML--to change the state of a component at run time based on some parameters.
As one example, when you click the down arrow button of a ComboBox the drop down will open. This is, essentially, a run time state change. There is no reason you can't perform the similar functionality with your own custom components.

What's the Flash equivalent of FlexEvent.CREATION_COMPLETE

I'm moving some Flex classes to pure Flash/AS3 to be part of a shared library. I have an event listener on FlexEvent.CREATION_COMPLETE to create and add display-objects once things are running, but I don't know the right way to do this in Flash?
edit: Maybe if my class subclasses Sprite rather than a Flex class, I can add children in the constructor, I don't need to wait for a "construction complete" event?
It depends on what you are trying to do: When you add children in the constructor, you will not be able to depend on any information about the stage and/or other elements on it. I have found it a better practice to add an event listener for Event.ADDED_TO_STAGE in the constructor, and have the handler method initialize the element.
You're really comparing apples and oranges here.
The Flex Framework is a UI Framework, and the CREATION_COMPLETE event is part of that framework.
Flash Professional is an IDE, primarily geared for creating animation. It has ActionScript support, but is not a framework and does not offer anything beyond native ActionScript other than libraries or classes you build, buy, create, or borrow.
If you want some parallel to creationComplete, you'll probably need to find--or create--a UI Framework. It is, in theory, possible (although not easy, nor something I'd recommend) to initialize the Flex Framework for use inside a Flash IDE created movie. After all, under the hood it is all ActionScript.
creationComplete Dispatched when the component, and all of its child components, and all of their children, and so on have been created, laid out, and are visible.
See more info on the flex life-cycle events and some that are plain flash here: also +1ed the added_to_stage as it's likely what you'll need in this case.
http://livedocs.adobe.com/flex/3/html/help.html?content=containers_intro_3.html

destroy open item editor or item renderer in flex

Is it possible to destroy/close open item editor or item renderer of a datagrid in different mxml page?
I heard about the functions editedItemRenderer and destroyItemEditor on Datagrid. Can I use these functions in different mxml page?
Your question is a bit confusing.
Flex Applications do not have the concept of a page in the same way that HTML does. You probably mean different views, or MXML Components.
All itemEditors are created and destroyed as needed. If you are not viewing the itemEditor on screen, then likely something else has focus and the itemEditor was destroyed automatically.
In most cases, two components should not talk to each other using anything other than their defined API. so, you can have one component dispatch an event, then it's parent listen for the event and have that parent call methods on another component [such as a DataGrid].

Adobe Flex - How to jump view?

I understand that we need to create MXML file to define a view. Suppose on user click of a button I want to show another view defined in another MXML file. How can I do this?
You could use a viewstack. each item in the viewstack would be a different MXML file so when the user clicks a button you change the selected index of the viewstack which makes the view change.
You could probably do with checking out the examples in http://www.adobe.com/devnet/flex/tourdeflex/ this will help explain so much more than a simple answer will.
From your question it sounds like you need to get the basics of flex first and the tour de flex app contains loads of examples with source code.
HTH.

Resources