Actionscript 3 :: Flex4 - Call Alert.Show In A Function And Want To Get The Result From There?
Nov 14, 2010
I'm using the Alert.show in a function and I want to get the user answer from there. So how can I achieve this. The problem is the function that call Alert.show will return a true or false value depend the user answer.but It seem that in Alert.show it only allow to pass in a CloseHandler for this. that is a new function. and since that I can get the user answer from where it is call to return the user answer.
I'm trying to do a test on the length of a string and then call a function depending on the result. This is the pertinent excerpt from the fla file:
Code: _loc4._comment = candles[_loc3].comment; // I want to find out the length of _comment and call differently depending _loc4.onRollOver = function () { if (_loc4._comment.length > 0 && _loc4._comment.length < 60) { show_comment(this._comment, this._x + this._parent._x, this._parent._parent._y - 50); } else { show_comment(this._comment, this._x + this._parent._x, this._parent._parent._y - 100); }};
Basically I want to check the length (in characters) of _loc4.comment and if its under 60 call with an offset of 50 and if its not call with an offset of 100.
When click on a button, I want to show 3 textfields in form of alert which also has ok and cancel buttons.When clicked on ok button, i want to display the text in 3 textfields in tfMain textfieldSorry i might have used wrong terms as i m not an expert in this.
Adobe AIR provides Alert.show(). However this seems to fail if there is no top level window like in the typical tray example ("Example: Creating an application with no windows"):
[URL]
I failed to make Alert.show() work in this situation. Seems that there is no alert() either.Is there any way to show an alert prompt (modal or nonmodal) in such a situation without reinventing the wheel?Example AIR tray application skeleton:
I am creating an application using flex mobile but could not find how to show alerts using flex.So can anyone please tell how to show the alert in flex mobile , mx alert don't work in this and i could not find an alternative in spark.
I want to show PDF in Flex AIR. I have done this with HTML components but the problem is that whenever I view the PDF in Flex HTML component the popup or Alert goes behind the component.
Functionnaly : On one of my components of my application, I have an editing/lock system. When a user starts editing, he locks the file so other users cannot edit it.
Problem scenario : When the user activates "edition mode" and leaves screen, I would like to show a alert with two options : save changes, or discard changes.There are different ways to exit screen :
There is a List on the left side containing other possible editabel data. A click changes the data in my component.
There is a menubar on top leading to other screens.
The edition component is embedded in a Tab navigator. When changing tabs, the alert has to show. Closing browser.
Do I have to catch all of these events and plug at all those places?
I'm working on a project for a User Interface Design class, so the emphasis is on the UI being as nice to use and non-annoying as possible. I would like to display a message to the user after they've clicked save, for example, without requiring them to click an OK button. I'm thinking of the kind of thing you see in gmail if you send a message or do some other actions, where a message appears on the screen, but the message disappears after you do something else.
I'm sure there's a way to do this in Flex (I'm using 4.6), but I just don't know what it is. I'm pretty new to Flex and I'm having trouble finding anything via Google, because the results keep showing confirmations messages in Alerts; I don't know the search terms to get the results I'm looking for.
I created an event handler to override the tab and tab + shift functionality, as tabIndex was not working as I expected it to. (I have some dynamic check boxes and it was taking two tabs to get into the VBox group and a couple of other anomalies).
I added some alert boxes so I could see what the current target is, now I have the functionality working perfectly...but when I remove the alert boxes the tab and shift/tabs do not work.
I tried to replace the alerts with trace's to no avail. I also tried to enclose the code around a switch statement and add breaks.
In my flex 4 project I am using some Spark TextInput components. It doesn't show copy and paste in the right click menu by default. The user needs to copy some text and paste into it. How can we enable this?
I have a colleague who will be using Adobe Flex and adobe flash builder to design the application. The final application will be in that software. I am creating the database features and testing them using online browsers.What I want to know is that some alerts I am getting a 'prevent this message from multiple dialogues' message on the alert but this is because of the browsers. But if the application is on flex and flash builder (I don't know which one is where the app is stored coz I have never used it) then will that message appear on some alerts in that software or is it only on browsers?[code]
I think I remember hearing that you can trigger a java alert message from within actionscript out to the html page but whats the code to do such a thing?
Everytime I try to do even an ExternalInterface.call('alert','abc'); (Which will work on every browser) I get an object doesn't support this property or method After the alert appears. It even happens in the HTML generated by flash without me touching it...
I want to display the result which is this "guess_txt.text.toLowerCase()+" is Correct"; then after a seconds of delay it will go on the next frame.
Here is my code : enter_btn.onRelease = function () { if (guess_txt.text.toLowerCase()== "waitress","waiter") { result_txt.text = guess_txt.text.toLowerCase()+" is Correct"; }else{ result_txt.text = "Sorry try again"; }}
If I parse an XML element with a null or undefined result, is it possible to display a blank text field rather than "null" or "undefined" in the field? It seems really basic but I'm drawing a huge blank.XML
If i would like the timer to stop on a specific frame and show the time result how do I do that?With some kind of if-else statement, or some kind of function.stop.
I'm using an AMF service that was built by someone else. Basically what happens is that some info is passed to the AMF service and it returns true or false.I want to be able to pass in various info to the a function that calls the AMF service(submitTracking) and then get the true or false value returned in onResultSubmit to be passed back to submitTracking.
var screen:String; var buttonnumber:String; function submitTracking(screen:String, buttonnumber:String) {
I have an HTTPService that executes the dataLoaded(e:ResultEvent):void function whenever it gets a result from a send() call. OK so If I call HTTPService.send() and then call HTTPService.send() again before the previous one receives a result, I end up repeatedly running dataLoaded() which is undesirable What I want is if HTTPService.send() gets called before a previous call to it returns a result. I want to cancel the first call, and only process the result from the last call to HTTPService.send()
I am having an issue where I show an AlertBox message when the user hits ENTER and the focus is in a text area. The pop up works fine, but when the user hits enter the Alert closes as expected, but the TextArea listener receives the ENTER event from the Alert and pops the dialog up again. I have tried a number of ways to catch and eat the event but so far I have not been lucky. Is there way to accomplish this?
public function init():void { myTextInput.addEventListener(KeyboardEvent.KEY_UP, handleKeyStrokes);[code]....
Since URLLoader is async, how to make sure the order of data from server side is the same as the loader.load() call? In other words, the data order in totalResults is the same order of url-related content?
Following is code snippet:
1.for each(var url in urls) { loadData(url); } 2.private function loadData(url:String):void {
I have a class called S3Uploader which extends Sprite, which has a private function init, which looks sometihng like this:
private function init(signatureUrl:String, prefixPath:String, fileSizeLimit:Number,[code].....
however, on the line where i call s3upload.init, i get a 1195 error saying "1195: Attempted access of inaccessible method init through a reference with static type S3Uploader."When i looked up this error, it seems like almost everyone getting this was trying to call a function with set or get. However, I am not doing this and i have no idea why i am getting this error.
In my AIR application in Flex 4, I use mx:HTML, and when I navigate to a location like this ut, some websites have "alert" function in javascript like this :lert('hello world!');nd AIR show the message in a box...I just want to remove, or ignore these messages, but I don't know how...
I have a function that checks for something when the user clicks a button. if that something is found, an alert comes up saying that it has been found and asks them if they would like to allow this to happen, or undo the action that caused the something to be found. the code looks like this:
Alert.show(thisString1, "Conflict: Multiple Projects", 3, this, conflictAnswer); upon pressing "Yes" or "No", the conflictAnswer function will be called... it looks like this: private function conflictAnswer(event:CloseEvent):void[code]....
but it didn't work.
EDIt: After reading the first respond, i've come up with this:
Coming from Robotlegs/PureMVC, I am pretty familiar with the concept of the view mediator, i.e. a component that pretty much listens to events/requests coming from the "dummy" view and makes a further request, sends an application-wide signal/event, executes a command, etc, based on the request from the view. Can the host component idea introduced in Flex 4 be considered a the same as a mediator? The only thing that slightly bothers me is that host components are still considered views, because they extend SkinnableComponent or any of the classes that further inherit from it. In my view, the mediator should be completely left out of view logic.
Nevertheless, I do not want to write a skin, a host component, and a view mediator for that host component, because that would be quite an overhead, and would lead to more complexity rather than abstraction.Should I use host components as mediators, and put application-level logic there, for instance application level event dispatching?
I have a site that has a button on it and someone did a little javascript so that each time you click the button you go to a randomly selected URL from an array of links. Now, I was told to give my flash button the same functionality. I'm not really a coder, so instead of re-inventing the wheel, I'm trying to get the result of the javascript into my action script. So far, I'm completely unlucky.
I ve a bit of missunderstood about functions: as i read the functions works:
basically 2 types: named (can be lonely) unamed (need and object)
- can i define a function wherever i want? ( _root, MC...) and call it from everywhere?, before or after i created it?
- if the variables of a function are local variables of that function. How can i store the result of a calculation of the function, in a variable outside it?