DragDrop Question With Alert.show

Hi Everyone,
I have some list controls which I have set the property dropEnabled="true".
<mx:HBox label="SMR Vessels" height="220" width="100%" horizontalAlign="left" dropEnabled="true">
  <mx:List id="ls1" width="100%" height="100%" dropEnabled="true" dragDrop="ls1_dragDrop(event)"  >
  </mx:List>
  <mx:List id="ls2" width="100%" height="100%" dragEnabled="true" dragMoveEnabled="false"  >
   </mx:List>
</mx:HBox>
private function ls1_dragDrop(evt:DragEvent):void
  // Get the data from the dragEvent parameter.
  objDragSource = evt.dragSource.dataForFormat("items");
  //.... Do some things
  //Call an alert.show function to confirm from user if proceed.
  Alert.show('Proceed?', 'TITLE', Alert.YES | Alert.NO, null, alertHandler, null, Alert.YES);
  // Some scripts here...but these are executed right away even before the alert.show's button is clicked.
When the alert message shows, the only recourse I have is to continue the operation in the alertHandler event.  But I how will I be able to reference the dragDrop event parameter from the alertHandler?
I am banging my head the whole day on this.  Shouldn't it be that the script after the alert.show only continue once the alertHandler has finished executing its scripts.  But apparently, with Flex, that is not the case since it executes the script after the alert.show was called concurrently with the alerthandler.
Inputs highly appreciated.
Thanks.

The alert handler is also declared in the same MXML file.
<mx:HBox label="SMR Vessels" height="220" width="100%" horizontalAlign="left" dropEnabled="true">
  <mx:List id="ls1" width="100%" height="100%" dropEnabled="true" dragDrop="ls1_dragDrop(event)"  >
  </mx:List>
  <mx:List id="ls2" width="100%" height="100%" dragEnabled="true" dragMoveEnabled="false"  >
   </mx:List>
</mx:HBox>
private function ls1_dragDrop(evt:DragEvent):void
  // Get the data from the dragEvent parameter.
  objDragSource = evt.dragSource.dataForFormat("items");
  //.... Do some things
  //Call an alert.show function to confirm from user if proceed.
  Alert.show('Proceed?', 'TITLE', Alert.YES | Alert.NO, null, alertHandler, null, Alert.YES);
  // Some scripts here...but these are executed right away even before the alert.show's button is clicked.
private function alertHandler(evt:CloseEvent):void
  if(evt.detail == Alert.YES)
    // Continue with the drag and drop processing here.
    // Take note that I need to reference the dragEvent parameter which was only visible in the ls1_dragDrop event.
  else
    // Here i should be calling the dragEvent's preventDefault function to prevent the drag and drop from happening since the user
    // does not confirm to proceed with the operation
I tried to declare a application level scope variable, and set the value, but the scripts after the alert.show are executed right away without checking the values set in the alertHandler event.  Thus, I am getting incorrect execution.

Similar Messages

  • Help with Alert.show()

    I need help with Alert.show(). My goal is to display a message box when a button is pressed.
    My program header:
    <?xml version="1.0" encoding="utf-8"?>
    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    actionBarVisible="true" fontWeight="normal" overlayControls="false"
    tabBarVisible="true" textAlign="right" title="tipCalc">
    //// start of script section:
    <fx:Script>
            <![CDATA[
            import mx.controls.Alert;
            import mx.events.CloseEvent;
    // show a message box when button pressed
    protected function about_clickHandler(event:MouseEvent):void
                Alert.show( "This is a message!", "Dialog Title" );    }
    This results in the errors below:
    Access of undefined property Alert.
    Definition mx.controls:Alert could not be found.  

    Well, me and my three days of Flash Builder are lost in the woods. I have no idea how to do what you suggest. The code Google's showing me seems to call for scrapping my working functional program and starting from scratch. For a message box.
    Can I add a message box to my existing code?
    Here's the header...
    <?xml version="1.0" encoding="utf-8"?>
    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    actionBarVisible="true" fontWeight="normal" overlayControls="false"
    tabBarVisible="true" textAlign="right" title="tipCalc">
    And here's theclickHandler that should call the popup.
        protected function about_clickHandler(event:MouseEvent):void
                    //  Call a message box.

  • Alert.Show WEIRDNESS

    OK, riddle me this, Batman:
    I've got a function (example attached) with a number of items
    running in it (alot of setting of variables, and outputting them to
    text areas and such). When I have an Alert.show call, all is well
    and the variables get set and output just fine.
    But when I remove or comment out the Alert.show call, the
    whole thing comes to a grinding halt and variables are not set.
    And here's the weird part (like the stuff above wasn't weird
    enough): the Alert.show can't be a hard-coded string, it has to be
    the value that one of the variables is being set to (in other
    words, the original value that was saved as a variable, not he
    variable itself).
    I've hit this now both in Flex 3 and Flex 3 AIR
    applications...
    HELP! (and thanks)

    I was having trouble with Alert.show and thought it was a
    problem with the function, too. But it was something I was doing.
    You don't say how myGameText is declared, but it seems pretty
    obvious. You might want to try enclosing variables in String() when
    you are passing them to functions that require strings. Like
    gmDate.text=String(myGame.@date);

  • Folder with question mark keeps showing on boot screen

    folder with question mark keeps showing on boot screen

    Click here and follow the instructions. If the computer was running Mac OS X 10.6.8 or earlier and you reach the third set of steps, insert a Mac OS X install disk.
    (120871)

  • Questions on Alert monitor

    Hi,
           I have few questions on alert monitor.
    1. If we create an alert and have it as default macro, does it display in interactive planning book without a alert profile assignment? or should we assign an alert profile to see alerts in planning book. I remember that we just need alert profile if we need to check the alerts in a separate screen for our convenience.
    2. Is alert profile assignment specific to a user? If that's so, then how we assign different profiles to different users? any transaction? or are they specific to a selection or planning book or version?
    3. In Application specific alert profile, in SDP tab, under "SDP - Database Macro Alerts", I see few alerts types apart from standard ones. These were actually our previous alert macros. How did they get created like a alert type?
    4. I created a simple macro with change color of cell to red if a condition is satisfied. Also raise an alert for that and assigned it to default. When I go back to the SDP94 screen and run the macro, my cells are highlighted as red whenever the condition is satisfied but when I click on the alerts icons, I get a blue information message "No alerts exist for your selection". When I click on the icon, it gives me a window saying " Internal error analyzing SDP alert".
    Can somebody help me understand what's going wrong?
    Thanks.

    I think you can select that standard type.
    However since it was SAP delivered, we chose not to, and instead created more line items in SPRO with text such as "Alert Message 1" etc. We created numbers ranging from 9001 to 9010. While defining the custom alert, under alert type, it showed up these numbers that were setup in SPRO. I would assume that just like you pick up 9001, you should be able to pick up 4100 or 4101 (alert type numbers) which is the standard status alert. If you run out of the numbers, you would definitely need to add more in SPRO settings. Remember the alert text is picked from SPRO, where you can change and make it more meaningful so that users can do sorting on those alerts.

  • Does Alert.show put a message on the screen, or not?

                            var year:int;
                            var days:int;
                            days = 0;
                            year = 2010;
                            if (year > 2099)
                                  Alert.show("Unable to calculate day number for years beyond 2099.");  // Because, for example, 2100/2/29 will not exist
                            var T0:int;
                            T0 = days + ((year - 1964) / 4) * (3 * 365 + 366);  // This oomplex expression is evaluated incorrectly, so I have broken it down to help the compiler out
                            var T1:int;
                            var T2:int;
                            var T3:int;
                            var T4:int;
                            T1 = year - 1964;
                            T2 = T1 / 4;
                            T3 = 3 * 365 + 366;
                            T4 = T2 * T3;
                            days = days + T4;
                            if (T0 != days)
                                  Alert.show("Fault in evaluation because " + T0.toString() + " does not equal " + days.toString());

    Yes, and http://livedocs.adobe.com/flex/3/html/help.html?content=03_Language_and_Syntax_11.html reports that the int data type was added to Adobe Flex to improve performance when the programmer knows only integers shall be dealt with.   The livedocs page, to which you refer, was written before there even was an integer data type.  There is definitely something wrong with the way Adobe's software handles complicated integer expressions.    I did try changing all int data types to Number data types.   The complicated expression is handled properly in that case.
    The int data type is stored internally as a 32-bit integer and comprises the set of integers from
    -2,147,483,648 (-231) to 2,147,483,647 (231 - 1), inclusive. Previous versions of ActionScript offered only the Number data type, which was used for both integers and floating-point numbers. In ActionScript 3.0, you now have access to low-level machine types for 32-bit signed and unsigned integers. If your variable will not use floating-point numbers, using the int data type instead of the Number data type should be faster and more efficient.

  • I have a iPad mini, I recently acquired a $15 iTunes card to get apps and music. I have forgotten my security questions and I cannot buy anything HELP (I tried to reset them in the Password and Security tab but the text under the questions does not show)

    I recently acquired a $15 iTunes card to get apps and music. I have forgotten my security questions and I cannot buy anything HELP (I tried to reset them in the Password and Security tab but the text under the questions does not show)

    Apple ID: Contacting Apple for help with Apple ID account security
    http://support.apple.com/kb/HT5699?viewlocale=en_US&locale=en_US
    Try the link above. Try to find a phone number for your country, call and ask for account security.

  • How to pass parameter to function when confirm(Alert.show) closed?

    <![CDATA[
    import mx.controls.*;
    import mx.events.*;
    private function deleteItem(guid:String):void
    Alert.show("Are sure you want to delete?", "Confirm Delete", Alert.YES|Alert.NO, this, alertClicked);
    private function alertClicked(event:CloseEvent) {
    if(event.detail == Alert.YES) {
      Alert.show("yes "+guid); //<-- here I want to get guid
    else if (event.detail == Alert.NO){
      Alert.show("no ");
      return;
    ]]>
    Thanks.

    Hi Itambs,
    You can do the following:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="deleteItem('Dummy GUID VALUE')">
    <mx:Script>
      <![CDATA[
       import mx.controls.*;
       import mx.events.*;
       private var myAlert:Alert;
       private function deleteItem(guid:String):void
        myAlert = Alert.show("Are sure you want to delete?", "Confirm Delete", Alert.YES|Alert.NO, this, alertClicked);
        myAlert.data = guid;
        myAlert.height = 150;
                    myAlert.width = 300;
       private function alertClicked(event:CloseEvent):void{
        if(event.detail == Alert.YES) {
           //Alert.show("yes "+guid); //<-- here I want to get guid
           Alert.show("yes "+ myAlert.data);
        else if (event.detail == Alert.NO){
           Alert.show("no ");
           return;
      ]]>
    </mx:Script>
    </mx:Application>
    Note: you can also do this in another way by decalring a global variable guid as ...... private var _guid:String="";
    set _guid = guid; in deleteItem() function and then in alertClicked() function you can access the value as _guid again...which holds the saved value...
    If this post answers your question or helps, please kindly mark it as such.
    Thanks,
    Bhasker Chari

  • Crashing whenever using mx.controls.Alert.show

    Flex Project: Desktop (AIR)
    Flex SDK: 4.1
    Flash Builder 4
    Problem: Whenever I use Alert.show even with the simplest strings passed it crashes showing the following error:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at mx.controls::Alert$/show()[E:\dev\4.x\frameworks\projects\framework\src\mx\controls\Alert.as:566]
    And it is pointing at Alert.as line:
    var sm:ISystemManager = ISystemManager(FlexGlobals.topLevelApplication.systemManager);
    How do I use this? What's wrong? Any fix?

    It sounds like you're referencing a NULL object somewhere.  Any chance you could provide us with some sample code?  I just successfully tried the following out:
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                                xmlns:s="library://ns.adobe.com/flex/spark"
                                xmlns:mx="library://ns.adobe.com/flex/mx"
                                applicationComplete="init()">
         <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
         </fx:Declarations>
         <fx:Script>
              <![CDATA[
                   import mx.controls.Alert;
                   public function init():void
                        Alert.show("This is a test", "My Alert");
              ]]>
         </fx:Script>
    </s:WindowedApplication>
    Thanks,
    Chris

  • Alert.show and popups not displaying text in flex4 compatibility

    I'm using the Fx4 SDK in compatiblity mode to compile my Fx3 applications; everything seems ok, but for popups.  No text is being displayed by any popup, not my custom titleWindow popped up with PopUpManager.createPopUp() nor my Alert.show boxes... Why could this be happening?
    thanks,
    gtb

    To fix this I did the following:
    1. remove the compatibility directive:
    -compatibility-version=3.0
    2. add as an additional compiler option the following directive
    -theme PATH_TO_FX4SDK/frameworks/themes/Halo/halo.swc
    3. change the namespace on my css file.
    for the standard flex components:
    @namespace "library://ns.adobe.com/flex/mx";
    and for my custom components
    @namespace "*";
    finally make your application's framework conform to Flex4SDK.
    gtb

  • Alert.show on Air application

    Dear Flexer,
    I made an transparent Air application with no chrome.
    With those configuration, I have a problem with alert window.
    Indeed, if i try to use an alert.show anything appear on screen.
    I thinks that this problem appear because on my application only menubar appear.
    So as I work on Flex 4 with Macintosh system, I try to do Alert.show("Souhaitez-vous quitter MonAppli?", "Quitter     l'application", Alert.OK | Alert.
                    CANCEL, Sprite(FlexGlobals.topLevelApplication);
    But no alert on screen
    Is anyone have a solution to solve that mistake?
    Thanks for your help.

    Post a 20-line test case.

  • Alert.show causing IE to crash

    I have an alert that I want to show as a confirmation to exit
    my application. The alert works fine in Firefox, however when I run
    it in IE the application and IE crashes hard.
    Below is the code I tried:
    public function exitClick():void {
    Alert.show("Are you sure you want to exit Application?",
    "Exit Application", 3, null, exitPinpoint, iconExit);
    The code below works fine, it just puts an ok rather than the
    YES NO that I want.
    public function exitClick():void {
    Alert.show("Are you sure you want to exit Pinpoint?", "Exit
    Pinpoint");
    After messing with this for an hour or so, the crashing is
    dependant on placing some button other than ok in the alert. I
    tried many variations of instantiating an alert and all of them
    failed miserably. I also wrote a smaller test application and added
    an alert that worked just fine?
    I copied the popup manager code into my project and it was
    failing on the line in the middle...
    This code is in the AddPopup method of the PopupManager
    Class:
    children = topMost ? sm.popUpChildren : sm;
    children.addChild(DisplayObject(window));
    window.visible = false;
    Text
    Any help / ideas on how to resolve this would be greatly
    appreciated.

    It is possible to turn off such things as automatic updates and scheduled tasks to avoid interference with your LV code.  As a matter of course, each new PC I use in a project (typically a new Dell of some sort) ends up having all of the "Value Added" software removed, all automatic updates disabled, and many services switched to "manual" start or disabled.
    Although msconfig.exe does not ship with XP, it is compatible and can be used to prevent programs from running on Windows start up.  Tweak UI is also a useful tool in getting XP to perform faster and with more stability.
    As a Linux enthusiast for the past eight or so years, I have to give it it's due.  But I've found that developing in LabView on that platform is quite limited.  Depending on the "flavor" you choose, Linux on a desktop isn't entirely bombproof either.  To really get stability and speed from a Linux system, you either need exactly the right distribution or you need to customize and re-compile your own kernel.  Keep in mind that if you do switch to Linux, only certain versions are supported by LabView.  
    Believe it or not, I've got Windows systems (mostly tweaked versions of 2000) that have not been rebooted in countless months.       
    Years ago when I was always tweaking my Windows machines for gaming, I found a utility called 98Lite that was very useful.  I once had an old PII laptop just blazing.  http://www.litepc.com/ is the name of the of the software company I believe.  They now have versions for 2000 and XP, although admittedly I have yet to try them.
    Good luck!
    Patrick Allen

  • What's up with "Alert" messages?

    Hi guys.
    It may sound silly I know, but it looks like I'm not able to use Alert messages...
    I built an extension using Flash Builder and Extension Builder and sometimes I simply use "Alert.show('Muy message')" in order to quickly debug some value but within the extension I can't see anything.
    What's the matter with this?
    Thanks!

    Try this: Alert.show("My Message", "Title", Alert.OK,   Sprite(mx.core.Application.application));
    It's kind of hidden, but the docs explain this in the "Bringing up Alert dialogs from an extension" section, which you can find here: http://cssdk.host.adobe.com/sdk/1.0/docs/WebHelp/programmers_guide/customizing_the_ui.htm.

  • Alert.show() interesting behaviour

    I use multiple SWFs loaded in one main SWF. Each SWF is form
    and its form is linked to a class that extends the form class.
    Most of the forms use a base class. The base class includes a
    prompt function that calls Alert.show(). The form class calls the
    prompt function and when used within the SWF itself it works as
    expected but when the SWF is loaded in a movieclip of the main SWF
    then the message becomes the title and the title becomes the
    message and everything else seems to be find.
    I cannot figure out what the fuddle doddle is going on.
    I know that some V2 components don't behaves as expected when
    used in a SWF loaded into another SWF such as the ComboBox
    component that requires a _lockroot to expand its list when clicked
    if it's SWF is loaded into another SWF.
    I suspect the same type of weirdness is going on with the
    Alert component. I do have the _lockroot set but no cigars.
    I also imported the mx.controls.Alert class in both, the base
    class and the form class with no success.
    Does anyone know how to make this work?
    Also, dos anyone knows of a list of SWF loaded into another
    SWF V2 component quirks and their solutions if any?

    I should add that if I use Alert.show() directly from the
    form class the it is working fine. It is only when I use it in a
    base class function such as 'prompt' called from the form class
    that it flips the message and title.

  • Mx.controls.Alert.show windowHeight

    Hello All
    I am trying to set windowHeight for my alert component.
    Below a snippet but does not seem to work any suggestion
    greatly appreciated
    Adam
    var myAlert;
    myAlert = mx.controls.Alert.show("Please
    select:\n"+msg+"","Info", {windowHeight: 400});
    trace(myAlert.windowHeight); // This comes up undefined
    myAlert.windowHeight = 400;
    trace(myAlert.windowHeight);// This comes up 400 but does
    not change alert size

    It sounds like you're referencing a NULL object somewhere.  Any chance you could provide us with some sample code?  I just successfully tried the following out:
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                                xmlns:s="library://ns.adobe.com/flex/spark"
                                xmlns:mx="library://ns.adobe.com/flex/mx"
                                applicationComplete="init()">
         <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
         </fx:Declarations>
         <fx:Script>
              <![CDATA[
                   import mx.controls.Alert;
                   public function init():void
                        Alert.show("This is a test", "My Alert");
              ]]>
         </fx:Script>
    </s:WindowedApplication>
    Thanks,
    Chris

Maybe you are looking for

  • Issue with MacBook Pro Toolbar

    I am used to seeing the name of the program that I was using (next to the Aple logo at the tp). However, in my MacBook pro I do not see it.  Your assitance is much appreciated.

  • Image preview thumbnails suddenly not displaying: just generic .jpg

    I have a series of folders containign images. I surf through them all the time using the Finder in Icon mode, where I can see the image itself as the thumbnail. For some reason now all I'm getting is the generic file format image (in this case, .jpg)

  • CUC 8.5 Call transfer fails

    Hi, We have CUC 8.5 integrated with CUCM 8.6. We are trying to deploy the autoattendant with following prompt " If you know your party's extension, please dial it now or dial 0 for operator". It plays the prompt properly but when you press 0 (or any

  • Transfer music from ipod to laptop

    how do I trNSFER MUSIC FROM IPOD MINI TO LAPTOP

  • How can i have my aperture projects load into toast?

    Since iDdv is no longer spported and i was told that "Toast Titanium11" was the most compatible dvd creating app availible.  But the issue I'm having is none of my project is aperture are appearing in the toast photos, media or iphotos screen.  Even