Search:
Calendar:
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | 31 |
Subscribe:
Enter your email address to subscribe to this blog.
Archives By Subject:
Action Script (2) [RSS]
Adobe (33) [RSS]
AIR (7) [RSS]
Ajax (3) [RSS]
Buzzword (1) [RSS]
CFUG (42) [RSS]
ColdFusion (70) [RSS]
Flash (6) [RSS]
Flex (40) [RSS]
Frameworks (3) [RSS]
Free Software (2) [RSS]
FXUG (22) [RSS]
General (35) [RSS]
JpgMetadataReader (3) [RSS]
jQuery (1) [RSS]
Mac (2) [RSS]
Off Topic (13) [RSS]
OpenSource (14) [RSS]
PaperVision (10) [RSS]
Spry (2) [RSS]
Transfer (1) [RSS]
Adobe (33) [RSS]
AIR (7) [RSS]
Ajax (3) [RSS]
Buzzword (1) [RSS]
CFUG (42) [RSS]
ColdFusion (70) [RSS]
Flash (6) [RSS]
Flex (40) [RSS]
Frameworks (3) [RSS]
Free Software (2) [RSS]
FXUG (22) [RSS]
General (35) [RSS]
JpgMetadataReader (3) [RSS]
jQuery (1) [RSS]
Mac (2) [RSS]
Off Topic (13) [RSS]
OpenSource (14) [RSS]
PaperVision (10) [RSS]
Spry (2) [RSS]
Transfer (1) [RSS]
Tags:
action script
adobe
air
ajax
cfug
coldfusion
flash
flex
frameworks
free software
fxug
general
jpgmetadatareader
mac
off topic
opensource
papervision
spry
Recent Entries:
Top Posts:
- [23063] Paper Vision 3D Sphere - Carousels on Steroids!
- [15577] Simple Dynamic Cursor Example in Flex2: With source code
- [14385] Simple PaperVision3D Blurring example : source code
- [13774] Simple PaperVision3D Blurring example
- [13036] Saving images from Flex using ColdFusion: Simple Example with source code
- [12609] PaperVision3D/Flex2 Carousel v0.2
- [12515] Carousel v0.2 - source code
- [11647] PaperVision Carousel0.3 - one step closer to the master plan!
- [11327] Simple Effects on a Form - Flex Example
- [10406] PaperVision3D is good for cubes! - a "geek" gift
Recent Comments:
- Simple Effects on a Form - Flex Example
Flex Newbie said: Wow! This page is by far the best page I've seen all month. It's so cool!!! It really made my day. ... [More] - Paper Vision 3D Sphere - Carousels on Steroids!
Reflexion Graphic said: Nice job ! [More] - Getting Red from my color
David said: @Promethe: Thanks for the comment. Jason uses that way too in his example. working with number as n... [More] - Getting Red from my color
Promethe said: guys... seriously: var myColor : uint = 0xef556ef; var myRed : uint = (myColor >> 16) & ... [More] - Getting Red from my color
David said: @Jason: Thanks for the example! I never like working with numbers-to-strings-to-numbers. I'll pull y... [More]
Top Commenters:
- [8] Campbell
- [8] Ben Nadel
- [6] Steve Bryant
- [6] Mark Flewellen
- [4] barry.b
- [4] Raymond Camden
- [3] John Whish
- [3] Peter Bell
- [2] riabook
- [2] carlos
My Links:
RSS:
Binding of properties between sub components
On the NZ Flex UG list, (another) David posted this question.
In the process of testing what he outlined, I created a simple example, which I have posted here.
The point of this example is to show how you can declare "public" variables in a component, and then access those variables as properties form the component that uses it...
The example consists of 2 files:
FormExample.mxml (Application File)
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >
<mx:Panel>
<!-- call in the MyForm component -->
<local:MyForm
id="myForm"
title="My Form"
xmlns:local="*"
/>
<!--
a button with the "enabled" property bound to the "formValid" property of the myForm component above
-->
<mx:Button
id="myButton"
label="My Button: enabled is '{myButton.enabled.toString()}'"
enabled="{myForm.formValid}"
/>
</mx:Panel>
</mx:Application>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >
<mx:Panel>
<!-- call in the MyForm component -->
<local:MyForm
id="myForm"
title="My Form"
xmlns:local="*"
/>
<!--
a button with the "enabled" property bound to the "formValid" property of the myForm component above
-->
<mx:Button
id="myButton"
label="My Button: enabled is '{myButton.enabled.toString()}'"
enabled="{myForm.formValid}"
/>
</mx:Panel>
</mx:Application>
MyForm.mxml (in the root folder of the project)
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:Script>
<![CDATA[
/*
Create property and expose it by declaring it as "public",
and let the compiler know to make if bindable using the [Bindable] meta tag
*/
[Bindable] public var formValid:Boolean = false;
]]>
</mx:Script>
<!-- Something to let us know if the 'form' is currently Valid or Invalid -->
<mx:Text text="Form is Currently {formValid == true ? 'Valid' : 'Invalid'}" />
<!-- simple button to toggle the formValid status -->
<mx:Button label="Toggle Form Valid" click="formValid = !formValid;" />
</mx:Panel>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:Script>
<![CDATA[
/*
Create property and expose it by declaring it as "public",
and let the compiler know to make if bindable using the [Bindable] meta tag
*/
[Bindable] public var formValid:Boolean = false;
]]>
</mx:Script>
<!-- Something to let us know if the 'form' is currently Valid or Invalid -->
<mx:Text text="Form is Currently {formValid == true ? 'Valid' : 'Invalid'}" />
<!-- simple button to toggle the formValid status -->
<mx:Button label="Toggle Form Valid" click="formValid = !formValid;" />
</mx:Panel>
Result:
My Flex Playing requires Adobe Flash Player 9. Get Adobe Flash..
Feel free to ask questions!
PS: There can NEVER be enough Davids!

There are no comments for this entry.
[Add Comment]