change Preloader background color - apache-flex

I have a custom preloader that I designed in flash. When I load it in flex, it loads with a white background. When I try to change the background to black in my flash file & load it in Flex, the background color remains white. I've also tried to update the compiler settings in Flex, adding "-default-background-color #000000" but I still get a white preloader background. I am using Flex 4. Here is my Pre.as file:
`
`
thx!

I encountered the same problem.
solved it using opaqueBackground :
loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.INIT, init);
private function init(e:Event):void{
loader.opaqueBackground = 0x000000;
}
Worked great for me.

This man solved it by adding background sprite and filling it with custom color you want.
And here http://iamjosh.wordpress.com/2007/12/18/flex-custom-preloader/ author also told that he added the compiler option like this:
Finally, let’s change the background
color of the application to match our
logo a little better. Just add the
following Flex compiler argument:
-default-background-color #FFFFFF
So, you might added this option to another one application you need instead.
UPDATE 1
Also look at this
http://cookbooks.adobe.com/post_Change_Background_Color_of_the_Preloader_Phase-1421.html
And please, explain once again your goals, are you want to set color or something another, from preloader or parent application or whatever you want, just let me know.
UPDATE 2
And listen, if you really want some cool bg, you might do next thing.
1)Forget about preloader mechanism.
2)Write Your BG application
3)Add swfLoader overlay to your bg application
4)Draw progressbar for this container
5)Enjoy with 2 application architecture instead of standard way.
Questions!?

Related

Flex: cannot control size of scroll bar thumb when skinned

I have this problem where the scroll bar's thumb is too small when I apply a skin programmatically. There's no problem when I apply it in the CSS.
main.css:
.myscrolls {
thumbUpSkin: Embed(source="thumb-default.png",
scaleGridLeft="7", scaleGridTop="5", scaleGridRight="8", scaleGridBottom="7");
The above looks fine, but if I try to change the thumb programmatically in the ActionScript later, the thumb is too small, which causes enormous margins between the thumb and the ends of the scroll bar.
ScrollbarColour.as:
[Embed(source="thumb-non-default.png",
scaleGridLeft="7", scaleGridTop="5", scaleGridRight="8", scaleGridBottom="7")]const cThumbNonDefault:Class;
The problem is most likely related to this warning that I get about the above line:
ScrollbarColour_cThumbNonDefault does not extend the 'DefineSprite' asset base class 'flash.display.Sprite'
But if I take away those scaleGrid* members from the ActionScript, the warning goes away.
I used the Flex 3.5 SDK.
However, I made all those Embeds on the stack. If I made them (static) members of ScrollbarColour, I was able to get those attributes to work. I really don't get this language.

Transparent QGraphicsWebview over QGLWidget leads to super imposed images

I have a transparent QGraphicsWebview inside a QGraphicsView with the following settings:
The QGraphicsView is the high level widget, and is shown in full screen mode
The graphics view uses a QGLWidget as its view port (to use opengl-es)
Alpha channel and double buffering are enabled in this QGLWidget
Transparency is achieved by graphicsView->setStyleSheet("background:transparent")
Following attributes are set for QGraphicsView and QGraphicsWebview
WA_TranslucentBackground = true
WA_NoSystemBackground = true
WA_OpaquePaintEvent = false
The QPalette::Base and QPalette::Window brushes of webview and webview->page() are set to Qt::transparent
At the beginning, the transparency works fine. But as the screen get updated (when I scroll), it looks like the new bitmap is blended on top of the existing one to get a superimposed picture. After about 5-6 screen updates, this blending causes the colors to accumulate and form an opaque rectangle (with a corrupted image). Following images show first, second and final stages of the problem.
How do I tell qt/opengl to stop blending and just draw the new image to the frame buffer?
I tried calling fillRect(boundRect(), Qt::transparent) from overridden Webview::paint and GraphicsView::paintEvent; but it didn't work except for making the updates slower.
I am new to Qt and OpenGl, so I might be missing some basic flags or settings.
I tried all the methods mentioned above. They did not work for me. I then debugged into qtbase code and found that setting the Opacity level make the top browser layer transparent.
this->setOpacity(0.1);
this pointer points to the QGraphicsWebView object.
With this method, the whole front browser contents including background will be transparent. To separate header, paragraph and background and to specify different transparent levels for them, I will have to dig into webkit code a little further to figure out the problem. But for now, setOpacity() did the trick and is good enough for what I am doing.
It turns out the problem is graphicsView->setStyleSheet("background:transparent");. Who would have guessed?!
Yeah, the line that I thought made transparency work was actually causing troubles with transparency. The application works fine without that line (or if you change it to background:none)
In short, steps to get a transparent QGraphicsWebview using QGLWidget:
Set the Base palettes of QGraphicsWebview, QWebpage and the outer QGraphicsView to Qt::transparent
scene->setBackgroundBrush(QBrush(Qt::transparent));
You should also make sure that html body background is set to transparent values:
html, body {
background-color: rgba(127, 127, 0, 0.5);
}

How to apply styles to a group of Labels in javafx without css

I have a javaFx VBox named countVBox in which a append Labels on the click of a button. Now with css, I can do:
.countVBox .label {
-fx-background-color: #0000ff;
}
I want to achieve the same effect - making the label's background colour blue after it is appended, but without using css. Please tell me if it's possible. Thanks. I am using javafx 2.2
You can access the background of a region (such as a label), using the getBackground() API. Once you have a background, there are methods on the background which will allow you to manipulate it via code.
In most cases I'd recommend using CSS (in a stylesheet) over manipulating the region background in Java code.
See also:
In JavaFX, should I use CSS or setter methods to change properties on my UI Nodes?

Change background color in spark VideoPlayer

is there any way to change the black in background in the VideoPlayer component that comes with Flex 4 ?
I can change every color but i can't change the black in background.
Thanks
if this one option doesn't help you, use this page to extend VideoPlayer with your own vision of logic, or if you are really have another option to add build your own component based on raw VideoDisplay like this.
Here is a sample changing background color
http://blog.flexexamples.com/2009/05/04/setting-the-base-theme-color-on-a-spark-videoplayer-control-in-flex-gumbo/#more-1056

Background Image in Flex

I'm using Flash Builder 4 to create an application. I need to set an background image for the app. I've pulled through the data from XML.
I am using an <mx:Image> for the background-image. But I need elements to then be added inside it. How do I achieve this? I considered using Layers, but dont know how you achieve this.
Any help appreciated.
Cheers
One approach: in our flex application, we have a canvas behind our primary container as in
<mx:Canvas id="bgImg" width="1280" height="800"
backgroundImage="assets/background.jpg" />
<containers:FlashContainer id="mainContainer">
<!-- HBoxs, VBoxes and loads of other components -->
</containers:FlashContainer>
So, the other elements you're looking to add would exist within the internal container with a stationary Canvas "behind" it, which holds your image.
To get this to work in Flex 4 you need to compile with the Halo theme (instead of Spark). We use flex builder and set the following flag under the project compiler preferences.
-theme=${flexlib}/themes/Halo/halo.swc
As in the following image:
In the Flex 3 Model, you can set a backgroundImage on the Application tag, which should, effectively, give your whole application a background image.
In the Flex 4 Model, you need to create a custom skin class for your Application tag. Set the skin using the skinClass style. Since s:Application extends SkinnableContainer, you should be able to use the default SkinnableContainer style as a guide for adding a background image. The default background, I believe, is just a Rect w/ a solid fill.
i m still working in flex3, so i would have used backgroundImage on the application tag, and also do set backgroundSize to 100%, these 2 properties r on the application tag,
may be some help 2 u
tc

Resources