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.
Related
I have a Qt project where I'm using QGraphicsView framework, also I have popup windows on the scenes. (QDialogs)
When someone clicks on a certain button a popup window appears, and I'm invoking it with the .exec() method instead of .show() to make it the active one. Also I want to give it a visual effect like lightbox provides for html pages, so it would be obvious for the user too, that the background window won't communicate. Do you know any simple solution to make it work? or is it hard to implement in Qt?
EDIT: I don't know if it's obvious of not, but it's a desktop application, not a web application.
Just create QFrame over necessary area with customized background and transparency. For animation effect you may use QPropertyAnimation + QGraphicEffects and other stuff from qt animation framework.
Now I found another way to accomplish what I wanted. Like this:
QWidget* mytranswidget = new QWidget(mybgwidget);
mytranswidget->setStyleSheet( "background:transparent; background-color:rgba(0,0,0,95)");
mytranswidget->setWindowFlag(Qt::FramelessWindowHint);
mytranswidget->setGeometry(mybgwidget->rect());
mytranswidget->show();
I'm doing it at the beginning of my popup widget's constructor so it's being drawn before draw my popup, so it will be shown in the right order.
What is the best way to do a loader in a flex application? I have an animated .gif that is to be used as our loader (whenever I need to wait for an action to complete), and I am not sure the best way to do it.
This is how I am thinking:
Have the loader be a custom component.
On the parent application, add an event listener for my custom event AceEvent.SHOW_LOADER.
In the event listener, use the PopUpManager to show the loader.
Listen for AceEvent.HIDE_LOADER.
Get rid fo the loader via PopUpManager.
What do you think about this? Is there a better way to do it?
Thanks!
Andrew
Well, last I checked, animated gifs don't work in Flex unless you have a workaround. Still, I wouldn't use an animated gif to create an animation because of their low quality. I would just recreate it using Flash.
The way I would do the loader however would be very different. personally, I don't believe in 'system loaders' unless it's your application's preloader. The reason for this is that there could be more than one thing loading at the same time (which might not know about each other) which means that the loader popup could disappear before everything is loaded (first one loads, dispatches event and removes popup, while the other is still loading).
What I like to do is create a custom component for the popup loader (since it will be reused quite a bit) and from there I can either use states the are appropriate for my view or have a boolean flag binded to show the popup when true (this can easily be done using frameworks like Parsley). The popup would only cover the part of the system that's actually loading data (since I doubt that your whole app is loading data at the same time) which makes for a better UX.
I ended up using as3gif (until I can get this recreated as a .swf). The way I do this is by using my custom event class (AceEvent.SHOW_LOADER and AceEvent.HIDE_LOADER), which bubbles up to the top. I then use the PopUpManager to add/remove this with modal to disable the application.
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).
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
I'm using mx:WindowedApplication, I'm wondering how I can skin the title bar and close/minimize button for the window. I can see application like Pandora One is using it and setting transparency. Any pointer to a doc?
Thanks,
In your application.xml file, uncomment and set:
<systemChrome>none</systemChrome>
and
<transparent>true</transparent>
Then draw whatever you want for window controls. You'll have to implement your own dragging IIRC, as well as making the appropriate AIR API calls for minimize and maximize.