Solved

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

Posted on 2010-08-21
10
1,102 Views
Last Modified: 2012-05-10
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
Comment
Question by:elepil
  • 6
  • 4
10 Comments
 
LVL 8

Expert Comment

by:IqAndreas
ID: 33493643
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
 
LVL 8

Expert Comment

by:IqAndreas
ID: 33493645
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
 

Author Comment

by:elepil
ID: 33493664
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
 
LVL 8

Expert Comment

by:IqAndreas
ID: 33493680
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
 
LVL 8

Expert Comment

by:IqAndreas
ID: 33493684
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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:elepil
ID: 33493715
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
 
LVL 8

Expert Comment

by:IqAndreas
ID: 33493742
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
 

Author Comment

by:elepil
ID: 33493794
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
 
LVL 8

Accepted Solution

by:
IqAndreas earned 500 total points
ID: 33493878
>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
 

Author Closing Comment

by:elepil
ID: 33493906
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

New My Cloud Pro Series - organize everything!

With space to keep virtually everything, the My Cloud Pro Series offers your team the network storage to edit, save and share production files from anywhere with an internet connection. Compatible with both Mac and PC, you're able to protect your content regardless of OS.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now