Flex 4.1: alert button label is null.
When an Alert dialog was displayed its button showed the label “null” rather than the expected “OK”.
I tried to do this:
http://www.sapphiresteel.com/Tutorials/Amethyst-Tutorials/case-studies/article/debugging-i nto-the-flex-sdk
but it's not working
Please help.
example:
<?xml version="1.0"?>
<!-- controls\alert\AlertSimple.mxml -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
]]>
</fx:Script>
<s:VGroup>
<s:TextInput id="myInput"
width="150"
text=""/>
<s:Button id="myButton"
label="Copy Text"
click="myText.text = myInput.text;
Alert.show('Text Copied!', 'Alert Box', mx.controls.Alert.OK);"/>
<s:TextInput id="myText"/>
</s:VGroup>
</s:Application>
Similar Messages
-
How could I change the label of the standard Alert.OK Button
to "accept" for example ?
If I use Alert.show method its return an instance of Alert
object but there is no attribute that could be used to set the
label of a button showed in the Alert.
Help me
Thank you at all<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="horizontal">
<mx:Script>
<![CDATA[
import mx.controls.Alert
private function handleDefaultLabels():void
Alert.show("This is an alert pop-up using default button
labels",
null,Alert.OK|Alert.CANCEL);
private function handleCustomLabels():void
Alert.okLabel = "Sure"
Alert.cancelLabel = "No Way"
Alert.show("Tihs is an alert pop-up using custom button
labels",
null,Alert.OK|Alert.CANCEL);
]]>
</mx:Script>
<mx:Button label="Default Labels"
click="handleDefaultLabels()" />
<mx:Button label="Custom Labels"
click="handleCustomLabels()" />
</mx:Application> -
Trying to assign an XML attribute value to a button label
I have a Flex app (developed in FLEX 2) that reads from
multiple XML files and populates datagrids with element values.
What I'm trying to do now, is to create a second column with a
button, enabling users to view archived versions for each current
report.
My problem is: I can't get the <mx:Button> label to
accept the attribute "name". I've tried atleast 10 - 20 different
syntax.
My XML file looks like this:
<metrics>
<report name="test">
<link>test Report 10/28/2008</link>
<url>test-10_28_2008.zip</url>
<status>active</status>
</report>
</metrics>
The mxml looks like this:
<mx:Button buttonMode="true" useHandCursor="true"
click="handleClick()" label="{data.@name}" width="80">
<mx:Script>
<![CDATA[
public function handleClick():void{
var url:URLRequest = new
URLRequest([L=http://new.test.com/pages/r_archive_apps/"+data.link+".html");[/L]]http://n ew.test.com/pages/r_archive_apps/"+data.link+".html");[/L][/L]
navigateToURL(url,"_blank");
]]>
</mx:Script>
</mx:Button>
When I try to label a button with an element it works fine.
Some of the other sytax I've used are:
- label="{data.report.@name}"
- label="{data.report.(@name=='test')}"
- label="{data.report.(@name='test')}"
- label="{data.@name}"
- label="{data.metrics.report.@name}"
- label="{data.metrics.report.(@name=='test')}"
- label="{data.metrics.report.(@name='test')}"quote:
Originally posted by:
rtalton
Can you post some code so we can see how you are using the
button? I think you may be using the button within a datagrid
itemRenderer, which might make a difference.
You're right, the button is in a datagrid itemRenderer. I've
pasted more dataGrid code below - thanks again.
<mx:DataGrid id="dgCatalog" dataProvider="{_xlcCatalog}"
rowCount="4" editable="false" sortableColumns="false"
left="148" top="65" bottom="42" borderStyle="solid"
alternatingItemColors="[#ecf8ff, #ffffff]"
themeColor="#ffff80" alpha="1.0" cornerRadius="0"
dropShadowEnabled="true" dropShadowColor="#000000" width="549"
creationCompleteEffect="{glow3}">
<mx:columns>
<mx:Array>
<mx:DataGridColumn editable="false" headerText="Daily -
Report Names" dataField="link" textAlign="left" width="200">
<mx:itemRenderer>
<mx:Component>
<mx:LinkButton click="handleClick()" label="{data.link}"
>
<mx:Script>
<![CDATA[
public function handleClick():void{
var url:URLRequest = new URLRequest("
http://test.new.com/test/"+data.url);
navigateToURL(url,"_blank");
]]>
</mx:Script>
</mx:LinkButton>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn editable="false" headerText="Daily -
Report Archives" dataField="link" textAlign="left" width="80">
<mx:itemRenderer>
<mx:Component>
<mx:Button buttonMode="true" useHandCursor="true"
click="handleClick()" label="{data.report.@name}" width="80">
<mx:Script>
<![CDATA[
public function handleClick():void{
var url:URLRequest = new URLRequest("
http://test.new.com/pages/test_apps/"+data.link+".html");
navigateToURL(url,"_blank");
]]>
</mx:Script>
</mx:Button>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<!--mx:DataGridColumn headerText="URL" dataField="url"
width="350"/>
<mx:DataGridColumn headerText="Status" dataField="status"
width="70"/-->
</mx:Array>
</mx:columns>
</mx:DataGrid> -
How to add image as radio button label instead of text
In a pure AS3 project, is there a way to add use an image placed in the library/ Flex/AIR SDK compiler path instead of text as a radio button label?
I've tried substituting character may unicode like:
rb1.label = String.fromCharCode("0x2592");
But how this displays is dependent on the device, font character availability. Displays unpredictably.
Would prefer anyway to use an image that I can create in AI.
Any help appreciated.OK. I tried this, and it works.
(Hopefully, the image will display in the same location, next to the radio button, on different devices.)
Thank you. -
Hi,
I am new to Flex 2 world but even my question seems a bit
funny to me. I'm trying to create a square button (width=200 by
height=200) and I want the label inside the button to be in one of
the top corners. At this point I don't care if it's in the left or
right top corner.
I've tried everything and I was only able to get the label to
be left aligned using the TextAlign property but I can't seem to
figure out how to Vertically align it to the top.
any help you be greatly appreciated.
Incase someone needs to see the mxml code to understand what
I'm doing, here it is: (LOL)
<mx:Button label="topleft" width="200" height="200"
textAlign="left"/>
Also, I've tried to put a <mx:Label> right after this
button and using the x/y co-ordinates, place it on TOP of the
button and that works but then when I mouseover the label it looses
the mouseover the button (which is obvious).
HELP! :)The paddingTop worked. I just had to set it top a negative
value :) I feel like I had to "cheat" to get this working :)
Thanks a lot! -
Hi,
In apex 3.0 can I have a button which changes dynamic? e.g. if an item is null then the button label to be 'tes' else button label 'ok'?
Thank youHi,
Maybe easiest way is create 2 buttons and set condition for those.
Use condition when item in expression 1 value is / value is not in expression 2
Regards,
Jari
http://dbswh.webhop.net/dbswh/f?p=BLOG:HOME:0 -
Unicode dingbats for button labels?
I really want to use unicode dingbats as my button labels, but Flex won't play ball. Well, not on Windows anyway. It works fine on Mac.
I found a ttf with the unicode dingbats in it called Symbola and embedded it into the swf (as "Symbolax" to make sure it was picking up the embedded version and not the system one). It works fine if I use it for an mx:Text, but it doesn't work as a button label. Example:
<mx:Button width="30" height="100" label="❯" textRollOverColor="#ffffff" fontFamily="Symbolax"/>
<mx:Text text="characters are fun ❯" fontFamily="Symbolax" />
Results in:
You can see that the Text control is using the embedded font, but the button label isn't. On Mac, it works fine without embedding any fonts. Help!Sorry, I just noticed that your button width isn't really wide enough for the text label and it is displaying a tool tip. The toolTip uses the default Arial font (I think), so you'll need to do some CSS-ery to display the tool tip in your specified font if you want it to appear correctly. A slightly better example is probably:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Style>
@font-face {
src: url("Symbola.otf");
fontFamily: Symbolax;
fontWeight: normal;
Button {
fontFamily: Symbolax;
fontWeight: normal;
textRollOverColor: white;
Label {
fontFamily: Symbolax;
ToolTip {
fontFamily: Symbolax;
</mx:Style>
<mx:Button label="❯" width="30" height="100" />
<mx:Text text="characters are fun ❯" />
</mx:Application>
Peter -
Get button label using 'getElementAt()'
Hello!
I have 100 buttons in a container and I'm trying to get label of one of them. The problem: getElementAt() returns IVisualElement and it doesn't have label property. It returns other properties right.
This line: if (cellContainer.getElementAt((row - 1)*10 + col-1).label == 'X')
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="640" height="480" addedToStage="init()" backgroundColor="#CCAAAA">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.core.IVisualElement;
import spark.components.Button;
private function init():void
for (var i:uint = 0; i < 100; i++)
var myCell:Button = new Button();
myCell.width = 32;
myCell.height = 32;
myCell.label = 'O';
myCell.addEventListener(MouseEvent.CLICK, clickCell);
cellContainer.addElement(myCell);
public function checkForWinner():void
var sameMarkerInARow:uint = 0;
for (var row:uint = 1; row < 11; row++)
sameMarkerInARow = 0;
for (var col:uint = 1; col < 11; col++)
if (cellContainer.getElementAt((row - 1)*10 + col-1).label == 'X')
sameMarkerInARow++;
}else{
sameMarkerInARow = 0;
if (sameMarkerInARow == 5){
trace('WINRAR');
break;
private function clickCell(event:Event):void
event.currentTarget.label = 'X';
checkForWinner();
]]>
</fx:Script>
<s:TileGroup id="cellContainer" x="10" y="10" width="320" height="320" horizontalGap="0" verticalGap="0" rowHeight="32" columnWidth="32" requestedRowCount="10" requestedColumnCount="10">
</s:TileGroup>
</s:Application>
Thanks!Try either of the following and tell me if it works
1. Button(cellContainer.getElementAt((row - 1)*10 + col-1)).label=='X'
2. var button:Button=new Button()
button=cellContainer.getElementAt((row - 1)*10 + col-1) as Button
if (button.label == 'X') -
How to change button label while loading content
I have this basic example with toggle buttons:
public class test extends Application
@Override
public void start(Stage primaryStage)
final VBox vbox = new VBox();
String pillButtonCss = DX57DC.class.getResource("PillButton.css").toExternalForm();
// create 3 toggle buttons and a toogle group for them
ToggleButton tb1 = new ToggleButton("Left Button");
tb1.setId("pill-left");
ToggleButton tb2 = new ToggleButton("Center Button");
tb2.setId("pill-center");
ToggleButton tb3 = new ToggleButton("Right Button");
tb3.setId("pill-right");
final ToggleGroup group = new ToggleGroup();
tb1.setToggleGroup(group);
tb2.setToggleGroup(group);
tb3.setToggleGroup(group);
// select the first button to start with
group.selectToggle(tb1);
final Rectangle rect1 = new Rectangle(300, 300);
rect1.setFill(Color.DARKOLIVEGREEN);
final Rectangle rect2 = new Rectangle(300, 300);
rect2.setFill(Color.LAVENDER);
final Rectangle rect3 = new Rectangle(300, 300);
rect3.setFill(Color.LIGHTSLATEGREY);
tb1.setUserData(rect1);
tb2.setUserData(rect2);
tb3.setUserData(rect3);
group.selectedToggleProperty().addListener(new ChangeListener<Toggle>()
@Override
public void changed(ObservableValue<? extends Toggle> ov, Toggle toggle, Toggle new_toggle)
if (new_toggle == null)
else
vbox.getChildren().set(1, (Node) group.getSelectedToggle().getUserData());
HBox hBox = new HBox();
hBox.getChildren().addAll(tb1, tb2, tb3);
hBox.setPadding(new Insets(10, 10, 10, 10));
hBox.getStylesheets().add(pillButtonCss);
vbox.getChildren().addAll(hBox, (Node) group.getSelectedToggle().getUserData());
StackPane root = new StackPane();
root.getChildren().add(vbox);
Scene scene = new Scene(root, 800, 850);
primaryStage.setScene(scene);
primaryStage.show();
public static void main(String[] args)
launch(args);
I noticed that if I put heavy business logic into the buttons while I switch the buttons it appears that the application hangs.
Is it possible to display "Loading.." instead of the button label while I switch the buttons?Welcome to the world of multithreaded programming in JavaFX...
It's generally a mistake to perform any long-running task in the FX Application thread, as it will cause the UI to hang while it's running. You should use the javafx.concurrent package to perform background tasks; the Task class in particular will be useful to you. The javadocs have plenty of examples.
Note that it's also a mistake to modify the UI from a background thread, and that your Task implementation's call(...) method will be executed on a background thread. The Task class provides setOnSucceeded, setOnFailed, setOnCancelled methods to register a handler whose handle(...) method will be executed back on the FX Application thread.
For example, the basic strategy to respond to a button press by updating the UI, launching a long-running process, and then updating the UI with the results of that process is as follows. Replace 'T' with any data type.
myButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
final Task<T> longRunningTask = new Task<T>() {
@Override
public T call() {
// perform long running operation:
T result = computeResult();
return result ;
longRunningTask.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
@Override
public void handle(WorkerStateEvent event) {
// get result of long running operation:
T result = longRunningTask.getValue();
// now update UI on basis of result to indicate task is complete
// update UI here to indicate task is about to run...
// now start task:
Thread t = new Thread(longRunningTask);
t.setDaemon(true);
t.start();
There's a bunch of other functionality in Task, such as a progress property and a message property. These can be bound, and updated on the FX Application thread via the appropriate updateXXX(...) methods. -
With the Alert control is it possible to change the text of
the Alert buttons so instead of having OK, Cancel, Yes or No you
can define your own? e.g. Proceed To Checkout and Continue
Shopping?
Thanks
Katy"g-s-b" <[email protected]> wrote in message
news:g74r1l$39b$[email protected]..
> Yes.
> I think it is like: Alert.OK = "new ok text";
>
> ...but you should look it up in the help files.
>
This might help improve the efficiency of your Help searches:
http://flexdiary.blogspot.com/2008/07/getting-help-in-flex-builder.html -
I would like to have an email account that is password-protected that I can access on my Mac, Iphone and Ipad, separate from the Mail application, with an alert button that indicates unread messages
Try a search... I'm sure if you put forth a little effort you can find a solution that will work for you.
-
I would like to have an email account that is password-protected that I can access on my Mac, Iphone and Ipad, separate from M, with an alert button that indicates unread messages
Try a search... I'm sure if you put forth a little effort you can find a solution that will work for you.
-
Special characters not displaying in button label
My production environment is: Oracle Forms 6i connecting to an Oracle 8i database. Forms are Windows client/server. In a form there is a layout of buttons like a QWERTY keyboard. And in the property palette information for each data block, the item is of type "Push Button" and the default Label is set to a specific number which correlates to what that number translates into a special character (i.e. Portuguese, or Spanish characters). So example: CHR196 label = "196". So when at runtime. The following command is executing upon seeing this canvas:
Set_Item_Property('CHR196', LABEL, CHR(196));
So in Forms6i the CHR(196) comes out to be a letter in the alphabet from either Spanish or Portuguese and shows up perfectly.
But NOT in 11g. That environment I'm in is:
Oracle Fusion Middleware Forms 11g on RHEL5 (Red Hat Enterprise Linux version 5) on a 32-bit platform
connecting to
Oracle Database 11g on RHEL5 (Red Hat Enterprise Linux version 5) on a 64-bit platform
using a
Windows based browser (IE7 - Internet Explorer 7).
Could it be due to the forms being in a JVM (Java Virtual Machine)? All I see is a small "square" and this shows up on ALL the button labels. Could it be the NLS_LANGUAGE format of the database? Because when I run the query : SELECT CHR(196) FROM dual on 8i or 11g, the proper character shows up in TOAD or SQL+.
Thanks,Hello Paul,
I once used hexadecimal coded characters like &xnnn; and they were not transformed. When coding them in decimal, everthing worked fine.
Hth
J�rg -
how we can show the following data in a flex tree (without having any
label field) ?
<?xml version="1.0"?>
<rootNode>
<childNode>
< subchildNode >
<valueNode>1000</valueNode >
< valueNode >999-888-777</valueNode >
< valueNode >STORTZ</valueNode >
< valueNode >PAM STORTZ</valueNode >
< valueNode >88 ST. MORTON ROAD</valueNode>
</subchildNode>
</childNode >
</rootNode >as is - no how
wrap those xml chunk with a class having clear public properties like:
public class dataRecord {
protected var xml:XML;
function dataRecord(xml:XML) {
this.xml = xml;
public function get id ():String {
return XML(xml.descendants("valueNode")[0]).toString();
// and so on
simpliest way is to change xml structure to use attributes than wrapping that thing with AS code, it's time consuming and non efficient. -
Trapping - "Do you want to save changes" alert button pressed
When exiting a data block with unsaved changes, the user is prompted with "Do you want to save the changes you have made ?" The possible button click responses are "Yes", "No", "Cancel"
Is there a way to programmatically catch the click on the "Cancel" button ?
Oracle Forms 10gThanks for the suggestion W1zard. Here is the solution that I have come up based on the recommendation.
Essentially I create my own custom alert that mimics the system generated alert. In this manner I am able to control the behavior based on the alert button pressed by the user. This method also suppresses the system generated alert, so the user isn't prompted twice.
At the form level I have created the KEY-EXIT and the KEY-ENTQRY triggers. Additionally I created an ALERT titled SAVE_CHANGES with buttons Yes, No, Cancel.
h4. KEY-EXIT Trigger
DECLARE
alert_id ALERT;
alert_button NUMBER;
BEGIN
IF :SYSTEM.FORM_STATUS IN ('CHANGED') THEN
alert_id := FIND_ALERT('SAVE_CHANGES');
alert_button := SHOW_ALERT(alert_id);
-- ALERT_BUTTON1 is Yes, ALERT_BUTTON2 is No, ALERT_BUTTON3 is Cancel
IF alert_button = ALERT_BUTTON1 THEN
EXIT_FORM(DO_COMMIT);
ElSIF alert_button = ALERT_BUTTON2 THEN
EXIT_FORM(NO_COMMIT);
ELSE
RAISE FORM_TRIGGER_FAILURE;
END IF;
ELSE
EXIT_FORM;
END IF;
END;h4. KEY-ENTQRY Trigger
DECLARE
alert_id ALERT;
alert_button NUMBER;
BEGIN
IF :SYSTEM.FORM_STATUS IN ('CHANGED') THEN
alert_id := FIND_ALERT('SAVE_CHANGES');
alert_button := SHOW_ALERT(alert_id);
-- ALERT_BUTTON1 is Yes, ALERT_BUTTON2 is No, ALERT_BUTTON3 is Cancel
IF alert_button = ALERT_BUTTON1 THEN
COMMIT_FORM;
ENTER_QUERY;
ElSIF alert_button = ALERT_BUTTON2 THEN
CLEAR_FORM(TO_SAVEPOINT);
ENTER_QUERY;
ELSE
RAISE FORM_TRIGGER_FAILURE;
END IF;
ELSE
ENTER_QUERY;
END IF;
END;
Maybe you are looking for
-
Video out after using Apple Video adapter.
Hi, I have an Mac G5 17" iSight and after I mirror'd my screen to my TV using an Apple video adapter (something I've done hundreds of times before) the computer screen wouldn't change back to the general screen resolution (also something it used to d
-
i want to NEW USER excute procedure which is other schema! i want not to use prefix for execute procedure! how to set NEW user privilege? null
-
We will be setting up suppliers to use SMI. In our ECC system, we will have purchase contracts by plant, but PIRs by Purchase Org (so a PIR can span multiple plants). When a supplier creates a Replenishment Order in SNC, how will the resulting PO de
-
Replacing consolkit's function with systemd
The arch wiki says that it is possible to replace consolekit's function with systemd. https://wiki.archlinux.org/index.php/Sy - r_sessions Has anyone already done this? I guess there are other packages which have to be recompiled? e.g. gdm and gnome-
-
After six full days of frustration, I made a wonderful discovery about why I was constantly getting the buffer underrun notice, in IDvd, ITunes, Toast, Finder and yes Utility Burn!!!! It was the Media stupid!!! (Thats for me) I was using Apple blanks