What kind of Flex component can I utilize in NativeWindow? - apache-flex

I'm developing Adobe Air application.
To show additional window, I create NativeWindow object.
In the object, "stage.addChild( Sprite Obj )" does work, but almost all other flex components do not work.
Actually I want to add 'spark.components.BorderContainer', 'spark.components.Group', 'mx.controls.Image', etc., but cannot.
One solution I found is to use 'flash.html.HTMLLoader' and to display rich content (that includes images and styled text) into the window.
Is there any better way to show rich content?

NativeWindow is not a Flex container.
Use spark.components.Window or mx.core.Window - they allow BorderContainer, Group and Image to be added (do not forget to use window.addElement() method).

Related

Flex 3 - How to make a circular progress bar?

I am a beginner in Flex. For my appln, I wanted to have the progress bar, but not the default that Flex Framework provides.
I wanted to have a circular loading "progressbar" that would move in circular fashion before completing one complete revolution to 100%.
Can I do that in Flex 3 ? If yes, how ?
Thanks in advance.
Creating your own custom preloader is easy enough. You just need to set the new preloader class in the 'preloader' property of the Application tag.
From there, your class (which should extend ProgressBar) can use simple Actiosncript to animation/draw or you can use a swf animation (done with Flash CS). There are several good examples of this on google.
Something like this? http://activeden.net/item/as3-circle-preloader-circular-progress-bar/88763
Use preloader or extend the progress bar component in Flex
You can have a circle component and a hidden progress bar in it. And for each progress bar event, you can paint a block on the circle.
there is a property in Application "preloader". try setting your own SWC file to this property.
You should use an already created component.
Here is a circular progress bar component created using Degrafa.
http://axelscript.com/wp-content/Examples/CircularProgress/CircularProgress.html
You can see the code at
http://axelscript.com/wp-content/Examples/CircularProgress/srcview/index.html
The code is pretty simple , and as the component is shipped as a mxml component, integration should be very simple.
All you need is the degrafa.swc to be in the lib folder of your project for this to work.
You could use AS3GIF and create your own "circular progress" animated GIF.
If, for example, your animated GIF has 20 frames, you can call the function GIFPlayer.gotoAndStop(pFrame: int) at each 5% step.

a question about flex preloaders

I'm moving to a pure as3 environment into flex and I have a question about preloaders.
For one of my apps in particular when the swf loaded I would add a screen with an animated preloader. Then at a particular point in my code when I know all of my xml has been parsed, UI built and all initiliztion done I dispatch a "done" event which removes the preloader.
How can I achieve this is flex? I've only ever really seen flex preloaders that are percentage based which I believe represent the actual loading of the swf itself?
Please read the flex cookbook for preloaders, they have some demo applications, that could help u out
actually there is a preloader property in the application tag,
that could be wht u might help u out
tc
Ankur Sharma
Flex has a ProgressBar control that you can use for similar purposes. If you want to continue to use your own custom animated progress bar, you can add that Sprite to the rawChildren of a Container (preferably Canvas) and show it as a modal pop-up using the PopUpManager - remove the pop-up from the done event's handler.
The overriden addChild method of the Container class will throw an error if you pass a child that doesn't extend UIComponent - that's why you should use rawChildren.addChild.
Yep default flex preloader represents the loading of the swf itself.
If I were you, I would use the Task library from the Cairngorm 3 Libs, works perfectly with a preloader :
http://opensource.adobe.com/svn/opensource/cairngorm3/trunk/libraries/TaskTest/src/samples/TaskFlowPreloader.as

Flex advanced datagrid styling

I'm using an advanced datagrid in a system I'm building.
the design PSD from the designer includes a special background on rollover.
So, I need the background of the cells in a row to get the background from an image, only when the mouse rolls over a specific row.
is this even possible?
can a row get the background from an image (CSS)
There is a method available in DataGrids (and Lists) called drawRowBackgrounds() that is responsible for drawing a simple highlight into a row in response to a user interaction. You might be able to accomplish the design in the PSD programmatically by using the Flash drawing API. If you need to use an image asset, you could try to add it as a child of the Sprite that is passed as the first argument of this method call.

How to get a collection of UIComponents based on a stylename in Adobe Flex

Does anyone know an Actionscript equivalent of the javascript getElementsByClassName.
What I would like to do is add a custom 'stylename' to various components which I can then use to get a collection of these objects and therefore process their visibility property.
The idea is I want to hide various components based on what roles a logged in user has - I just want to make this flexible by adding an array of rolenames to a custom property or use the stylename property on a Canvas or Panel etc.
Thanks
I think your best bet is to use flex states. A base state with the differences specified in sub states. heres a nice tutorial from adobe on flex states assuming you're using flex 3.x : http://www.adobe.com/devnet/flex/quickstart/creating_states/

Air application created with Flex - How do I create a fly-out window to the left/right

I have an Air application with a main window. I would like to have a new window fly out from the side of the main window when the user clicks on a button in the main window. The window that appears needs to display information based on value passed from the main form. How can I achieve this with Flex Builder 3?
Target platform: any version of Flash/Flex/Air.
You'll probably want to use view states. Check out the Flex in one Week video tutorial on "Creating View States":
http://www.adobe.com/devnet/flex/videotraining/
What you want to do is what tweenMax was made for. it's a .swc that you add into your project. It will allow you to use the tweenLite (or tweenMax) command.
import com.greensock.*;
TweenLite.to(mc, 1, {x:65, y:117});
So you would say if your stage was 500 px wide and you want the box to come in from the right. Add the child at maybe 505, and then tween.to whatever x value you want. Yep. it's that easy. And the other parameters are for duration and easing and even alpha so you have control over that too. They even have a swf in the website so you an play with it and practice. http://www.greensock.com/tweenmax/

Resources