Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
cheftimo #1
Evaluating a variable that contains a variable
Hello, all:
I have a bindable variable that contains the name of another variable that I
want to return. Example:
[Bindable]
var price:String = "dollars";
[Bindable]
var dollars: Number = "10.00"
If I use {price} in some expression, the output is 'dollars'. I am looking for
a way to use {price} and have it output '10.00'. How would I do this in AS 3?
This would be like the ColdFusion function 'Evaluate()', where
#Evaluate(price)#, which would return '10.00'.
Any ideas would be highly appreciated. Thanks,
Carlos
cheftimo Guest
-
#39251 [NEW]: variable variable class array property is read only
From: taskfreak at gmail dot com Operating system: mac os PHP version: 5.1.6 PHP Bug Type: Class/Object related Bug... -
#22237 [Com]: PHP crashes when class references property using variable variable
ID: 22237 Comment by: rep at devdomain dot com Reported By: peter at globalvision dot com dot au Status: Closed... -
[PHP] evaluating dynamic variable
this worked for me. <? $entries = 20; for ($i=1; $i<=$entries; $i++) { if(isset($_POST) && $_POST !== ''){ echo "Hello $i<br />"; } } -
evaluating dynamic variable
Hi, I'm having trouble evaluating a dynamic variable. I want to check if the variable $_POST is an empty string, as you'll see from the code.... -
Datalist - how (if) to use a sub variable or session variable in the footer?
Hi, sorry to be greedy with all my posts lately, but can you tell I'm doing new things this week? I've just done my first datalist (a simple... -
Greg Lafrance #2
Re: Evaluating a variable that contains a variable
I thought this might work, but it does not:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
[Bindable]
private var price:String = String(dollars);
[Bindable]
private var dollars: Number = 10.00;
private function clickHandler():void{
dollars = 20.00;
}
]]>
</mx:Script>
<mx:Button label="Click Me" click="clickHandler()"/>
<mx:TextArea id="txtArea" width="300" height="200" text="{price}"/>
</mx:Application>
Greg Lafrance Guest
-
VarioPegged #3
Re: Evaluating a variable that contains a variable
You can do it like so.
TS
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
[Bindable]
private var price:String;
private var currencyString:String = "dollars";
private var dollars: Number = 10.00;
private function clickHandler():void{
price = this[currencyString];
}
]]>
</mx:Script>
<mx:Button label="Click Me" click="clickHandler()"/>
<mx:TextArea id="txtArea" width="300" height="200" text="{price}"/>
</mx:Application>
VarioPegged Guest



Reply With Quote

