Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
negttid #1
if/else tag syntax
Hello,
I know, how to do if/else in Actionscript, but how can I do something like
if/else in MXML syntax? I want to decide on startup/compile time, if or if not
to display a custom component, I made.
Can anyone help?
Regards,
Matthew
negttid Guest
-
Help with SYntax, Please!
I want the name of a product to show IF the Name field is NOT NULL AND if there's an image for that Record. Can anyone help? Here's the code... -
If than syntax help please
I'm trying to say: If price2 equals the selected price than apply the style bold price. If price 2 is nothing or zero than show nothing. If price... -
Syntax again - Help!
I have a movie clip instance named 22mc. Can anyone tell me why this is not good syntax: on (release) { with (_root.22mc) { play(); } } ... -
Syntax
Hi, In a subclass, is sub new() end sub the same as sub new() -
Help with DB2 Syntax.
Hi Everyone, Recently our comany upgraded their applications from MS ACCESS 2000 to DB2 version 7.2 UDB. I'm not as skilled in DB2 with the... -
negttid #2
Re: if/else tag syntax
To be correct, I can solve my problem with Actionscript, but I guess, there is
a solution with MXML Tag syntax only, which I do not know. And if there's none,
then there should be one:
in AS:
<mx:SomeParent id="someParent" />
if (CONDITION) { someParent.createChild(SomeChild, undefined, {arg1: value;
arg2: value}); }
in MXML (is there something like that?)
<mx:SomeParent id="someParent">
<mx:if test="{CONDITION}">
<mx:SomeChild arg1="value" arg2="value" />
</mx:if>
</mx:SomeParent>
negttid Guest
-
-
negttid #4
Re: if/else tag syntax
Tracy, that's true! I know, that there's no <mx:if> Tag, but there should be
one!
Imagine you retrieve data with an XML based dataprovider.
you want to show the <title value="something" /> within a <mx:Label> Tag.
You build your Application, and this Label should appear, when the data is
retrieved over an HTTPService...
Before it is retrieved, there should be no Label and no space used, like if
there is a Label.
Understand?
How do you do that?
Has someone an idea, how to implement an "if"-Class to have a <local:if> Tag?
;-)
negttid Guest
-
Dave Wolf #5
Re: if/else tag syntax
negttid wrote:
The point you are missing is that "if" isnt a class. It is an operator.> Tracy, that's true! I know, that there's no <mx:if> Tag, but there should be
> one!
>
> Imagine you retrieve data with an XML based dataprovider.
> you want to show the <title value="something" /> within a <mx:Label> Tag.
> You build your Application, and this Label should appear, when the data is
> retrieved over an HTTPService...
> Before it is retrieved, there should be no Label and no space used, like if
> there is a Label.
> Understand?
> How do you do that?
>
> Has someone an idea, how to implement an "if"-Class to have a <local:if> Tag?
> ;-)
>
Also realize that MXML is designed for layout, not conditional logic.
Let's say you did make a conditional tag... What order would it fire in?
--
Dave Wolf
Cynergy Systems, Inc.
Macromedia Flex Alliance Partner
[url]http://www.cynergysystems.com[/url]
Email: [email]dave.wolf@cynergysystems.com[/email]
Office: 866-CYNERGY
Dave Wolf Guest
-
negttid #6
Re: if/else tag syntax
Hi Dave,
that's right. it's conditional logic.> The point you are missing is that "if" isnt a class. It is an operator.
designed for layout - this must not be an obstacle!> Also realize that MXML is designed for layout, not conditional logic.
conditional in the way: to lay_out, or to not lay_out ;-)
What do you mean with "order" and "fire"?> Let's say you did make a conditional tag... What order would it fire in?
Perhaps I can't make myself understandable.
Compared my question for an <mx:if> Tag with a <mx:Repeater> Tag and a XML
dataprovider.
In the later case it is possible to do conditional logic with the help of
XPath conditions, e.g. node/[@arg='value'].
But I don't want to waste Repeaters, when all I want to show is a single
element or not.
I want to layout something in the way of a "INVISIBLE" placeholder. After
retrieving the data, I want to fill the 'something' and make it "VISIBLE".
Repeaters are shown only, when the DataPointer is defined (which is the case
after the data was retrieved). Before the data was retrieved, there is shown
nothing.
Labels are shown always - whether there is the text="" attribute set or not.
The Label take always the space of a lineheight.
I just want the label to occupy no space until it is filled.
Regards,
Matthew
sorry for my bad english
negttid Guest
-
pauland #7
Re: if/else tag syntax
Your intended use of if/else can be handled using states. Check out the help:
Use states and transitions. Control the interface by switching states. The key
to the problem is having an event to respond to to decide what state you should
be in.
Paul
pauland Guest
-
fatehkhan #8
Re: if/else tag syntax
Hey check this out, to insert if else condition in MXML OR Spark component.
I hope that will help you :)
http://www.fatehkhan.com/2011/03/13/use-if-else-condition-in-mxml-with-bindable-variable/
Junior Member
- Join Date
- Mar 2011
- Location
- Sydney
- Posts
- 2
-
fatehkhan #9
Re: if/else tag syntax
You can use if else condition in MXML/Spark components by using "inline if" statement:
<mx:VBox horizontalAlign="{checkBox.selected?'left':'center '}"
verticalAlign="{checkBox.selected?'top':'middle'}"
width="300" height="100" backgroundColor="#9715E8" >
I hope that will help you :)
Have a look here:
http://www.fatehkhan.com/2011/03/13/use-if-else-condition-in-mxml-with-bindable-variable/
Junior Member
- Join Date
- Mar 2011
- Location
- Sydney
- Posts
- 2



Reply With Quote

