• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1113
  • Last Modified:

Flex4 issue, Alert message box is appearing backwards!??

I have attached a graphics file to show exactly what I'm talking about. This is the first time I've used mx.controls.Alert since I've been using Flex 4.

How can I write an application in Flex with Alert boxes looking like this?

Has anyone encountered this problem? How did you resolve this??
problem.png
0
elepil
Asked:
elepil
  • 6
  • 4
1 Solution
 
IqAndreasCommented:
Hehe, that is quite funny. It looks like some sort of april fools prank. :)

What code are you using to make the alert show up? Are you setting the "parent" parameter to anything, or are you keeping that at the default?

Are you flipping any of the other components (by setting "scaleX = -1")?

If all else fails, you can set the scaleX property of the alert to -1, and that should flip it correctly. If you provide some code, I can make the necessary changes for you.

Cheers,
Andreas
0
 
IqAndreasCommented:
And in case it comes in handy, here is the link for the Language reference page for the Alert class:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/Alert.html?allClasses=1
0
 
elepilAuthor Commented:
Thank you for responding, Andreas.

My code is pretty standard, just the way I have been doing it in Flex 3:

private function btnDashBoardClickHandler(event:MouseEvent):void
{
    var alert:Alert = Alert.show("Unsaved changes you have made, if any, will be lost.\n" +
                                                 "Do you still wish to go back to the Dashboard?",
                                                 "WARNING", Alert.YES | Alert.NO,
                                                 this, alertClickHandler);
}

private function alertClickHandler(event:CloseEvent):void
{
}

As you can see, the parent is 'this'.

Can you please tell me where to put that scaleX = -1 you were talking about?

This is a bit upsetting to me because I just spent $299 upgrading to Flex 3, and then I get this. :(
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
IqAndreasCommented:
You should be able to write the code directly after you define the alert variable (before the first function closes) - See the attached code and try that.

If that doesn't work, try passing in "stage" as the parent container instead of "this".
var alert:Alert = Alert.show("Unsaved changes you have made, if any, will be lost.\n" +
											 "Do you still wish to go back to the Dashboard?",
											 "WARNING", Alert.YES | Alert.NO,
											 this, alertClickHandler);
											 
alert.scaleX = -1;

Open in new window

0
 
IqAndreasCommented:
If that doesn't work, try opening an entirely blank project, and creating that alert.

If the problem is still there, you have a Flex problem. If the problem goes away, then something else in your current code is interfering with the alert.
0
 
elepilAuthor Commented:
Andreas, that scaleX= -1 didn't work out too well. I attached the graphic on  how it looked like.

I created a new MXML application within the same project and pasted my code, now the alert box is just blank. You see the alert box and the buttons, but no text at all!

Are you using Flex 4? I just need to know if other Flex 4 users are having similar peculiar problems.
problem2.png
0
 
IqAndreasCommented:
That is VERY odd indeed. Yes, I'm using Flex 4, and it is working just fine for me.

Did changing the parent of the alert from "this" to "stage" work?

Perhaps try creating a NEW project, rather than using the existing one (to make sure no code is interfering at all) and test making an Alert in there. If it still shows up wacky, try installing the latest build of the Flex 4 SDK. I'm assuming you are using Flash Bulder 4 (previously known as Flex Builder), correct?
http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4
0
 
elepilAuthor Commented:
stage? You never said to change the parent from 'this' to 'stage'. I tried that and got a compile time error.

I tried creating a totally brand new project in Flex 4, and the alert box worked fine. Damn, what could've gotten corrupted?? I'm already a bit far into the project I'm currently working on, now I have to gradually copy the files over to a new project, and I don't even know what caused this anomaly to begin with.

But I am relieved that it isn't my Flash Builder 4 installation that's corrupt, but rather, just the project. I remember starting this project as a Flex 4, then converting back to Flex 3 using the Flex 3 compatibility mode. I don't know if that might have done something.

How are you finding Flex 4? I had to retract from it because I felt like Adobe sold me an unfinished product. They give me Spark components that do not have a one-to-one counterpart with the mx.controls components (e.g. no datagrid). Not only that, the Spark components' methods are a bit different, even absent in some of the abilities of the mx.control components.

And I wasn't too happy with what they did to the mx:states. I haven't gotten into using Flex 4 states yet, but it sounded convoluted. The Flex 3 states were so much more programmatically logical.

But I'd be interested in hearing your opinion about Flex 4, if you don't mind, before I close this?

Thanks.
0
 
IqAndreasCommented:
>stage? You never said to change the parent from 'this' to 'stage'. I tried that and got a compile time error.
Sorry, it was hidden in one of the posts as an additional suggestion in case changing the scale didn't work. But what error does that give you? Is it a "#1009" error? If so, it is quite easy to fix. Maybe also try writing "this.parent" instead.

If copying over the files to a new project still doesn't work, it's definitely somewhere in the code. Perhaps one of the display objects are "flipped", causing interference with the Alert? If so, we just need to keep going backwards (doing parent.parent etc) until we get to the parent that isn't flipped yet, as long as that doesn't interfere with your layout in any way.


To be honest, I actually don't use Flex unless I absolutely need to (which is practically never at all). I just don't often need to use forms in my AS3 projects. The times I have needed components, I have used MinimalComps, so I couldn't really give you a good opinion on Flex 4, sorry.
0
 
elepilAuthor Commented:
Ah, if your background is in AS3 applications, it isn't quite as easy to make a mistake in Flex to accidentally flip any display object backwards, especially an Alert Box. As I mentioned in my previous post, it was the project that was somehow corrupt because the Alert box displayed just fine in a totally brand new project.

Anyway, thanks for your time and help.
0

Featured Post

What Security Threats Are We Predicting for 2018?

Cryptocurrency, IoT botnets, MFA, and more! Hackers are already planning their next big attacks for 2018. Learn what you might face, and how to defend against it with our 2018 security predictions.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now