I finally find 10 minutes to try to put a progress information in the progress bar control.
The solution was to use a TextField objet write some stuff in it, use a BitmapObject to copy the TextField object into it and then draw the new created BitmapData object on the big one.
Here is the code to only draw the progress text:
var textField: TextField = new TextField();
textField.htmlText = m_Progress.toFixed(0) + "%";
var textBitmapData: BitmapData = new BitmapData(textField.textWidth + 5, textField.textHeight);
textBitmapData.floodFill(0, 0, ProgressBarBackground);
textBitmapData.draw(textField);
var textBitmapMatrix: Matrix = new Matrix();
textBitmapMatrix.translate(px + (containerWidth) / 2, py + (ProgressHeight - textBitmapData.height) / 2);
The full source code can be found here . (Right click somwhere and select "View code..." to see the source code)
As usual, if someone improve the code please post a comment.
UPDATE:
Thanks for the info there is something wrong with the "view source..." function.
I added an archive file with the source code. this can be found here
Sorry for this.
20 Kommentare:
Greate ;-) But there is no SourceView.
greetz
LUNI
Hey there,
Instead of working with a bitmap data, wouldn't it be possible to simply use the UITextField and add it as a child similar to the progressbar and image?
Hi boubalou
You cannot add components to the Loader, or better said I was not able to made it works.
I don't use any components to draw the progress, the only thing is that you cannot draw a text in a Graphics object like for example in the .Net Framwork. The Whole progress bar (Logo, progress bar and Percent value) is drawn in a BitmapData and then parse as a BitmapArray to the Loader class.
Thanks for posting this! Helped me out quite a bit to finish the customization of my preloader. Thank you very much!
thanks very much :)
Now imagine that I'd want the preloader ON TOP of the image
When I move the preloaderbar it goes under the image.
Is there any way I can get around this please :) ??
Hi benji,
You just need to switch 2 lines of code. In this case put the Draw logo line before the draw sprite line. the result should be as expected.
^^^^^^^^
ohhhhh thanks ever so much for replying so fast :D thats very kind of you :)
I have another question :)
so as you know, I'm trying to place the loader on top of the image in a certain position..
is there a certain way for this?
private static var Spacing: int = -450 ;
////changing this works partly (a part of the image disappears though .. :( )
I also was wondering, what are the following variables relative to??
Not the whole stage by the looks of it :)
LeftMargin, RightMargin, TopMargin, BottomMargin...
to what do they refer to (in relation to what I mean) ? :)
Thanks for the help, I have been struggling for a few days on this. I have an issue though, when I test my application, the preloader works, but when I upload it to the server I get "Infinity%" and there is no progress bar movement.
I am using Flex 3 SDK 3.1.0.2710
Like I said, it works when I compile it locally but then I try to run it on the server, it gives this error, any suggestions, thanks in advance.
Link
Hi,
I will try to answer your questions as soon as possible. hope tomorrow or so...
Nice. Made me curious - but no SourceView? I am unable to access the source, what should I do?
Thanks for putting it up so quick!
I tried this code and it works unless I enable the Flex Deep Linking feature and open the web site from a bookmark which uses a URL fragment set by BrowserManager. Then, the preloader simply does not display until the progress bar reaches 100%, at which time it displays briefly and then the app loads.
I tried commenting out two lines of code in the Preloader.as file:
import mx.managers.BrowserManager;
var browser: BrowserManager;
...but this didn't help.
Is there something about using Deep Linking which prevents the preloader from displaying?
Thanks for any ideas.
@rtalton
It looks like it's a known bug
http://bugs.adobe.com/jira/browse/SDK-14162
Hi boubalou
You cannot add components to the Loader, or better said I was not able to made it works.
I don't use any components to draw the progress, the only thing is that you cannot draw a text in a Graphics object like for example in the .Net Framwork. The Whole progress bar (Logo, progress bar and Percent value) is drawn in a BitmapData and then parse as a BitmapArray to the Loader class.
Hi,
Would it be possible to add the component as a child of the preloader class instead?
Thanks!
Hey I'd love to congratulate you for such a great made forum!
thought this is a nice way to introduce myself!
Sincerely,
Hilary Driscoll
if you're ever bored check out my site!
[url=http://www.partyopedia.com/articles/casino-party-supplies.html]casino shower Party Supplies[/url].
http://lumerkoz.edu I bookmarked this site., http://www.comicspace.com/paroxetine/ lirs http://epsaservicecenter.com/members/Buy-Cipro.aspx lethargy testified http://rc8forum.com/members/Buy-Ezetimibe.aspx japandr http://www.ecometro.com/Community/members/Buy-Hydroxyzine.aspx babcock http://barborazychova.com/members/Buy-Lexapro.aspx butts terr
Hello,
I mostly visits this website[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url]Plenty of useful information on flexiblemyself.blogspot.com. Frankly speaking we really do not pay attention towards our health. Are you really serious about your weight?. Recent Scientific Research indicates that nearly 70% of all U.S. grownups are either obese or weighty[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url] So if you're one of these citizens, you're not alone. In fact, most of us need to lose a few pounds once in a while to get sexy and perfect six pack abs. Now next question is how you can achive quick weight loss? You can easily lose with with little effort. If you improve some of your daily diet habbits then, its like piece of cake to quickly lose weight.
About me: I am author of [url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips]Quick weight loss tips[/url]. I am also health expert who can help you lose weight quickly. If you do not want to go under painful training program than you may also try [url=http://www.weightrapidloss.com/acai-berry-for-quick-weight-loss]Acai Berry[/url] or [url=http://www.weightrapidloss.com/colon-cleanse-for-weight-loss]Colon Cleansing[/url] for effortless weight loss.
Hello. Awesome work. Got it in 10 - 15 min in and it worked very good with my own design....
But i have the problem that i want the progressbar to be under the Logo...
I tried for hours now (started so good!!) :D
But it didnt worked out.. Got someone a hint for me how i can handle that?
Greetz Beta
Kommentar veröffentlichen