retrieve flashvar from Flex3 using mxml - apache-flex

Is it possible to retrieve flashvar parameter in mxml code and if so how? Up to now i have been using Application.application.parameter.name to get what i need.

You can bind to it:
<mx:Label text="{Application.application.parameters.name}"/>

I'm fairly certain that's the only way to get it - you'll have to use that bit of actionscript. How would you like to use it in MXML? If you post an example of what you'd expect it to look like we might have more ideas.

Related

Flex 4 binding to mx:Image

Is it possible to bind a property (don't know which) of the mx:Image control, so that it is (should be) possible to get in form of a bytearray? (using Flex 4)
The reason i'm asking is this: i have to forward the bytearray to a WCF service to be stored and afterwards retrieved!
If this is not directly achievable is there a work-around ?
Thanks in advance!
If you load content into your image then when the Event.COMPLETE dispatches (on the image instance) the <imageInstance>.content.loaderInfo.bytes ByteArray holds the loaded data.
you can use BindingUtils.bindproperty to bind your object to the value of Image.source, like its described here in the docs

QWebElement information where on page it is rendered?

Looks like access to DOM and rendering details of HTML tags are not availabel in qt 4.5.x .
Current snapshot QWebElement looks like proper class to be used there
Anybody can give me info if is it possible to get from QWebElement information where on page it was rendered ?
Or there are other ways to get that information ?
TIA, regards
In Qt 4.5, you need to write that as a JavaScript expression and evaluate that with QWebFrame::evaluateJaveScript().
Just for reference's sake: for 4.6 and up, QWebElement.geometry() is the best way to do this. Otherwise, user134841's answer about calling into JavaScript is really the only alternative.

Flex : Displaying the Advanced DataGrid data in Pages

I have a flex application where Im displaying login data using an advanced datagrid. Is it possible to show the data in this advanced datagrid, by a page wise way? if so do you have any sample coding to do this. thanks
Here's an example I think might help you: http://gurufaction.blogspot.com/2007/02/flex-datagrid-paging-example-with.html
SWF: http://develop.gurufaction.com/App.swf
MXML: http://develop.gurufaction.com/src/App.mxml
You can use the "filterFunction".
Write a custom function to filter data according on which "page" you are browsing.
Another solution is to split the original array to get several array which will be assigned according to the current page.

Flex XML elements vs. code

It's possible within a Flex application, to declare elements, for example a HTTPService elements, both in XML and also in code.
That is, either:
...
or in code:
var hs : HTTPService = ...
My question is when should I prefer which alternative? What are the advantages of having stuff in XML vs. plain old vars in code?
MXML is great for doing declarative layouts, much easier to follow than doing everything programmatically in ActionScript. If you are using something like a ServiceLocator to define HTTPService, RemoteObject, etc in your app then declaring them via MXML is also quick and easy. Basically if you want to add anything to an object's displayList quickly and easily, MXML is a great way.
Elements are more concise and compact than AS3 code, tho of course ultimately it all becomes the same thing. You can, for example in 'one line' of mxml declare an HTTPService and set several of its properties. In script you'd need to do this in many lines of init code. If you have a lot of global variables this can start to become unruly.

Flex component access other component

I have 2 components for example (editor.mxml using mx:windows), when I click an edit button, I want to get the current value from the other component's datafield? (datagrid.mxml using mx:window)
I do know how to access the main MXML's datagrid by parentDocument or Application.application method, but stumped block if I want to access other way as mentioned above. Keep the code as simple as possible.
You could either do dependency injection, that is, give component A a reference to component B so that they can communicate directly (example of tighter coupling,) or have both components communicate through a common mediator using events (example of more loose coupling.)
Both of those options would be implemented wherever it is that you're creating those components (A and B in this example) and adding them to the display list.
This might be more complicated than it deserves, and it smacks of Pattern-Fever, but you could use a mediator class that listens for the CLICK event from the button and knows enough about the other component to query its property. It could even transmit that data using a custom event, which the button listens for.
While this involves three classes instead of two, it often turns out to be easier to have two components that focus on looking good and one that worries about coordination.
Cheers
Try this:
FlexGlobals.topLevelApplication
This points Your root. From the root You can grab every element You want.
You can also add an id to the custom component like this,
<custom:Editor id="myCustomComponent">
</Editor:AddressForm>
and
access your datagrid's value like this,
var data:ArrayCollection = myCustomComponent.DatagridID.dataProvider;

Resources