Flex error skin incorrectly drawing - apache-flex

I really hope there is someone that can help me out on this one. It took me days to implement a decent looking error skin for some custom text inputs but I am running into what seems to be a measuring issue with the resulting bitmap from validating.
I duplicated the Flex default error skin into my own class and just adjusted the GlowFilter to be "inner" and some color changes.
Setting the focus skin to NULL was an attempt to remove that styling since validation turns that thing red and applies it on top of everything else.
<view:PromptedTextInput id="inputCompanyName"
width="100%" height="35"
focusSkin="{null}"
styleName="promptedTextInput"
errorSkin="com.verical.common.skins.InnerGlowErrorSkin"
prompt="company name (optional)"
skinClass="com.verical.checkout.view.skins.PromptedUserInputSkin" />
Here is what I sometimes see happen randomly.

Related

Adobe Flex Content Disappears in IE8

I am having an interesting bug in MSIE8, only.
I have also tested this in MSIE7, MSIE9 and Chrome and could not reproduce it in those environments.
I have a flex application which is embedded in a webpage. The application has a few top level components. One is a mx:ViewStack which contains a number of different icons. The other is a mx:Canvas which contains a number of child mx:Canvas elements (which are used as layers to hold other UIComponents).
<mx:Canvas backgroundColor="#FFFFFF" id="drawing_area" borderColor="#000000" borderStyle="solid" horizontalScrollPolicy="off" verticalScrollPolicy="off" width="728" x="10" height="522.8889" y="10">
...
</mx:Canvas>
The error occurs when I perform the following steps.
Load the page with the component
Let the component fully load
Scroll down so that the top of the flex content goes outside the bounds of IE8's content window.
When I do the above, the mx:Canvas with the border disappears. It can still be interacted with, but any content moved into one of the child elements also disappears.
In this first image you can observe my starting state, there is a border around the drawing area, and the drawing area can be interacted with.
This second image shows the issue, after additional scrolling down. The border disappears and all UIComponents placed into the drawing_area also disappear.
Unfortunately IE8 is still a popular browser in the organization this was designed for.
Anyone have any clues as to what might be happening. I have tried different wmodes for flash. I am currently using window, but have tried transparent as well, and have the same issue.
I have tried a number of different things to get a work-around for this bug without much success.
I am using Rails on the backend and this issue is tied to only the "new" action, and does not appear on the "edit" action. Both pages use a shared partial to render the content.
Because of this I am doing browser detection using the rails gem browser. When a user is using IE8 I provide a recommendation to upgrade. On the page that has this error occurs I am providing instructions to enter data for the required fields and then save their report. This will take the user to the "edit" action and they will be able to interact with the flash content without issue.

How to reference the image used as icon for a button in Adobe Flex?

I am developing a Flex application in which I would like to simulate roughly what we get when we serach Google for images. When we pass the mouse pointer over an image, it enlarges a little bit so we can see it better and click it if we want.
I know I could just use an image and increase its size via mouseOver/ mouseOut events, but the thing is that it is much easier for users to realise that they're clickable when I use a button with an icon (as opposed to a plain image).
So here's the question. Is there any way to alter (in this case, its height and width) the button icon through the button methods/ properties?
I can explain it a little further if this is too confusing.
Thank is advance.
P.S.: The way I'm doing it now is by changing the src property of the icon to switch to another (larger) version of the same picture (that requires two versions of each pictures to be stored). However, I'm using the setStyle method to achieve that, which, according to the documentation itself, is not very good performance-wise. And it's so much easier to adjust the size than to have to load another picture which is just an old version of the previous one.
If your picture is enlarged only 'a little bit', you can get away with one (larger) version (just set smoothing = true on underlying Bitmap.) This also enables smooth transition from small to larger version. And hand cursor would be fine way to indicate clickableness, while very large buttons will look strange.
The question was already asked in these threads
Create a button with an icon in actionscript
Set the icon of a Flex button with a Sprite in runtime
According to them there is no graceful solution, but the task can be done via setStyle() or using this snippet:
http://blog.benstucki.net/?p=42
The another way is to use a hack like this (Transparent button over image):
<s:Group width="100" height="20">
<mx:Image source="picture_you_need.jpg" width="100%" height="100%" scaleContent="true" maintainAspectRatio="false"/>
<s:Button id = "test_button" width="100%" height="100%" alpha="0.0"}"/>
</s:Group>

Flex 4 Scrollbar Skin does not resize

I'm working on a Flex 4 application and I started customizing the interface with skins to give a whole new look.
So, I've created two scrollbar skins in Flash Catalyst (one horizontal, one vertical).
Its working great when I test the application through Catalyst so I took it and imported it on Flash Builder, copied the components and defined the new skins in my css file for the HScrollbar and VScrollbar.
The skin is working, all the buttons are ok. But, the scrollbar isnt resizing for some reason. It remains in the same height I've designed it to be regardless of the content it is bound to.
It scrolls the content in all the ways it should be but it doesnt resize and the thumb isnt getting all the way down.
Also I've noticed the following.
I have a custom component acting as a list. It extends Group and contains a Scroller. So at one place of the application the Scrollthumb is getting lower than on another place where the same custom list is used.
I also have to mention that this scroller works perfectly without a custom skin.
Anyone else having similar problems?
Okay, I know you posted this a while ago but I have been scouring the internet for days looking for why the scrollbar's thumb wasn't scaling like the default scrollbar.
There are a couple things to check, first is there a set height on your thumb's skin?
If not, and this is what I was overlooking, go to your scroller skin and at the point where you add the vertical and horizontal scrollbar set the "fixedThumbSize" property to false.
I suppose that your graphic elements are defined as every single part of the scrollbar (top arrow, bottom arrow, track, etc...): in this case you should check that the elements dimensions are not fixed... they should be in % to be able to change the dimensions based on the container.

Flex Spark TitleWindow bad redraw on dragging

I have a problem with redrawing in flex 4. I have a spark titleWindow, and if i drag it faster, it looks like it's mask is one frame late after the component.
it's easily visible with 1pixel thin border, because it becomes invisible even with slower movement.
You can try it here (what is not my page, but it's easier to show you here than uploading example):
http://flexponential.com/2010/01/10/resizable-titlewindow-in-flex-4/
If you move in direction up, you see disappearing top border. in another directions it's not that sensitive as it has wide shadow, and it's not very visible on shadow.
On my computer i see it on every spark TitleWindow i have found on google, although it's much less visible with less contrast skins, without borders or with shadows.
Do you see it there? i had never this problem with halo components. It's doing the same thing with different skins. I tried to delete masks from skin, cache component, skin even an application as bitmap with no success.
I also turned on redraw regions in flash player, and it looks like it's one frame late after titlewindow too.
Does anyone know why is it doing this or how can i prevent it?
Thank you
UPDATE:
no answers? really?
I have been facing the same problem and I was really pissed that I couldn't find any answer.
The problem with me was, that I tried to center the component "component.x = (parent.width - component.width) / 2" and then draw that component programatically. The problem was, that component.x is a Number which can lead to floating values like 10.5 or similar. And it looks like that bitmapFill function rounds floats DIFFERENTLY than drawRect function, which makes exactly the 1px line around the objects (but ONLY when parent.width is an odd number). Strange thing for me was, that I only called the Draw function once, but still this line keep recurring ...
Doing Math.floor(component.x) solved the issue.
P.S.: I think that you can also help your issue by setting cacheAsbitmap=true on the dragged object ...
Cheers,
Jan Prazma

Strange behaviour when dynamically resizing Flash / Flex embed object

I have a simple Flex application that is a panel with a repeater inside of it; albeit a little simplified, it is like such:
<mx:Panel id="pnl">
<mx:Repeater id="rp">
<mx:Label text = "foo" />
&lt/mx:Repeater>
&lt/mx:Panel>
I am then embedding this Flex application into an HTML wrapper. I am then attempting to dynamically re size the embedded Flash object in the HTML as the Flex panel changes size (thus allowing the Flex application to consume as much of the HTML page as it needs).
I am doing this by doing the following actionscipt:
pnl.addEventListener(ResizeEvent.RESIZE,function(event:Event):void {
ExternalInterface.call("resize",event.target.height);
});
which in turn calls this javascript function:
function resize(height) {
// the embed or object that contains the flex app
var e = document.getElementById('flex_object');
if(e) e.height = height;
}
This seems to work perfect in IE, however I get strange results in Firefox / Safari, the repeater works for n number of times, and then the text seems to get cut off / disappear in the repeater, see the attached image:
alt text http://img528.imageshack.us/img528/9538/rpre0.jpg
Can anyone explain why this is happening, and if there are any workarounds / ways of doing the same thing?
I'm currently working in the same thing (a swf that dynamically changes it's height depending on the content it's currently holding). I also had a similar problem to yours trying to make a multi-line button.
I'm new to flex but I managed to solve the problem manually invoking the updateDisplayList() of the container... I think it "forces" a render somewhere... it's parameters are the width and height of some area where the changes happen. Sorry for not knowing the details... But it worked for me.
Why not simply using percent width and height on your HTML page for your Flash object ? This way you event don't have to do anything to resize your SWF...
That's very strange - it looks like Firefox/Safari are expanding the draw area of the embed, but somehow Flash is not getting the message that it needs to render the new pixels.
You could probably work around this by doing something to force Flash to update itself, but since the communication between the browsers and the embed seems to be confused it would probably be less hackish to take a different approach, that fits into the browsers' event flow without bugging.
For example, instead of resizing the embed, you might try putting Flash inside a DIV, setting the Flash's size to 100%, and then resizing the DIV. That seems a lot less likely to misbehave.
My experience is that Flex's resizing abilities are... funny. Sometimes they work the way one would expect, other times they do not. There are a couple of things you could try: first, trace the value you expect to get in Flex for the height or even ExternalInterface.call("alert",event.target.height); This will let you know if it is a JavaScript or a Flex problem for sure (but I suspect it is Flex).
Your problem might have to do with the scaling of the component:
Setting [the height] property causes a resize event to be dispatched. See the resize event for details on when this event is dispatched. If the component's scaleY property is not 100, the height of the component from its internal coordinates will not match. Thus a 100 pixel high component with a scaleY of 200 will take 100 pixels in the parent, but will internally think it is 50 pixels high.
If it is Flex and that does not help, I would try using callLater in front of the ExternalInterface call, often that will allow Flex enough time to figure out what the heck it is doing. Occasionally, setTimeout is needed, but I find that awkward.

Resources